A beautiful, animated implementation of the classic strategy board game Quoridor, built with Next.js, Framer Motion, and Redis. Play locally on a single device or invite a friend for a real-time online match.
Live Demo: quoridor.vrandagarg.in
Creator: Vranda Garg
The main goal of this project wasn't just to build a game that already exists, but to deeply understand how real-time systems work under the hood, specifically without requiring user sign-ups or complex authentication.
I wanted to explore how to synchronize game state instantly between two players. Through this journey, I researched various real-time communication patterns:
- Short Polling: Repeatedly asking the server for updates.
- Long Polling: Holding a request open until data is available.
- WebSockets / Socket.io: Full duplex communication channels.
- Server-Sent Events (SSE): A unidirectional stream from server to client.
Implementation Details: For this project, I implemented a Serverless-friendly approach using HTTP + SSE (Server-Sent Events).
- Redis acts as the single source of truth for game state.
- SSE pushes updates instantly to clients without them needing to refresh or poll.
- The system is completely stateless and frictionless—users can jump in via a link and play immediately.
- Local Pass & Play: Two-player mode on a single device.
- Online Multiplayer: Real-time matches with friends via shareable room codes.
- Animated UI: Smooth ghost animations, wobble text effects, and 3D wooden board design.
- Rule Validation: Fully validated moves and wall placements (walls cannot block all paths).
- Responsive Design: Optimized for both desktop and mobile play.
- Confetti Celebration: Fun victory effects when a player wins.
- Framework: Next.js 15 (App Router)
- Styling: Tailwind CSS, Framer Motion (animations)
- State Management: Zustand
- Real-time Backend: Redis (Upstash) + Server-Sent Events (SSE)
- Icons: React Icons
- Fonts: Geist Sans, Fredoka, Rubik Bubbles
-
Clone the repository:
git clone https://github.com/VrandaaGarg/quoridor-game.git cd quoridor-game -
Install dependencies:
pnpm install # or npm install -
Set up Environment Variables: Create a
.env.localfile and add your Redis credentials (required for online mode):UPSTASH_REDIS_REST_URL=your_url_here UPSTASH_REDIS_REST_TOKEN=your_token_here
-
Run the development server:
pnpm dev
-
Open: http://localhost:3000
The goal is to be the first pawn to reach any cell on the opposite side of the board.
- Move: On your turn, move your pawn one square horizontally or vertically.
- Place a Wall: Instead of moving, you can place a wall to block your opponent or create a path for yourself.
- You have 10 walls.
- Walls span two squares.
- Rule: You cannot completely block off a player from reaching their goal. There must always be at least one path to victory.
This project is open-source and available under the MIT License.
