All services running
E-Commerce System
📐 Architecture — Real-Time Flow
DOCKER HOST — docker-compose network CLIENT Browser / Mobile App HTTP requests 🔀 API GATEWAY Route / Auth / Rate-Limit :8000 /users/* /products/* /orders/* 👤 USER SERVICE Register / Login / Profile :8001 📦 PRODUCT SERVICE Catalog / Inventory :8002 🛒 ORDER SERVICE Cart / Checkout :8003 🗄 users.db (SQLite) isolated DB 🗄 products.db (SQLite) isolated DB 🗄 orders.db (SQLite) isolated DB ⚡ EVENT BUS (Message Queue) order.created / stock.updated / notif.send async pub/sub events validate user
HTTP Request
Async Event
DB Query
User Service
Product Service
Order Service
1
Client sends POST /users/register with name, email, password to the API Gateway on port :8000
2
Gateway checks auth headers, rate limits, then routes to User Service :8001
3
User Service validates data, hashes password, writes to isolated users.db — no other service touches this DB
4
User Service returns 201 Created + JWT token back through Gateway to client
1
Client sends POST /orders/create with user_id + product_id + quantity
2
Order Service calls User Service GET /users/{id} synchronously to validate the user exists
3
Order Service calls Product Service GET /products/{id} to verify stock & get price
4
Order is saved to orders.db, then an order.created event is fired to the Event Bus
5
Product Service consumes order.created → decrements stock asynchronously. Client gets response immediately
🐳
Container isolation: Each service runs in its own container with its own filesystem, network namespace, and process space
🌐
docker-compose network: All containers share a virtual network and discover each other by service name, not IP
📋
docker-compose.yml: Declares all services, ports, env vars, volumes, and dependencies in one file
📦
Images: Each service has a Dockerfile defining its build — layers are cached for fast rebuilds
🧪 Live API Tester
🔀 GATEWAY
:8000
● running
👤 USERS
:8001
● running
📦 PRODUCTS
:8002
● running
🛒 ORDERS
:8003
● running

👤 User Service GETPOST

GET /users  — list all users
POST /users/register  — create user

📦 Product Service GETPOST

GET /products  — list all products
POST /products  — add product

🛒 Order Service GETPOST

GET /orders  — list all orders
POST /orders  — place order
API Response Terminal
# Docker Microservices — E-Commerce Demo # Click any TEST button above to fire a real API request # Make sure all 4 Python services are running first (see guide)   → Architecture: Client → API Gateway → [Users|Products|Orders] → Each service has its own SQLite database (isolated) → Orders service calls Users + Products for cross-service validation   ready