Chainfall is a deterministic 1v1 turn-based strategy game played on a grid with countdown “bomb tiles” that tick down and explode in chain reactions.
This repo is a Turborepo monorepo intended to support multiple clients (Canvas / Phaser / Three.js) against a single authoritative NestJS server.
docs/CHAINFALL_SPEC_V1.md— game rules (source of truth)docs/CHAINFALL_TECH_V1.md— architecture + implementation plan.cursor/rules/*.mdc— Cursor rules (coding conventions + structure).cursor/skills/*— skills (invoked explicitly in prompts)
.
├── apps/
│ ├── web-canvas/ # React + Canvas client (v1)
│ ├── web-phaser/ # Phaser client (practice)
│ ├── web-three/ # Three.js client (practice)
│ └── server/ # NestJS (WebSocket + matchmaking + authoritative rooms)
├── packages/
│ ├── game-core/ # deterministic engine: (state, action) -> (state, events)
│ ├── protocol/ # shared message schemas + types (WS contracts)
│ └── bots/ # bot controllers (call game-core only)
├── docs/
│ ├── CHAINFALL_SPEC_V1.md
│ └── CHAINFALL_TECH_V1.md
└── plans/
└── milestones.md
- Node.js (LTS recommended)
- pnpm
- Turbo (optional;
pnpm exec turboworks without global install)
pnpm installThese will stabilize as the repo evolves. Prefer using turbo filters instead of ad-hoc scripts.
Run everything in dev (when configured):
pnpm exec turbo devRun a specific app/package:
pnpm exec turbo dev --filter=web-canvas
pnpm exec turbo dev --filter=serverRun tests:
pnpm exec turbo testTypecheck / lint:
pnpm exec turbo check-types
pnpm exec turbo lintThe main client is web-canvas. Root pnpm dev, pnpm build, and pnpm lint run for Chainfall apps (web-canvas, server) and packages (game-core, protocol, bots). Package names: @chainfall/game-core, @chainfall/protocol, @chainfall/bots. Clients depend on @chainfall/protocol only; server on @chainfall/game-core + @chainfall/protocol; bots on @chainfall/game-core.
- Game rules live in the spec. If rules change, update
docs/CHAINFALL_SPEC_V1.mdfirst. - Determinism: Game logic lives in
packages/game-coreand must be replayable. - Server authoritative: Clients are renderers + input only; server validates all actions.
- Skills are invoked explicitly. (No skill is “automatic” unless you call it in the prompt.)
- Keep changes small and readable; use git commits as your “preview and rollback.”
See: plans/milestones.md
- This project is designed to start with a playable “Play vs Bot” loop as early as possible.
- Later clients (Phaser/Three) should reuse the same
packages/protocol+ server state and must not re-implement game rules.
{
echo "## SUMMARY"
git status --porcelain=v1
echo
echo "## DIFF"
git diff HEAD
} > changes_context.txttree -I 'node_modules|.git' . > tree.txt