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 devLocal 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.
WebSockets
- URL:
ws://127.0.0.1:8080/applocally - 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_actionbefore returningPluginError. - Confirm
get_game_statereturns what the Room expects after refresh. - Verify
dev_idandgame_idonGET /games/{id}.
Hot reload
| Layer | Reload |
|---|---|
| Frontend game UI | Next Fast Refresh (bun dev) |
boot.ts / new game folder | May need full refresh after adding imports |
| Rust game / server | cargo run rebuild (no hot swap for engines) |
Keep game ids stable while iterating on rules so lobbies remain meaningful.