Local development
Run stack locally, websockets, debugging, hot reload.
Running the stack
- Postgres + Redis up; fill
backend/.envandfrontend/.env.local. cargo run -p sw-serverfrombackend/.bun devfromfrontend/.- 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.
WebSockets
- URL:
NEXT_PUBLIC_WS_URL→ws://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_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.