Skip to content

Latest commit

Β 

History

History
101 lines (74 loc) Β· 2.44 KB

File metadata and controls

101 lines (74 loc) Β· 2.44 KB

πŸ›’ E-commerce Microservices with Golang, FastAPI, Flask, and Node.js

This project demonstrates a simple microservices architecture with Golang, FastAPI, Flask, and Node.js.
Each service handles different aspects of an e-commerce system and communicates via REST APIs.
The entire system runs with Docker Compose.


πŸ“Œ Microservices Overview

Service Technology Port Description
API Gateway Golang (Gin) 5000 Routes requests & aggregates data
User Service Golang (Gin) 5001 Handles user details
Order Service FastAPI 5002 Handles order details
Payment Service Flask 5003 Handles payment details
Product Service Node.js (Express) 5004 Handles product details

πŸš€ How to Run

1️⃣ Clone the Repository

git clone https://github.com/sajosam/ecommerce-microservices.git
cd ecommerce-microservices

2️⃣ Build & Start All Services

docker-compose up --build

πŸ“Œ API Endpoints

πŸ”Ή User Service (Golang)

  • GET /users/{id} β†’ Get user details

πŸ”Ή Order Service (FastAPI)

  • GET /orders/{user_id} β†’ Get user orders

πŸ”Ή Payment Service (Flask)

  • GET /payments/{user_id} β†’ Get user payments

πŸ”Ή Product Service (Node.js)

  • GET /products/{user_id} β†’ Get user products

πŸ”Ή API Gateway (Golang)

  • GET /all-details/{user_id} β†’ Fetch all details in a single response

πŸ”₯ Testing the APIs

Get User Details

curl http://localhost:5000/users/1

Get User Orders

curl http://localhost:5000/orders/1

Get User Payments

curl http://localhost:5000/payments/1

Get User Products

curl http://localhost:5000/products/1

Get All User Data in a Single JSON

curl http://localhost:5000/all-details/1

πŸ“¦ Docker Setup

Each microservice has a Dockerfile and is managed using Docker Compose.

To stop all services, run:

docker-compose down

πŸ“Œ Tech Stack Used

βœ… Golang (Gin) - API Gateway & User Service
βœ… FastAPI - Order Service
βœ… Flask - Payment Service
βœ… Node.js (Express) - Product Service
βœ… Docker & Docker Compose


πŸš€ Happy Coding! πŸ”₯