Skip to content
Browse documentation

Create and build a game with @spawnkit/cli

Create a standalone game project with @spawnkit/cli, install dependencies, run the game, and build browser files for publishing.

View Markdown
On this page

Before you start

You need Node.js 24 or newer and pnpm 12. Local game creation needs no SpawnKit account. Run the published @spawnkit/cli package with pnpm or npm. You can also start from a downloadable starter kit.

Check the game development tools
node --version
pnpm --version

You work in your own game project. Keep all work inside your own game folder. See tool installation and version checks if either command is missing.

1. Generate a new game

Open a terminal in the folder where you keep your projects. Choose a new directory name: the CLI refuses to overwrite an existing folder. These tabs launch the same CLI package.

pnpm
pnpm dlx @spawnkit/cli init my-game --add phaser,vitest --dry-run
pnpm dlx @spawnkit/cli init my-game --add phaser,vitest

The dry run shows the proposed files and selected components. The second command asks for confirmation; review and accept it to create the files. In a noninteractive agent session, use --yes only after reviewing the dry-run plan. Phaser supplies the renderer and Vitest supplies tests. For other choices, run pnpm dlx @spawnkit/cli addons --json; use pnpm dlx @spawnkit/cli init for interactive setup.

2. Install and run your game

Enter the generated game folder
cd my-game
pnpm install
pnpm dev

Open the HTTPS address printed in the terminal. The starter scene should appear; use the arrow keys to collect gold. Follow the certificate setup if prompted. Run pnpm exec dev-domains doctor if the local address does not open. Leave the server running while editing. Open a second terminal in my-game for the checks below, or stop the server with Ctrl+C first.

Open this same my-game folder in your editor or AI agent. package.json, src/, and AGENTS.md are at its root. See the Codex, Claude Code, and Cursor guides.

3. Test and create a production build

Inside my-game; Vitest was selected above
pnpm lint
pnpm test
pnpm build
pnpm preview

The build checks TypeScript and writes browser files to dist/. Preview serves that build locally and keeps running until you stop it with Ctrl+C. Play through the scene and check the browser console before publishing. If you chose a kit without tests, use only the scripts present in its package.json.

A successful local build does not upload anything. Follow Publish your game to ZIP the contents of dist/ and upload them, or use the CLI deployment reference to deploy source.

Need a hand? Get support

Explore the guides

Build your first game

Download a standalone game kit, run it locally, and make your first change.

Create and build a game with @spawnkit/cli

Start in a parent folder, generate your game, then run every development command inside the new game folder.

Upload an existing browser game

Upload a self-contained browser build. Your original source, engine, and build tools can stay as they are.

Publish your game

The dashboard accepts a ZIP of your built game. You will need an account to deploy it.

Use the SpawnKit dashboard

The dashboard manages your hosted games. Your editor or AI agent remains where you change and build your game source.

Make a browser game with Codex

Use Codex with a standalone TypeScript game kit. Start with a working scene and improve it one playable change at a time.

Make a browser game with Claude Code

Use Claude Code with a standalone TypeScript game kit. Start with a working scene and improve it one playable change at a time.

Make a browser game with Cursor

Use Cursor with a standalone TypeScript game kit. Start with a working scene and improve it one playable change at a time.

Extend your game

Find the right files, make a focused change, and check it in a playable build.

A complete publishing example

Follow a small example from editable source to a ZIP with index.html at its root. Use your own game title, description, and artwork.

Add tools to an existing game

Keep a recoverable baseline, inspect the proposed changes, and verify one addition at a time.

Test and debug your game

Combine automated checks with a short playthrough of the production build. A successful build alone does not verify gameplay.

Project structure and configuration

Your downloaded kit is a standalone TypeScript project. Its files belong to you and do not depend on the SpawnKit repository.

SpawnKit CLI reference

A command-by-command reference to the implemented CLI. Local generation works without an account; hosted operations require access to a project.

Accounts and access

Building locally is account-free. Publishing requires an account with access to the target project.

Agents and API resources

Public discovery endpoints are account-free. Use the dashboard or @spawnkit/cli for publishing.

16 guides available