This is a multiplayer (3 or 4 players) card game.
Bismarck is a Finnish trick-taking card game for 3–4 players, played with a standard 52-card deck. Players compete in four game modes—Trump, No-Trump, Misere, and Choice—taking turns as the dealer. The goal is to win the most points by collecting or avoiding tricks, depending on the mode. After all rounds, the player with the highest score wins.
- Node.js (v24+)
- Wrangler CLI for Cloudflare Workers
- Backend: Cloudflare Workers
- Storage: Durable Objects for game state, KV namespace for login tokens
- Frontend: Vite + React
npm install -g wranglerwrangler loginBackend (in src/bismarck-server):
Environment variables are managed using a .dev.vars file.
-
Create a new
.dev.varsfile insrc/bismarck-server/. -
Edit
.dev.varsto set your environment variables:ENVIRONMENT=development DISABLE_EMAIL_SENDING=true JWT_SECRET=your-secret SMTP_HOST= SMTP_USERNAME= SMTP_PASSWORD= CORS_ORIGIN=*ENVIRONMENT: Set todevelopmentorproduction.DISABLE_EMAIL_SENDING: Set totrueto disable email sending in development.JWT_SECRET: Secret key for JWT tokens.SMTP_HOST,SMTP_USERNAME,SMTP_PASSWORD: Email server configuration. Can be empty in developmet environment.CORS_ORIGIN: Allowed CORS origins (e.g.,*for all).
-
The application will automatically load variables when running locally.
Frontend (in src/bismarck-web):
VITE_API_URL=http://localhost:8787# Backend
cd src/bismarck-server
npm install
# Frontend
cd ../bismarck-web
npm installcd src/bismarck-server
wrangler devThe API will be available at http://localhost:8787/api
cd src/bismarck-web
npm run devThe web app will be available at http://localhost:5173
- Browse to http://localhost:5173/create
- Fill the form with unique player names and emails
- Fetch login codes from the Wrangler dev terminal output
- Each player can login with their code, these can be run on separate browser tabs
cd src/bismarck-server
wrangler deployNote: Make sure to configure production secrets:
wrangler secret put JWT_SECRETThis project uses Cosmos React for interactive component development and testing.
-
Go to the frontend directory:
cd src/bismarck-web -
Start Cosmos:
npx cosmos
-
Open the Cosmos UI in your browser (usually at http://localhost:5000) to browse and interact with React components in isolation.
- Add fixture files in
src/bismarck-web/components/__fixtures__or alongside your components. - See the Cosmos documentation for details on writing and organizing fixtures.