A full-stack event ticketing platform with dynamic pricing that adjusts ticket prices based on demand, time to event, and inventory levels.
Before running this project, make sure you have:
- Node.js (version 18 or higher)
- pnpm (version 9.0.0 or higher)
- Docker and Docker Compose (for running PostgreSQL)
- Git
Get the project up and running in just 4 simple commands:
# 1. Clone and install dependencies
git clone <your-repo-url>
cd ticketing-platform-monorepo
pnpm install
# 2. Set up environment variables
cp .env.example .env
# 3. Start PostgreSQL database
docker-compose up -d
# 4. Run database migrations and seed data
pnpm --filter @repo/database db:migrate
pnpm --filter @repo/database db:seedThat's it! You're ready to run the application.
Start both the frontend and backend servers:
pnpm devThe application will be available at:
- Frontend (Next.js): http://localhost:3000
- Backend API (Express): http://localhost:4000
To stop the servers, press Ctrl+C in the terminal.
Run all tests across the monorepo:
pnpm testRun tests with coverage:
# Backend API tests with coverage
pnpm --filter api test:coverage
# Frontend tests with coverage
pnpm --filter web test:coverageRun tests in watch mode during development:
pnpm --filter api test:watchThe project uses the following environment variables (defined in .env file):
POSTGRES_USER- PostgreSQL username (default:ticketing_user)POSTGRES_PASSWORD- PostgreSQL password (default:ticketing_password)POSTGRES_DB- Database name (default:ticketing_platform)POSTGRES_PORT- PostgreSQL port (default:5432)DATABASE_URL- Full database connection string
NODE_ENV- Environment mode (developmentorproduction)PORT- Backend API port (default:4000)
PRICING_WEIGHT_DEMAND- Weight for demand-based pricing (default:0.3)PRICING_WEIGHT_TIME- Weight for time-based pricing (default:0.2)PRICING_WEIGHT_INVENTORY- Weight for inventory-based pricing (default:0.5)
All required environment variables have sensible defaults in the .env.example file.
This is a monorepo managed by Turborepo with the following structure:
ticketing-platform-monorepo/
├── apps/
│ ├── api/ # Express backend API
│ └── web/ # Next.js frontend
├── packages/
│ ├── database/ # Drizzle ORM & database schema
│ ├── eslint-config/# Shared ESLint configs
│ ├── typescript-config/# Shared TypeScript configs
│ └── ui/ # Shared UI components
└── docker-compose.yml # PostgreSQL setup
GET /api/events- List all eventsGET /api/events/:id- Get event detailsPOST /api/events- Create a new event
POST /api/bookings- Create a bookingGET /api/bookings?userEmail=xxx- Get user's bookingsGET /api/bookings/:id- Get booking details
GET /api/analytics/events/:id- Get event analyticsGET /api/analytics/summary- Get system-wide analytics
POST /api/seed- Seed database with sample events
Start the database:
docker-compose up -dStop the database:
docker-compose downReset the database (removes all data):
docker-compose down -v
docker-compose up -d
pnpm --filter @repo/database db:migrate
pnpm --filter @repo/database db:seedView database logs:
docker-compose logs -f postgresConnect to PostgreSQL CLI:
docker exec -it ticketing-platform-db psql -U ticketing_user -d ticketing_platformPort already in use:
# Kill processes on specific ports
pnpm dev:cleanDatabase connection issues:
- Make sure Docker is running
- Check if PostgreSQL container is up:
docker-compose ps - Verify DATABASE_URL in .env matches your setup
Tests failing:
- Ensure database is running and seeded
- Run
pnpm installto ensure all dependencies are installed - Clear test caches:
pnpm --filter api test --clearCache
✅ Dynamic pricing based on demand, time, and inventory
✅ Concurrency control with database transactions
✅ Real-time price updates
✅ Booking management
✅ Event analytics
✅ Comprehensive test coverage
✅ Monorepo architecture with shared packages