A full-stack event ticketing platform inspired by Ticketmaster, featuring seat selection, real-time availability, virtual waiting room for high-demand events, and time-limited checkout.
| Metric | Value |
|---|---|
| Total SLOC | 8,535 |
| Source Files | 55 |
| .ts | 4,639 |
| .md | 1,754 |
| .tsx | 1,590 |
| .sql | 312 |
| .json | 137 |
- Event Browsing: Search and filter events by category, date, artist, and venue
- Interactive Seat Selection: Visual seat map with real-time availability
- Seat Reservation with Locking: Distributed seat locks using Redis prevent double-booking
- Virtual Waiting Room: Fair queue system for high-demand events
- Time-Limited Checkout: 10-minute hold on reserved seats with countdown timer
- Order Management: View purchased tickets and order history
- Distributed Locking: Redis-based seat locks ensure no overselling
- Optimistic Locking: Database transactions with
FOR UPDATE NOWAITfor race condition prevention - Virtual Waiting Room: FIFO queue with configurable concurrent shopper limits
- Real-time Updates: Short-TTL caching for seat availability during high traffic
- Background Jobs: Automatic cleanup of expired holds
- Node.js + Express
- PostgreSQL (primary data store)
- Redis (session storage, distributed locks, queues)
- TypeScript
- React 19 + TypeScript
- Vite (build tool)
- TanStack Router (routing)
- Zustand (state management)
- Tailwind CSS (styling)
- Node.js 18+
- Docker and Docker Compose (for databases)
- npm or yarn
-
Clone and navigate to the project
cd ticketmaster -
Start the databases
docker-compose up -d
-
Install backend dependencies
cd backend npm install -
Start the backend server
npm run dev
The API server will start on http://localhost:3001
-
In a new terminal, install frontend dependencies
cd frontend npm install -
Start the frontend
npm run dev
The frontend will start on http://localhost:5173
If you prefer to run PostgreSQL and Redis natively:
-
Install PostgreSQL and Redis
- macOS:
brew install postgresql redis - Ubuntu:
sudo apt install postgresql redis-server
- macOS:
-
Start the services
# macOS with Homebrew brew services start postgresql brew services start redis # Ubuntu sudo systemctl start postgresql sudo systemctl start redis-server
-
Create the database
createdb ticketmaster psql ticketmaster -f backend/src/db/init.sql
-
Set environment variables (optional)
export DB_HOST=localhost export DB_PORT=5432 export DB_USER=your_username export DB_PASSWORD=your_password export DB_NAME=ticketmaster export REDIS_HOST=localhost export REDIS_PORT=6379
-
Start the backend and frontend as described above
For testing load balancing and distributed behavior:
# Terminal 1 - Instance on port 3001
npm run dev:server1
# Terminal 2 - Instance on port 3002
npm run dev:server2
# Terminal 3 - Instance on port 3003
npm run dev:server3POST /api/v1/auth/register- Register new userPOST /api/v1/auth/login- Login and create sessionPOST /api/v1/auth/logout- Logout and invalidate sessionGET /api/v1/auth/me- Get current user
GET /api/v1/events- List events (supports filtering)GET /api/v1/events/:id- Get event details
GET /api/v1/venues- List all venuesGET /api/v1/venues/:id- Get venue detailsGET /api/v1/venues/:id/sections- Get venue sections
GET /api/v1/seats/:eventId/availability- Get seat availability by sectionGET /api/v1/seats/:eventId/sections/:section- Get individual seats in sectionPOST /api/v1/seats/:eventId/reserve- Reserve seats (creates 10-min hold)POST /api/v1/seats/:eventId/release- Release held seatsGET /api/v1/seats/reservation- Get current reservation
POST /api/v1/queue/:eventId/join- Join waiting room queueGET /api/v1/queue/:eventId/status- Get queue positionPOST /api/v1/queue/:eventId/leave- Leave queueGET /api/v1/queue/:eventId/stats- Get queue statistics
POST /api/v1/checkout- Complete purchaseGET /api/v1/checkout/orders- List user ordersGET /api/v1/checkout/orders/:id- Get order detailsPOST /api/v1/checkout/orders/:id/cancel- Cancel order
The database is seeded with:
- 4 venues (Madison Square Garden, The O2 Arena, Staples Center, Red Rocks)
- 6 sample events across different categories
- Venue sections with VIP, Premium, Standard, and Economy pricing tiers
- Admin user:
admin@ticketmaster.local(for testing admin features)
| Variable | Default | Description |
|---|---|---|
PORT |
3001 |
Server port |
DB_HOST |
localhost |
PostgreSQL host |
DB_PORT |
5432 |
PostgreSQL port |
DB_USER |
ticketmaster |
PostgreSQL user |
DB_PASSWORD |
ticketmaster_secret |
PostgreSQL password |
DB_NAME |
ticketmaster |
PostgreSQL database |
REDIS_HOST |
localhost |
Redis host |
REDIS_PORT |
6379 |
Redis port |
CORS_ORIGIN |
http://localhost:5173 |
Allowed CORS origin |
| Variable | Default | Description |
|---|---|---|
VITE_API_URL |
/api |
API base URL (proxied in dev) |
- Browse Events: Visit http://localhost:5173 to see available events
- Register/Login: Create an account or sign in
- Select Event: Click on an "On Sale" event
- High-Demand Event: For events with "High Demand" badge, enter the waiting room
- Select Seats: Choose a section, then click on available seats
- Reserve: Click "Reserve Seats" to create a 10-minute hold
- Checkout: Complete the purchase before the timer expires
- View Tickets: Go to "My Orders" to see purchased tickets
# Backend
cd backend
npm run dev # Start with hot reload
npm run build # Build TypeScript
npm run lint # Run ESLint
npm run type-check # TypeScript type checking
# Frontend
cd frontend
npm run dev # Start Vite dev server
npm run build # Build for production
npm run lint # Run ESLint
npm run type-check # TypeScript type checkingSee architecture.md for detailed system design documentation.
See system-design-answer-fullstack.md for interview-style system design walkthrough.
- Redis for Seat Locks: Sub-millisecond distributed locking with automatic expiry
- PostgreSQL FOR UPDATE NOWAIT: Prevents database-level race conditions
- 10-Minute Hold Duration: Balances user checkout time with seat turnover
- Virtual Waiting Room: Protects backend from traffic spikes, ensures fairness
- Session-Based Auth: Simple cookie + Redis sessions (no JWT complexity for learning)
- Admin dashboard for event management
- Payment integration (Stripe)
- Email confirmation with tickets
- Mobile ticket with QR codes
- Secondary market (resale)
- Bot detection and CAPTCHA
- WebSocket for real-time seat updates
- Ticketmaster Tech Blog - Official Ticketmaster engineering blog
- How We Built Our Virtual Waiting Room - Queue systems for high-demand events
- Redis Distributed Locks (Redlock) - Distributed locking patterns
- Handling High Traffic Ticket Sales - Scalability lessons from Ticketmaster
- PostgreSQL FOR UPDATE NOWAIT - Optimistic locking in PostgreSQL
- Queue-Fair: Virtual Waiting Room - Virtual waiting room concepts
- Building Fair Queuing Systems - AWS queue-based traffic management
- Preventing Ticket Scalping with CAPTCHA - Bot detection and prevention strategies