https://github.com/adityapatel1010/distributed-order-processing
Microservices-based backend with async order processing via Redis, MySQL storage, and gRPC updates between Node.js and Go services.
https://github.com/adityapatel1010/distributed-order-processing
async distributed-systems docker golang grpc message-queue microservices mysql nodejs redis restful-api
Last synced: 9 months ago
JSON representation
Microservices-based backend with async order processing via Redis, MySQL storage, and gRPC updates between Node.js and Go services.
- Host: GitHub
- URL: https://github.com/adityapatel1010/distributed-order-processing
- Owner: adityapatel1010
- Created: 2025-06-26T10:14:44.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-06-26T19:32:23.000Z (10 months ago)
- Last Synced: 2025-06-26T20:29:08.932Z (10 months ago)
- Topics: async, distributed-systems, docker, golang, grpc, message-queue, microservices, mysql, nodejs, redis, restful-api
- Language: JavaScript
- Homepage:
- Size: 9.4 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Distributed Order Processing System
## Overview
This project simulates an **e-commerce-style distributed system** that decouples order creation, processing, and status management. Using Redis as a queue, orders are processed asynchronously by a Go service, with inter-service communication via gRPC to ensure scalable, event-driven architecture.
---
## Impact
* Mimics **real-world backend systems** used in online marketplaces and retail platforms.
* Demonstrates **asynchronous communication and processing** using a message queue (Redis).
* Provides hands-on understanding of **gRPC**, microservices, and inter-language service orchestration (Node.js ↔ Go).
* Highlights efficient **status transition workflows** (`pending` → `processing` → `completed`) in distributed environments.
---
## Functionalities
* **Create Orders** via REST API (`POST /orders`)
* **Push to Redis Queue** with essential data (`orderId`, `quantity`)
* **Process Orders** asynchronously using Go service
* **Update Status via gRPC** to `processing` and later `completed`
* **View All Orders** using REST (`GET /orders`)
* **MySQL Persistence** for order lifecycle tracking
---
## Technologies Used
| Category | Technology |
| ---------------- | ---------------------- |
| API Layer | Node.js, Express |
| Database | MySQL |
| Message Queue | Redis |
| Worker Service | Go |
| Communication | gRPC, RESTful|
| Containerization | Docker |
---
## Highlights
* Asynchronous queue-based processing with Redis
* Microservice architecture: loose coupling and high cohesion
* Language-agnostic gRPC interface between Go and Node.js
* Sequelize `sync()` ensures schema alignment without migrations
* Retries and health checks ensure robust startup via Docker Compose
* Modular codebase with separation of concerns (controllers, models, services)
---
## Commands to Run the Project
> Make sure Docker and Docker Compose are installed.
```bash
# Step 1: Clone the repo
git clone https://github.com/your-username/distributed-order-system.git
cd distributed-order-system
# Step 2: Start all services
docker-compose up --build
```
You should see:
* REST API on [http://localhost:3000](http://localhost:3000)
* gRPC running on port `50051`
---
## Output Screenshots
### Order Created

### Fetch Orders

### Output Logs

---
## Sample Commands
### Create an Order
```bash
curl -X POST http://localhost:3000/orders \
-H "Content-Type: application/json" \
-d '{
"item": "Laptop",
"quantity": 2,
"price": 1299.99
}'
```
### Get All Orders
```bash
curl http://localhost:3000/orders
```
---
## Notes
* The Redis queue only stores `orderId` and `quantity` for efficiency.
* Statuses (`pending`, `processing`, `completed`) are updated in MySQL through Sequelize.
* gRPC services are defined in `.proto` files and loaded using `@grpc/proto-loader`.
* Retry mechanisms ensure the Node service waits for MySQL and Redis before starting.
* The system is extensible to include features like email notifications, billing, etc.