Stacks Wars

Local development

Run stack locally, websockets, debugging, hot reload.

Running the stack

  1. Postgres + Redis up; fill backend/.env and frontend/.env.local.
  2. cargo run -p sw-server from backend/.
  3. bun dev from frontend/.
  4. Sign in via Neon Auth against your configured project.

For Redis-only via Docker: docker compose up redis in backend/.

Auth signup locally

Neon Console should have Verify at Sign-up + Verification code when you want the OTP UI.

  • Default: disposable emails are rejected (fakeout) before Neon Auth; after signup the UI asks for the email code.

See Environment variables.

WebSockets

  • URL: NEXT_PUBLIC_WS_URLws://127.0.0.1:8080/app
  • 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