Ramesh Inampudi

Games

Building a Multiplayer UNO Game with Node.js and Socket.IO

By Ramesh Inampudi · 2026-11-10 · 5 min read

Card games look simple until you try to put one online. Friends in different cities need to play the same hand, someone's phone drops off Wi-Fi mid-turn, and a modified browser could easily lie about what cards it holds. I built UNO Ultimate, a web-based UNO game, to deal with exactly those problems: you can play against the computer or with friends anywhere by sharing a link.

Why I built it

I wanted a UNO game that did not need an account or an install, and that I could change freely. Official versions fix the rules; house rules vary from family to family. I wanted the lobby to let a group agree on the rules, and I wanted new modes and themes to be a small code change rather than a rewrite. The project is written in JavaScript, HTML and CSS, and it started in late September 2026.

What it does

Two of the modes are worth explaining. In No Mercy, draw cards stack, you draw until you can play, 7 swaps hands, 0 passes all hands, and anyone who reaches 25 cards is knocked out. In Liar's UNO, every card is played face-down while you announce what it is, and lying is allowed. The next player either believes you or calls LIAR. If you were lying you take the card back and draw 2; if the accusation was wrong, the accuser draws 2.

How it works

The server is a Node.js application (version 18 or newer) that serves the static front end and runs Socket.IO for real-time communication. The layout separates concerns clearly:

A server-authoritative engine

The most important decision was making the rules engine live on the server. Clients send intentions, such as playing a card, and the server decides whether that is legal and what happens next. Because players never run the rules themselves, they cannot cheat by editing the page. It also means the computer players use the same engine as humans, so a bot move goes through exactly the same validation as a human one.

Modes as data plus a small engine

Each game mode is a file that declares an id, name, description, default rules and a buildDeck() function that returns the list of cards. The engine understands a fixed vocabulary of card types: numbers, skip, reverse, draw +N, skip everyone, discard all, flip, wild, wild draw +N, wild reverse draw +N, colour roulette and wild draw colour. Any combination and any +N value works, which is why a +15 deck is just a different list. To add a mode you copy megadraw.js, change those fields and register it in server/variants/index.js. Only a card with a genuinely new effect needs a new case in resolvePlay() in game.js.

Themes

A theme is a block in public/js/themes.js: card colours and names, action-card names, the table cloth, the table edge and the printed card back. Copy a block, give it a new key, and it appears in the theme menus. A development gallery page at /dev/gallery.html shows every card type in every theme, which makes previewing changes quick.

Deployment

Socket.IO needs long-lived WebSocket connections and the rooms are held in memory, so a serverless platform such as Vercel is the wrong fit. The repository includes a render.yaml, so a Deploy to Render button can put a copy online with nothing to configure; Render checks a /health endpoint and pushes redeploy automatically. Any host that runs a normal Node.js server works too, including Railway and Fly.io. For a quick session, you can run the game locally and expose it with npx cloudflared tunnel --url http://localhost:3000, which prints a temporary public link while your computer is running. The trade-offs are honest ones: on the free tier the server sleeps when idle, so the first visit can take about 30 seconds, and a restart or redeploy ends games in progress because rooms live in memory.

What I learned

Conclusion

UNO Ultimate is a small project, but it covers a useful set of multiplayer fundamentals: an authoritative server, data-driven variants, reconnection handling and simulation testing. If you want to try it, clone the repository, run npm install and npm start, then open http://localhost:3000. Anyone on the same Wi-Fi can join using the address the terminal prints.