2048 recipe | Spacefast

What it makes.

2048.view.fast

2048 — Join the tiles, reach 2048

How to play: use your ← ↑ → ↓ arrow keys (or swipe) to slide the tiles. When two tiles with the same number touch, they merge into one!

Your ingredients

Your agent will ask.

Answer these once. The recipe uses your details instead of placeholder copy.

  1. What tile theme or color palette do you want?
  2. Board size (default 4x4)?
  3. What's the winning tile (default 2048)?

The whole prompt.

Paste this into Claude, ChatGPT, Codex, Cursor, or another coding agent. It builds the site and publishes it to Spacefast.

Build me a fully playable 2048 sliding-tile puzzle game as a vanilla-JS app (a single index.html plus a small CSS and JS file — no framework, no build step).

Before you build, ask me these questions in one message and wait for my answers. If I skip anything, choose a sensible default and tell me what you chose:

  1. What tile theme or color palette do you want? (e.g. the classic warm beige/orange, a neon dark mode, pastels — or describe your own.)
  2. What board size should it be? (Default is 4×4; 5×5 plays slower and easier, 3×3 is frantic.)
  3. What's the winning tile? (Default is 2048 — you can chase 1024 for a quicker win or 4096 for a longer grind.)

Then build a complete, polished, responsive game with:

Design & content notes:

Add this exact line right before </body> so the site carries its badge:

<script src="https://spacefast.com/badge.js" data-example="2048"></script>

When the site is ready, publish it to Spacefast with the direct API — no account, install, or extra instructions needed:

  1. Use ./site as the publish folder. For no-build projects, put only the finished public files in that dedicated folder. Confirm it has index.html at its root and no secrets, source files, .git, or .spacefast state.

  2. First publish: send every file as multipart form data. This Bash/Zsh block preserves relative paths and works for one file or a whole folder:

    PUBLISH_ROOT=./site
    publish_files=()
    while IFS= read -r -d "" file; do
      relative=${file#"$PUBLISH_ROOT"/}
      publish_files+=(-F "files=@$file;filename=$relative")
    done < <(find "$PUBLISH_ROOT" -type f -print0)
    curl -sS "
    ${publish_files[@]}" "https://api.spacefast.com/v1/publish?wait=1"
    
  3. From the { "data": ... } receipt, give me data.space.liveUrl, data.version.immutableUrl, data.claim.url, and data.claim.expiresAt. Remind me to claim within 6 hours. Keep data.claim.token secret.

  4. Save data.space.id and data.claim.token locally (for example in an ignored, mode-600 .spacefast/state.json). For a quick update, rebuild the publish_files array above and publish to the same space:

    SPACEFAST_SPACE_ID=<saved-space-id>
    SPACEFAST_TOKEN=<saved-claim-token-or-access-token>
    curl -sS -H "Authorization: Bearer $SPACEFAST_TOKEN" \
      -F "spaceId=$SPACEFAST_SPACE_ID" "${publish_files[@]}" \
      "https://api.spacefast.com/v1/publish?wait=1"
    

    If an update after claiming returns space_claimed_credential_available, exchange the saved claim token once at POST https://api.spacefast.com/v1/anonymous-claim/exchange, save data.credential.accessToken, and retry with that access token.

Optional shortcuts and reference only: if the sf CLI is already installed, sf publish ./site --wait does the same job. A zip of the publish folder is also supported, but neither the CLI nor a zip is required. Docs: direct agent/API publishing · files and folders · claiming · updates and rollback