A multiplayer browser game built with Next.js and Cloudflare Workers using WebSockets and Durable Objects.
web/– Frontend (Next.js app)ws/– Backend (Cloudflare Worker using Durable Objects)
cd web
pnpm installCreate a .env file and set the WebSocket URL:
NEXT_PUBLIC_WS_URL=wss://your-cloudflare-worker-url
Run in development:
pnpm devBuild for production:
pnpm build
pnpm startcd ws
pnpm installRun locally for development:
pnpm devDeploy to Cloudflare:
pnpm run deploy-
The game is themed around CID (Crime Investigation Department).
-
Players are randomly assigned one of the following roles:
- CID (main detective)
- Killer
- Other players are regular participants.
-
The first player to join becomes the admin and gets access to the "Start Game" button.
-
When the game is started, roles are shuffled and assigned.