TypingWars
TypeWars is a real-time multiplayer typing battle game built with Next.js 15, PartyKit (WebSocket), Prisma, and NextAuth. Players can create or join rooms, compete in typing races, and track their performance across multiple game modes. The application features a room leader system where the creator holds authority to manage players, change game modes, and initiate countdowns. Live progress, WPM tracking, and a global leaderboard are synchronized in real time across all connected clients.
- Type
- Game Development
- Client
- Self-initiated
- Completed
- 2026-05-04
Challenges and learnings
WebSocket identity management using bidirectional connection-to-user ID mapping
real-time state synchronization across multiple clients via PartyKit server broadcasting
decoupling client identity from session data by having the server assign and confirm player IDs through a dedicated joined event
race condition handling between WebSocket onConnect and join_room message ordering
leader-based authorization pattern where all privileged actions are validated server-side against a stored leaderId
countdown reset logic triggered by mid-session player joins
Next.js App Router with server components and client components separation
Tailwind CSS mobile-first design system with custom color tokens and component classes
JWT session callback configuration in NextAuth v5 to expose custom user fields
Prisma ORM integration with PostgreSQL for persisting game results and leaderboard entries
