-
Notifications
You must be signed in to change notification settings - Fork 1
Home
This Wiki serves as a comprehensive guide to understand, set up, and contribute to the Distributed Microservices Platform. It provides detailed information about the architecture, folder structure, setup, and functionality of the platform.
- [Project Overview](#project-overview)
- [Architecture](#architecture)
- [Folder Structure](#folder-structure)
- [Setup Instructions](#setup-instructions)
- [Technology Stack](#technology-stack)
- [Features](#features)
- [Contributing](#contributing)
- [License](#license)
The Distributed Microservices Platform demonstrates a modular, scalable, and fault-tolerant architecture using microservices. It includes services for user management, inventory, payments, notifications, and more. These services communicate via gRPC and a message broker for asynchronous communication.
- Scalable microservices architecture.
- Resilient inter-service communication.
- Centralized observability with logs and tracing.
- Dockerized deployment for easy setup.
The system consists of the following key components:
- API Gateway: Acts as the single entry point for all client requests.
- User Service: Manages user-related functionalities like authentication and profile management.
- Inventory Service: Manages product catalog and stock levels.
- Payment Service: Handles financial transactions and payment gateway integrations.
- Notification Service: Delivers notifications via email, SMS, or push notifications.
- Message Broker (RabbitMQ/Kafka): Facilitates communication between services.
- Service Discovery: Enables dynamic service registration and discovery.
- gRPC: Used for synchronous communication between services.
- Message Broker: Used for asynchronous communication (e.g., RabbitMQ, Kafka).
distributed-microservices-platform/
├── api-gateway/
│ ├── src/
│ │ ├── routes/
│ │ ├── middlewares/
│ │ ├── controllers/
│ │ ├── services/
│ │ └── app.js
│ ├── package.json
│ └── README.md
├── user-service/
│ ├── src/
│ │ ├── controllers/
│ │ ├── models/
│ │ ├── routes/
│ │ ├── services/
│ │ └── app.js
│ ├── package.json
│ └── README.md
├── inventory-service/
│ ├── src/
│ │ ├── controllers/
│ │ ├── models/
│ │ ├── routes/
│ │ ├── services/
│ │ └── app.js
│ ├── package.json
│ └── README.md
├── payment-service/
│ ├── src/
│ │ ├── controllers/
│ │ ├── models/
│ │ ├── routes/
│ │ ├── services/
│ │ └── app.js
│ ├── package.json
│ └── README.md
├── notification-service/
│ ├── src/
│ │ ├── controllers/
│ │ ├── models/
│ │ ├── routes/
│ │ ├── services/
│ │ └── app.js
│ ├── package.json
│ └── README.md
├── shared/
│ ├── configs/
│ ├── middlewares/
│ ├── utils/
│ └── README.md
├── docker-compose.yml
├── .env
└── README.md
- Node.js (16.x or higher)
- Docker and Docker Compose
- RabbitMQ or Kafka
- MongoDB/PostgreSQL
- gRPC Tools
-
Clone the Repository
git clone https://github.com/opensource-nodejs/distributed-microservices-platform.git cd distributed-microservices-platform
-
Install Dependencies Navigate to each service folder and install dependencies:
cd user-service npm install cd ../inventory-service npm install # Repeat for all services
-
Configure Environment Variables Create a
.env
file in the root directory:NODE_ENV=development SERVICE_PORT=5000 DB_CONNECTION_STRING=mongodb://localhost:27017/service-name MESSAGE_BROKER_URL=amqp://localhost
-
Run the Application Use Docker Compose to start all services:
docker-compose up
-
Access the API Gateway API Gateway will be accessible at
http://localhost:3000
.
- Node.js: Core runtime for services.
- gRPC: Inter-service communication.
- RabbitMQ/Kafka: Message brokering.
- MongoDB/PostgreSQL: Database for individual services.
- Docker: Containerization.
- Docker Compose: Multi-container orchestration.
- Service discovery for dynamic registration.
- Fault-tolerant communication using circuit breakers and retries.
- Centralized logging and tracing for observability.
- Modular design for easy extensibility.
- Asynchronous and synchronous communication models.
We welcome contributions to improve this project! Follow these steps to contribute:
- Fork the repository.
- Create a feature branch.
- Submit a pull request with a clear description.
This project is licensed under the [GNU General Public License v3.0](https://www.gnu.org/licenses/gpl-3.0.html).
This project is maintained by [Aditya Pratap Bhuyan](https://linkedin.com/in/adityabhuyan).