# Deploy a game to its own web address

Some projects have their own website on this server, e.g. **https://arkade.4p.dk/** for Arkade 3D (with Sakura Royale).
You publish a new version by uploading the game folder. It's live a second later.

> **For Claude Code:** follow this exactly. The deploy key is a secret. Never print it, put it in the
> source code, commit it, or paste it into a chat or artifact.

## 1. Store the deploy key once

The owner gives you a deploy key that looks like `K7QX-M2PA-RT4H` (12 characters, case and dashes don't matter).
Save it in a file in your home folder (not in the project folder):

```bash
# macOS / Linux
printf '%s' 'PASTE-THE-KEY-HERE' > ~/.arkade-deploy-key && chmod 600 ~/.arkade-deploy-key
```

```powershell
# Windows (PowerShell)
Set-Content -NoNewline -Path "$HOME\.arkade-deploy-key" -Value 'PASTE-THE-KEY-HERE'
```

## 2. Deploy

Run this from anywhere. `GAME_DIR` is the folder that contains `index.html` (and `core.js`, `games/` …):

```bash
GAME_DIR=./arkade   # <- the folder with index.html
COPYFILE_DISABLE=1 tar czf - -C "$GAME_DIR" . \
  | curl -sS --fail-with-body -H "Authorization: Bearer $(cat ~/.arkade-deploy-key)" \
      --data-binary @- https://hub.4p.dk/deploy/arkade
```

On Windows, use Git Bash or WSL for the same command (Windows 10+ also has `tar` and `curl` built in).

Success looks like this:

```json
{ "ok": true, "site": "arkade", "release": "20261119-141502", "files": 106, "newFiles": 3, "bytes": 2481234, "url": "https://arkade.4p.dk/" }
```

Then open the `url`. Browsers always fetch the newest version (no cache problems). The response header
`x-release` tells you which version you got.

## 3. Versions and rollback

Every deploy is a new version. The old ones are kept (the last 50).

```bash
KEY=$(cat ~/.arkade-deploy-key)
curl -sS -H "Authorization: Bearer $KEY" https://hub.4p.dk/deploy/arkade/releases            # list versions
curl -sS -X POST -H "Authorization: Bearer $KEY" "https://hub.4p.dk/deploy/arkade/rollback?to=20261119-141502"   # go back
```

## Rules for the upload

| | |
|---|---|
| Format | `.tar.gz` of the folder. `index.html` must be at the top level (use `tar -C <folder> .`). |
| Allowed file types | html, js, mjs, css, json, txt, md, svg, png, jpg, gif, webp, ico, avif, mp3, ogg, wav, m4a, mp4, webm, glb, gltf, bin, wasm, woff, woff2, ttf, webmanifest |
| Paths | Letters, digits, `_ - .` and `/` only. No spaces, no `..`. |
| Not allowed | Symlinks, server code (php, py …), `.env` files and other file types. The whole deploy is rejected and nothing changes. |
| Size | Max 80 MB compressed, 300 MB uncompressed, 5000 files. |
| Wrong key | `401`. 5 wrong keys in 10 minutes → blocked for 10 minutes. |

The site is plain static files. There's no server code, so multiplayer goes through the Game Hub
(`https://hub.4p.dk/spec.md`).
