Stacks Wars

Local development

Run stack locally, websockets, debugging, hot reload.

Running the stack

cd backend && docker compose up -d postgres redis
cargo run -p sw-server
cd frontend && bun run dev

Local defaults: Compose Postgres/Redis, Clarinet wallet_1, the committed Solana dev key, and INTERNAL_API_SECRET=sw-dev-internal. Sign up skips email OTP unless you set DISABLE_VERIFICATION=false.

Optional full image: docker compose --profile server up --build in backend/ (still local — Railway’s image CMD is --main).

Auth signup locally

Local defaults skip verification so you can enter immediately. Set DISABLE_VERIFICATION=false and RESEND_API_KEY if you want the OTP path. Google only appears when both Google client env vars are set.

See Environment variables.

WebSockets

  • URL: ws://127.0.0.1:8080/app locally
  • Multiplexed topics for session, lobbies, and rooms
  • Game actions are JSON values handled by GameEngine::handle_action

Watch browser Network → WS and RUST_LOG=sw_server=debug for rejects.

Debugging games

  • Unit-test engines with NopHost.
  • Log inside handle_action before returning PluginError.
  • Confirm get_game_state returns what the Room expects after refresh.
  • Verify dev_id and game_id on GET /games/{id}.

Hot reload

LayerReload
Frontend game UINext Fast Refresh (bun dev)
boot.ts / new game folderMay need full refresh after adding imports
Rust game / servercargo run rebuild (no hot swap for engines)

Keep game ids stable while iterating on rules so lobbies remain meaningful.

On this page