How jumpei527/ticketing_app works
Project type and purpose
• This is a learning-oriented ticketing e-commerce system built as a microservices application.
• It comprises six independent Node.js/TypeScript services (Auth, Tickets, Orders, Payments, Expiration, Client) plus a shared “common” library, all deployed in Kubernetes and communicating via an event bus (NATS Streaming).
File structure
• Top-level folders correspond to each service (auth, tickets, orders, payments, expiration, client), an infra directory with Kubernetes manifests, and a common shared codebase.
• Each service has its own Dockerfile, package.json, src folder (Express app, routes, models, event publishers/listeners, NATS wrapper).
• The client folder contains a Next.js/React app (pages, components, hooks).
• infra/k8s holds Deployments, Services and an Ingress for traffic routing.
• Skaffold.yaml suggests a full CI/CD deployment pipeline.
Extract additional insights from README
• Six microservices deployed behind a Kubernetes Ingress Controller.
• Externally, users interact only with the Client (React) via HTTP.
• Inter-service communication is asynchronous via Pub-Sub on NATS Streaming.
• Each domain service persists its own data in a dedicated MongoDB (and Expiration uses Redis for job queueing).
• Payments uses Stripe SDK.
Main components and their interactions
a. Client (Next.js/React)
– Renders UI and issues HTTP calls to Auth, Tickets, Orders, Payments.
b. Kubernetes Ingress Controller
– Exposes routes (auth, tickets, orders, payments) and performs load-balancing.
c. Auth Service
– Handles signup, signin, JWT, current-user middleware, stores users in MongoDB.
d. Tickets Service
– CRUD on tickets, emits ticket:created and ticket:updated events, stores tickets in its MongoDB.
e. Orders Service
– CRUD on orders, listens for ticket events, emits order:created and order:cancelled, stores orders in its MongoDB.
f. Payments Service
– Receives order IDs, calls Stripe, emits payment:created, stores payments in its MongoDB.
g. Expiration Service
– Listens for order:created, schedules expiration jobs in Redis-backed queue, emits expiration:complete.
h. NATS Streaming Server (Event Bus)
– All services publish to and subscribe from named subjects (ticket:created, order:created, etc.).
i. Datastores
– Six MongoDB instances (one per stateful service), one Redis instance for job queueing.
Architectural patterns and design principles
• Microservices with single-responsibility, bounded contexts.
• Event-driven, asynchronous Pub-Sub via NATS.
• Each service has its own database (database per service).
• Shared “common” library for DTOs, error handling, middlewares, event base classes.
• HTTP API façade (Express) for synchronous requests; asynchronous workflows via events.
• Infrastructure as code via Kubernetes YAMLs and Skaffold.