EventFlow is a modern, high-performance, and scalable Event Management & Ticketing platform designed with a Microservices Architecture. Built using NestJS and TypeScript, it handles user authentication, event creation, secure ticket purchasing, real-time check-ins, and event-driven email notifications using Apache Kafka as the event broker and PostgreSQL powered by Drizzle ORM.
To support massive scalability and clear separations of concerns, EventFlow relies on a robust set of modern technologies:
EventFlow is split into functional microservices that communicate using REST APIs for synchronous requests and Apache Kafka for asynchronous event flows:
- Single Entry Point: Directs client traffic to appropriate backend services.
- Authentication Guard: Intercepts incoming requests and validates JWT signatures.
- Global Interceptors & Filters: Formats outbound API responses and serializes exceptions uniformly.
- Credential Safety: Utilizes
bcryptfor secure hashing and storage of passwords. - Token Issuance: Generates secure JSON Web Tokens (JWT) for session management.
- Event Dispatch: Dispatches a
user.registeredevent to Kafka upon successful sign-up.
- Lifecycle Management: Supports creating, updating, publishing, and cancelling events.
- Role Enforcement: Restricts modifying and publishing actions to authenticated organizers.
- Dynamic Search: Fetches open events publically or retrieves event history filtering by organizer.
- Purchase Pipeline: Facilitates buying tickets for active events with validation limits.
- Check-In Validation: Empowers event organizers to check in attendees using unique ticket codes.
- Cancellation & Refund: Handles ticket cancellation, updating ticket status, and emitting events.
- Event-Driven: Listens to Kafka topics asynchronously without blocking transactional logic.
- Email Delivery: Utilizes
nodemailerto dispatch transactional emails:- Welcome Email: Sent when
user.registeredis received. - Ticket Confirmation: Sent with ticket codes and receipt info when
ticket.purchasedis received. - Cancellation Notice: Sent when
ticket.cancelledis received.
- Welcome Email: Sent when
@app/common: System-wide DTO validations (class-validator), filters, constants, and utilities.@app/database: Core connection pooling and table schemas (Users, Events, Tickets) using Drizzle.@app/kafka: Wrapper module providing simplified Kafka client connections and topic constants.
EventFlow utilizes a NestJS monorepo layout powered by pnpm workspaces:
eventflow-app/
βββ apps/ # Microservices Applications
β βββ api-gateway/ # Central entrypoint routing API traffic
β βββ auth-service/ # Register, login, and user profile management
β βββ events-service/ # Managing events creation, update & publishing
β βββ tickets-service/ # Buying tickets, cancellations & check-ins
β βββ notifications-service/ # Listens to Kafka events and fires emails
β
βββ libs/ # Shared Internal Libraries
β βββ common/ # Shared DTOs, Exception Filters, & Constants
β βββ database/ # Drizzle ORM DB Client and PostgreSQL Schema
β βββ kafka/ # Client configs, service wrappers & Kafka topics
β
βββ drizzle/ # Auto-generated SQL migration files
βββ drizzle.config.ts # Drizzle migrations configuration file
βββ docker-compose.yaml # PostgreSQL, Kafka, Zookeeper, and Mailhog config
βββ package.json # Dependencies, workspaces, and scripts
βββ pnpm-workspace.yaml # Monorepo workspaces definitionFollow these instructions to run the EventFlow ecosystem locally:
- Node.js (v18 or higher recommended)
- pnpm package manager (
npm install -g pnpm) - Docker & Docker Compose
# Clone the repository
git clone <repository-url>
cd eventflow-app
# Install project workspaces dependencies
pnpm installCreate a .env file in the root directory:
DATABASE_URL="postgresql://eventflowapp:eventflow_password@localhost:5432/eventflowapp?schema=public"
JWT_SECRET="your-super-secure-jwt-secret-key"Spin up PostgreSQL, Apache Kafka, Zookeeper, and Mailhog via Docker:
docker-compose up -dCreate and execute database schemas via Drizzle ORM:
# Generate migrations based on schemas
pnpm db:generate
# Apply migrations to PostgreSQL
pnpm db:migrateTo run the full monorepo in development mode, open multiple terminal tabs and run the desired services:
# Start API Gateway (Defaults to Port 3000)
pnpm start:dev api-gateway
# Start Auth Service (Port 3001)
pnpm start:dev auth-service
# Start Events Service (Port 3003)
pnpm start:dev events-service
# Start Tickets Service (Port 3004)
pnpm start:dev tickets-service
# Start Notifications Service (Port 3006)
pnpm start:dev notifications-serviceClients send requests to the API Gateway (http://localhost:3000), which proxy routes downstream:
| Client Endpoint | Downstream Route | HTTP Method | Auth Required | Description |
|---|---|---|---|---|
/auth/register |
auth-service/register |
POST |
β | Create a new user profile |
/auth/login |
auth-service/login |
POST |
β | Log in to obtain a JWT token |
/auth/profile |
auth-service/profile |
GET |
π JWT | Retrieve current user profile |
/events |
events-service/ |
POST / GET |
π (POST only) | Create / list events |
/events/my-events |
events-service/my-events |
GET |
π JWT | View events created by organizer |
/events/:id |
events-service/:id |
GET / PUT |
π (PUT only) | Retrieve / edit event details |
/events/:id/publish |
events-service/:id/publish |
POST |
π Organizer | Publish event to public listing |
/events/:id/cancel |
events-service/:id/cancel |
POST |
π Organizer | Cancel event |
/tickets/purchase |
tickets-service/purchase |
POST |
π JWT | Buy tickets for an active event |
/tickets/my-tickets |
tickets-service/my-tickets |
GET |
π JWT | View tickets owned by current user |
/tickets/check-in |
tickets-service/check-in |
POST |
π Organizer | Validate/Check-in ticket at the door |
While running Docker infrastructure, you can access diagnostic dashboards to monitor operations:
- Kafka Management UI: Access http://localhost:8989 to view active clusters, topics, consumer groups, and stream events.
- Mailhog Dashboard: Access http://localhost:8025 to view outbound transaction emails captured by the SMTP agent.
Contact: Nguyα» n ΔΓ¬nh Huy HoΓ ng - [ndhhoang.02052002@gmail.com]