Welcome to the E-commerce Order Management System built using microservices! This system handles the core components of an e-commerce platform, such as order creation, payment processing, inventory management, and notification dispatch. The magic happens through RabbitMQ, which enables smooth asynchronous communication between the different services.
-
Order Service
- What it does: This service takes care of user registration, login, and order creation. Once an order is created, it sends messages to both the Payment Service and Inventory Service for further processing.
- How it communicates: Publish order details to
order.exchangewith routing keyorder.created(for payment processing) andorder.processed(for inventory update). - Language: Python
- Packages: FastAPI (Framework), SQLAlchemy (ORM System), Alembic (Data Migration), Pika (RabbitMQ Python Client)
API Endpoints: (for more info, please refer to the Postman collection file)
- POST /register: Register a new user
Form Data Content-Type: application/x-www-form-urlencoded: username=john@doe.com password=test123 - POST /login: Log in as a user
Form Data Content-Type: application/x-www-form-urlencoded: username=john@doe.com password=test123 - POST /order: Create a new order
Request: { "user_id": 1, "items": [ { "name": "Item 1", "quantity": 2 }, { "name": "Item 2", "quantity": 1 } ] }
-
Payment Service
- What it does: This service handles payment processing for orders. Once a payment is successful, it sends updates to both the Order Service and Notification Service.
- How it communicates: Publish payment details to
payment.exchangewith routing keypayment.processedto send order details to inventory service and send notifications. - Language: Go
- Packages: Gorilla Mux (HTTP Router), Gorm (ORM System & Database Migration), amqp091 (RabbitMQ Go Client)
API Endpoints: (for more info, please refer to the Postman collection file)
- GET /payment?user_id={user_id}: Get payment for a user
- POST /payment/{order_id}: Process a payment for a specific order
-
Inventory Service
- What it does: This service manages the inventory stock for orders. After processing an order, it updates stock levels and sends notifications.
- How it communicates: Publish inventory details to
inventory.exchangewith routing keyinventory.updated, to dispatch notifications about the inventory changes. - Language: Go
- Packages: Gorilla Mux (HTTP Router), Gorm (ORM System & Database Migration), amqp091 (RabbitMQ Go Client)
API Endpoints: (for more info, please refer to the Postman collection file)
- GET /inventory?item_id={item_id}: Retrieve inventory stock for a specific item
-
Notification Service
- What it does: This service is responsible for sending notifications to users about their order status (e.g., payment processed, order packed).
- Language: Python
- Packages: FastAPI (Framework), SQLAlchemy (ORM System), Alembic (Data Migration), Pika (RabbitMQ Python Client)
API Endpoints: (for more info, please refer to the Postman collection file)
- GET /notification/{user_id}: Get notifications for a specific user
This system operates asynchronously, meaning each service works independently and communicates with others through RabbitMQ queues. Here's a brief flow of how things happen:
- User places an order: Order Service takes the user's details and creates an order.
- Payment Processing: Order Service sends the order details to the Payment Service for processing. If successful, the payment is confirmed.
- Inventory Update: After payment is confirmed, the Inventory Service updates the stock.
- Notifications: After the payment and inventory update, the Notification Service sends out notifications to the user about the order status.
Below is the activity diagram that illustrates this flow:

-
Clone the repository.
-
Run Docker and use the provided Docker Compose file to set up the services.
To build and start the services, run:
docker-compose up --buildTo stop the services and remove volumes, run:
docker-compose down --volumes
Airel Camilo Khairan © 2025