This repository contains a full-stack ticketing application built from the ground up to demonstrate a microservices architecture. The system is designed to be scalable, resilient, and maintainable, serving as a practical example for learning advanced backend concepts.
This project is composed of several loosely coupled services that communicate with each other. This approach offers several key benefits over a traditional monolithic architecture:
- Scalability: Each service can be scaled independently based on its specific resource needs, leading to more efficient resource utilization.
- Simplified Developer Experience: New developers can focus on a single service and its functionality without needing to understand the entire system, boosting productivity.
- Flexibility & Independence: Each microservice can potentially use a different technology stack, allowing developers to choose the best tool for the job.
- Auth Service: Manages user sign-up, sign-in, and authentication.
- Tickets Service: Handles creation, updates, and retrieval of tickets.
- Orders Service: Manages the process of ordering tickets.
- Expiration Service: A background worker to handle ticket reservation expirations.
- Payments Service: Processes payments for orders.
- ... and more, all communicating via an event bus.
- Backend: Node.js, Express.js
- Frontend: Next.js, React
- Language: TypeScript
- Database: MongoDB
- Containerization: Docker
- Orchestration: Kubernetes
- Development Workflow: Skaffold
- API Gateway: Ingress-NGINX
Follow these steps to get the entire application running locally on your machine.
- Docker Desktop with Kubernetes enabled.
- Skaffold installed on your machine.
- Node.js and npm.
For Ingress-NGINX to route traffic correctly on your local machine, you need to map a custom domain to your localhost IP.
- Open your hosts file:
- macOS/Linux:
/etc/hosts - Windows:
C:\Windows\System32\drivers\etc\hosts
- macOS/Linux:
- Add the following line to the end of the file:
(You can use any domain you like, but this README will use
127.0.0.1 ticketing.devticketing.dev)
The Ingress controller acts as the entry point to your Kubernetes cluster, routing external requests to the correct services.
- Apply the official NGINX Ingress manifest to your cluster. This command sets up all the necessary resources.
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/cloud/deploy.yaml
- Wait a minute or two for the controller to be fully up and running. You can check its status with
kubectl get pods -n ingress-nginx.
Now you are ready to launch the entire microservices stack.
-
Clone the repository:
git clone https://github.com/openmymai/nodemicroservice.git cd nodemicroservice -
Start the development environment:
skaffold dev
Skaffold will now build all the Docker images, deploy them to your Kubernetes cluster, and watch for file changes to enable hot-reloading. This process may take several minutes on the first run.
Once Skaffold reports that all services are running and stable, you can access the application in your browser:
- Main Application: http://ticketing.dev
You can also test individual API endpoints, for example:
- Sign-up endpoint: http://ticketing.dev/api/users/signup
Contributions, issues, and feature requests are welcome! Please feel free to check the issues page.
This project is available for educational purposes. Please refer to the license details within the repository.