EventFlow is a production-ready microservices-based event management and ticketing system built with NestJS, Kafka, Redis, and PostgreSQL.
The system is designed with distributed architecture principles including API Gateway, service-to-service communication, event-driven messaging, shared libraries, and centralized validation.
This project follows a Microservices Architecture pattern.
┌───────────────┐
│ API Gateway │
│ (Port 3000) │
└───────┬───────┘
│
┌───────────────┬───────────────┬───────────────┬───────────────┐
│ │ │ │ │
Auth Service Events Service Tickets Service Notifications Users Service
(3001) (3003) (3004) Service(3006) (3002)
- HTTP (via API Gateway)
- Kafka (Event-driven communication)
- Redis (Throttling & caching)
- Shared internal libraries
| Service | Port | Description |
|---|---|---|
| API Gateway | 3000 | Entry point, routing, throttling |
| Auth Service | 3001 | Authentication & JWT |
| Users Service | 3002 | User management |
| Events Service | 3003 | Event creation & management |
| Tickets Service | 3004 | Ticket purchasing & check-in |
| Notifications Service | 3006 | Email notifications |
- JWT Authentication
- User Registration & Login
- Secure route guards
- Centralized exception handling
- Create & update events
- Purchase tickets
- Ticket check-in
- Event management
- Email notifications on:
- Registration
- Ticket purchase
- Event updates
- Centralized routing
- Redis-based throttling
- Response transformation
- Global exception filters
- DTO validation
- Global response interface
- HTTP exception filters
- Interceptors
- Utility functions
- Centralized constants
apps/
│
├── api-gateway/
├── auth-service/
├── events-service/
├── tickets-service/
├── notifications-service/
│
libs/
│
├── common/ # Shared DTOs, filters, interceptors
├── database/ # Drizzle ORM schemas & DB service
├── kafka/ # Kafka integration module
| Layer | Technology |
|---|---|
| Framework | NestJS |
| Language | TypeScript |
| Database | PostgreSQL |
| ORM | Drizzle ORM |
| Messaging | Kafka |
| Cache | Redis |
| API Gateway | NestJS |
| Validation | class-validator |
| Linting | ESLint + Prettier |
| Testing | Jest |
Kafka is used for asynchronous communication between services:
- User Registered → Notify Service
- Ticket Purchased → Send Confirmation Email
- Event Updated → Broadcast Notification
- PostgreSQL
- Drizzle ORM
- Modular schema structure:
- Users
- Events
- Tickets
npm install
docker compose up -d
This will start:
- PostgreSQL
- Redis
- Kafka (if configured)
Start each service individually:
npm run start:dev api-gateway
npm run start:dev auth-service
npm run start:dev events-service
npm run start:dev tickets-service
npm run start:dev notifications-service
DATABASE_URL=postgresql://postgres:password@localhost:5432/eventhub
JWT_SECRET=supersecret
KAFKA_BROKER=localhost:9092
REDIS_URL=redis://localhost:6379
POST /auth/register
POST /auth/login
POST /events
GET /events
PATCH /events/:id
POST /tickets/purchase
POST /tickets/check-in
export const SERVICES = {
API_GATEWAY: 'api-gateway',
AUTH_SERVICE: 'auth-service',
USERS_SERVICE: 'users-service',
EVENTS_SERVICE: 'events-service',
TICKETS_SERVICE: 'tickets-service',
NOTIFICATIONS_SERVICE: 'notifications-service',
} as const;
export const SERVICES_PORTS = {
API_GATEWAY: 3000,
AUTH_SERVICE: 3001,
USERS_SERVICE: 3002,
EVENTS_SERVICE: 3003,
TICKETS_SERVICE: 3004,
NOTIFICATIONS_SERVICE: 3006,
} as const;
- Microservices Architecture
- Event-Driven Design
- Clean Modular Design
- Shared Libraries Pattern
- Centralized Error Handling
- Distributed Communication
- API Gateway Pattern
- Redis Rate Limiting
- Payments integration
- Distributed tracing
- Circuit breaker pattern
- Kubernetes deployment
- CI/CD pipeline
- Monitoring with Prometheus & Grafana