Skip to content

Microservices-based backend with async order processing via Redis, MySQL storage, and gRPC updates between Node.js and Go services.

Notifications You must be signed in to change notification settings

adityapatel1010/Distributed-Order-Processing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 (pendingprocessingcompleted) 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.

# 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:


Output Screenshots

Order Created

Order Created

Fetch Orders

Fetch All Orders

Output Logs

Output Logs


Sample Commands

Create an Order

curl -X POST http://localhost:3000/orders \
  -H "Content-Type: application/json" \
  -d '{
    "item": "Laptop",
    "quantity": 2,
    "price": 1299.99
  }'

Get All Orders

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.

About

Microservices-based backend with async order processing via Redis, MySQL storage, and gRPC updates between Node.js and Go services.

Topics

Resources

Stars

Watchers

Forks