eduardokairalla1/code-royale

A multiplayer coding game: one challenge, one clock, the best coder takes the crown.

TypeScript

1

252 commits

updated Oct 4, 2026

See the code

See what people are saying

README

Code Royale

CI TypeScript Node React Vite Fastify Socket.IO Go Redis Piston Docker License

A multiplayer coding game. I made it because my friends and I wanted a good coding game to play in our spare time.

Play it at coderoyale.app.

A match of Code Royale

A match

  1. Create a room and share its code or link with your friends.
  2. The host picks the difficulties, easy, medium, hard or any mix, and starts the round.
  3. Everyone gets the same challenge and the same clock. Write your solution in Python, JavaScript, TypeScript, Go, Java, C, C++ or Rust, with autocomplete, and run it against the examples as often as you like.
  4. You submit once, against hidden tests. When time runs out, whatever is in your editor is submitted for you.
  5. The most tests passed wins, the fastest submission breaks ties. Then read everyone's code and play again.
LobbyPlaying
The lobby, with the players and the difficulty filterThe editor with autocomplete, next to the challenge
ResultsEveryone's code
The podium and the rankingAnother player's submitted code

How it works

browser ──http, Socket.IO──▶ backend ──▶ Piston (runs the code)
                                 │
                                 ▼
                               Redis (rooms, rounds, timers)
                                 ▲
        ──websocket────────▶ lsp service (autocomplete)
PartWhat it isStack
frontendthe game's pagesReact, TypeScript, Vite, Monaco
backendrooms, rounds, judgingNode, TypeScript, Fastify, Socket.IO, Redis
lspa language server per editorGo, Redis
deployDocker Compose for the whole thingDocker, Piston, Redis

Player code runs in Piston, self hosted.

Tech stack

LayerTechnology
LanguagesTypeScript (backend, frontend), Go (lsp)
FrontendReact 19 + Vite, React Router
EditorMonaco, with autocomplete over the Language Server Protocol
LookRough.js and Rough Notation (hand-drawn), Motion, Radix UI
BackendNode 24, Fastify
RealtimeSocket.IO, with the Redis adapter across instances
StateRedis: rooms, rounds, timers, locks
Code runnerPiston, self hosted
Language serverspyright, typescript-language-server, gopls, clangd, rust-analyzer, jdtls
ContainersDocker Compose, nginx for the frontend
CIGitHub Actions, images on Docker Hub

Running it

You need Docker with Compose v2 and about 12 GB of disk.

cd deploy
cp .env.example .env     # set LSP_SECRET: openssl rand -hex 32
docker compose up -d --build

The first start takes a few minutes while Piston installs the languages. Then open http://localhost:8080.

To work on the code, run Piston in Docker and the services on your machine. deploy/README.md has the steps, and each part's README covers its own settings.

Repository

backend/       # game server; challenges/ holds the challenge files
frontend/      # web client
lsp/           # language server service
deploy/        # compose files and Piston config
docs/          # code guidelines and images
.github/       # CI: tests, and images for Docker Hub
VERSION        # release version, used in the image tags

Adding a challenge

Add a json file to backend/challenges/ with a statement, examples and hidden tests. The format is in backend/README.md.

Tests

cd deploy && docker compose -f docker-compose.yaml \
  -f docker-compose-dev.yaml up -d redis   # backend and lsp tests need it
cd backend && npm test
cd frontend && npm test
cd lsp && go test ./...

CI runs them on every pull request and again on every merge to main.

Contributing

New challenges, fixes and ideas are welcome. Start with CONTRIBUTING.md; to report a vulnerability, see SECURITY.md.

License

MIT

coding-challenges
coding-game
competitive-programming
docker-compose
fastify
golang
language-server
monaco-editor
multiplayer-game
nodejs
piston
react
realtime
redis
self-hosted
socket-io
typescript
vite

eduardokairalla1/code-royale

A multiplayer coding game: one challenge, one clock, the best coder takes the crown.

TypeScript

1

252 commits

updated Oct 4, 2026

See the code

See what people are saying

README

Code Royale

CI TypeScript Node React Vite Fastify Socket.IO Go Redis Piston Docker License

A multiplayer coding game. I made it because my friends and I wanted a good coding game to play in our spare time.

Play it at coderoyale.app.

A match of Code Royale

A match

  1. Create a room and share its code or link with your friends.
  2. The host picks the difficulties, easy, medium, hard or any mix, and starts the round.
  3. Everyone gets the same challenge and the same clock. Write your solution in Python, JavaScript, TypeScript, Go, Java, C, C++ or Rust, with autocomplete, and run it against the examples as often as you like.
  4. You submit once, against hidden tests. When time runs out, whatever is in your editor is submitted for you.
  5. The most tests passed wins, the fastest submission breaks ties. Then read everyone's code and play again.
LobbyPlaying
The lobby, with the players and the difficulty filterThe editor with autocomplete, next to the challenge
ResultsEveryone's code
The podium and the rankingAnother player's submitted code

How it works

browser ──http, Socket.IO──▶ backend ──▶ Piston (runs the code)
                                 │
                                 ▼
                               Redis (rooms, rounds, timers)
                                 ▲
        ──websocket────────▶ lsp service (autocomplete)
PartWhat it isStack
frontendthe game's pagesReact, TypeScript, Vite, Monaco
backendrooms, rounds, judgingNode, TypeScript, Fastify, Socket.IO, Redis
lspa language server per editorGo, Redis
deployDocker Compose for the whole thingDocker, Piston, Redis

Player code runs in Piston, self hosted.

Tech stack

LayerTechnology
LanguagesTypeScript (backend, frontend), Go (lsp)
FrontendReact 19 + Vite, React Router
EditorMonaco, with autocomplete over the Language Server Protocol
LookRough.js and Rough Notation (hand-drawn), Motion, Radix UI
BackendNode 24, Fastify
RealtimeSocket.IO, with the Redis adapter across instances
StateRedis: rooms, rounds, timers, locks
Code runnerPiston, self hosted
Language serverspyright, typescript-language-server, gopls, clangd, rust-analyzer, jdtls
ContainersDocker Compose, nginx for the frontend
CIGitHub Actions, images on Docker Hub

Running it

You need Docker with Compose v2 and about 12 GB of disk.

cd deploy
cp .env.example .env     # set LSP_SECRET: openssl rand -hex 32
docker compose up -d --build

The first start takes a few minutes while Piston installs the languages. Then open http://localhost:8080.

To work on the code, run Piston in Docker and the services on your machine. deploy/README.md has the steps, and each part's README covers its own settings.

Repository

backend/       # game server; challenges/ holds the challenge files
frontend/      # web client
lsp/           # language server service
deploy/        # compose files and Piston config
docs/          # code guidelines and images
.github/       # CI: tests, and images for Docker Hub
VERSION        # release version, used in the image tags

Adding a challenge

Add a json file to backend/challenges/ with a statement, examples and hidden tests. The format is in backend/README.md.

Tests

cd deploy && docker compose -f docker-compose.yaml \
  -f docker-compose-dev.yaml up -d redis   # backend and lsp tests need it
cd backend && npm test
cd frontend && npm test
cd lsp && go test ./...

CI runs them on every pull request and again on every merge to main.

Contributing

New challenges, fixes and ideas are welcome. Start with CONTRIBUTING.md; to report a vulnerability, see SECURITY.md.

License

MIT

coding-challenges
coding-game
competitive-programming
docker-compose
fastify
golang
language-server
monaco-editor
multiplayer-game
nodejs
piston
react
realtime
redis
self-hosted
socket-io
typescript
vite