> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nodeloc.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Local development and publishing

> Pack and upload game packages, release channels and staged rollouts, and a pre-launch checklist

## Prepare the app

1. Open [Develop apps](https://www.nodeloc.com/apps/authoring) and create an app. The app's identifier is the game identifier and must match `id` in `manifest.json`.
2. Put `manifest.json`, the entry page, and `nl-game-sdk.js` in the game directory.

## Pack

A game package is a zip file with the `.nlgame` extension and `manifest.json` at the root. Increase `build` by one before each upload. The Tap Tap template's `pack.sh` is a useful reference:

```bash theme={null}
cd my-game
zip -qrX ../my-game-0.1.0-2.nlgame . -x '.*' -x 'dist/*'
```

## Upload

Call the upload endpoint with your forum session. The form field `file` is the game package:

```bash theme={null}
curl -b cookies.txt -H "Origin: https://www.nodeloc.com" \
  -F "file=@my-game-0.1.0-2.nlgame" \
  "https://www.nodeloc.com/api/v1/games/my-game/releases/upload"
```

A successful upload returns HTTP `201` with `{release, findings, url}`. `findings` are warnings from the static scan. On failure:

| Status | code | Reason |
| - | - | - |
| 422 | `package_rejected` | The package failed the checks; `error.findings` lists the reasons |
| 409 | `build_not_increasing` | `build` is not greater than the registered builds |
| 403 | | Not the app author |

See [Manifest, scopes, and game packages](https://docs.nodeloc.com/en/minigames/manifest.md#game-packages) for the package checks. A game is registered automatically on its first upload with no approved scopes, pending review.

## Channels and review

| Channel | Who gets it |
| - | - |
| `dev` | The author and staff. Every package the author uploads goes to this channel |
| `review` | Reviewers |
| `beta` | Everyone, assigned by rollout percentage |
| `stable` | Everyone |

After review, staff approve scopes and release the package to `beta` or `stable`. They can set a rollout percentage, disable a game, or revoke a build. Revoked builds are deleted from the app's local cache, and active connections are disconnected.

A new build takes effect the next time the user starts the game. When the web version opens a page for an old build, the SDK redirects to the current version.

## Test

* Browser: open `https://www.nodeloc.com/games/{slug}` in a desktop browser. The forum redirects to the web version and completes authorization. Room invite links are `/games/{slug}?room=…`.
* App: open the game from the app directory or an invite link. The app downloads the game package and verifies its signature, and shows a retry option if loading fails.
* Use `nl.debug.log` for debug logs.

## Pre-launch checklist

* `build` is greater than the previous one; `scopes` lists only what you use; `network.connect` lists only the addresses you need.
* No inline scripts, external scripts, or `eval`. Large images are compressed to WebP, and the package is at most 20 MB.
* Call `nl.ready()` within 3 seconds. Pause when sent to the background, and turn on `setExitGuard` during a match.
* Handle `AUTH_REQUIRED` (show a sign-in button), `USER_CANCELLED` (not an error), `SCOPE_DENIED`, and `NOT_SUPPORTED`.
* Read game energy numbers from `nl.energy.getWallet()` instead of hard-coding them.
* Multiplayer games: the client does not referee, and it recovers from reconnections and sequence gaps.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.