What is Dutch?
Dutch is a real-time multiplayer card game for 2–4 players that runs in the browser. It's about memory and bluffing:
- Everyone starts with 50 points and 4 face-down cards, and gets to peek at two of them at the start of each round.
- On your turn you draw from the deck or the discard pile, then either swap the card into your hand or throw it away.
- Jacks let you swap cards between two players. Queens let you peek at any card.
- Anyone can stack a card that matches the top of the discard pile, even when it's not their turn. Stack the wrong card and you take a penalty card.
- When you think your hand is low enough, call Dutch. Everyone else gets one last turn, then all hands are revealed.
- The points in your hand come off your score (black kings count as 0). Drop to 0 and you're out. The last player standing wins.
There's nothing to install and no account to make. Create a room, send the link to your friends and play.
👉 Play: playdutch.party
💻 Code: github.com/gorilaprada/dutch
Why I built it
Dutch was the game my friends and I always played. Whenever we got together, someone took out a deck and we'd play.
Then I moved away, and we couldn't play anymore. I didn't find a good online version, so I made one. Now we can get into a call, open the link and play like we used to, even though we're far apart.
It also became my biggest learning project. I started with an object-oriented design, but the game state ended up spread across lots of objects, and every new rule meant chasing down side effects. So I rewrote it with a data-oriented design: the game is plain, immutable data, and every move is a pure function that takes one state and returns the next state or an error. After that rewrite, adding rules and fixing bugs got a lot easier.
Tech stack
It's TypeScript everywhere, in a pnpm monorepo with three parts:
🧠 Rules engine (src/)
A small library with no I/O. It holds the game state, the moves and the views. Because every move is a pure function, testing the rules is just "given this state and this action, expect that state."
⚡ Server (server/)
Express 5 + Socket.IO 4, with rooms, sessions, reconnects and timed phases such as the break between rounds. Each player gets their own view of the game, built on the server. Hidden cards never leave the server, so nobody can cheat by looking at network traffic in DevTools.
🎴 Client (client/)
React 19 + Vite + Motion for the animations: dealing, flipping cards, cards flying across the table, plus a spectator mode.
✅ Tests
Vitest covers the rules, the server and the React components. There are also end-to-end tests that play full games against a real server.
Containerization
Everything ships as one Docker image, and one Node process serves both the built React client and the Socket.IO server. A few details I'm happy with:
- Multi-stage build. One stage builds the client. Another installs only the server's production dependencies. The final image gets only what it needs to run, with no pnpm and no dev dependencies.
- No server build step. Node runs the TypeScript source directly with its built-in type stripping, so only the client gets compiled.
- Runs as an unprivileged user (
USER node). - Has a
/healthendpoint with a DockerHEALTHCHECK, and shuts down cleanly onSIGTERM.
Deployment: home server + Cloudflare Tunnel
Dutch doesn't run on a cloud provider. It runs on my home server and is exposed to the internet with a Cloudflare Tunnel (cloudflared).
The container only listens on 127.0.0.1, so it isn't reachable from my network. cloudflared makes an outbound connection to Cloudflare, and Cloudflare sends traffic for playdutch.party through it. That means no open ports on my router and no exposed home IP, and I get TLS and Cloudflare's edge for free. WebSockets work through the tunnel with no extra setup.
Deploys are a small bash script:
- Fetch from
originand stop if nothing changed. - Build a new image tagged with the commit SHA. The old container keeps serving while it builds.
- Swap the old container for the new one (
--restart unless-stopped). - Keep the last few SHA-tagged images for quick rollbacks and prune the rest.
For now, game state lives in memory. Later I might add PostgreSQL and JWTs to keep game state.
Come play!
If you try Dutch, I'd love to hear what you think: bugs, rule suggestions, feedback on the code, anything. And if you want someone to play with, I'm always up for a game.
📬 Reach me at me@carlosprada.dev
🎮 Play at playdutch.party
💻 Code at github.com/gorilaprada/dutch
