A Production-Ready Microservices-Based Personalized Notification System for an E-commerce Platform, built with:
- 🔁 Event-driven architecture (RabbitMQ)
- ⚡ Unified GraphQL Gateway
- 🔐 JWT-based Auth & Role Management
- 📦 Independent MongoDB-backed microservices
- 📊 Monitoring with Prometheus, Grafana, and Loki
- 🐳 Fully Dockerized — run locally in seconds
🚀 Designed for high scalability, real-time communication, and developer productivity.
graph TD
Client["🧑💻 Client (Postman / GraphQL Playground)"]
Gateway["🚪 GraphQL Gateway"]
Users["👤 User Service"]
Notifications["🔔 Notification Service"]
Products["📦 Product Service"]
Orders["🧾 Order Service"]
Scheduler["⏰ Scheduler Service"]
RabbitMQ["📨 RabbitMQ (Broker)"]
Redis["⚡ Redis (Cache)"]
Loki["📄 Loki (Logs)"]
Prometheus["📈 Prometheus"]
Grafana["📊 Grafana Dashboard"]
Client --> Gateway
Gateway --> Users
Gateway --> Notifications
Gateway --> Products
Gateway --> Orders
Users -->|MongoDB| DB1[(Users DB)]
Notifications -->|MongoDB| DB2[(Notifications DB)]
Products -->|MongoDB| DB3[(Products DB)]
Orders -->|MongoDB| DB4[(Orders DB)]
Orders -- OrderEvents --> RabbitMQ
Products -- InventoryUpdate --> RabbitMQ
Notifications -- ListenEvents --> RabbitMQ
Scheduler -- Promotions & Triggers --> RabbitMQ
Gateway --> Redis
Loki --> Grafana
Prometheus --> Grafana
- Register/Login with JWT
- User preferences for notification types
- Preference updates & authentication middleware
- Store, mark, fetch notifications
- Event listeners for orders, promos, recos
- Respect user preferences
- Product catalog management
- Inventory updates via order events
- Order placement, updates, and tracking
- Emits events for inventory + user notifications
- Cron-based notification triggers
- Periodic promotions & order status checks
- Unified API layer
- Authentication middleware
- Aggregates data from all microservices
- Redis-based caching
All services communicate via RabbitMQ. Each service emits and consumes events based on its responsibilities:
| Event | Emitter | Consumers |
|---|---|---|
order.placed |
Orders | Products, Notifications |
product.out_of_stock |
Products | Notifications |
promo.campaign |
Scheduler | Notifications |
recommendation.generated |
Scheduler | Notifications |
- JWT Tokens (generated in User Service)
- All protected GraphQL mutations require a valid token
- Token is verified in the GraphQL Gateway
- Loki → stores logs from all services
- Prometheus → scrapes
/metricsfrom services - Grafana → visualizes both (use dashboards or build your own)
git clone https://github.com/narasimha-1511/ecommerce-microservices.git
cd ecommerce-microservices
# Start the entire ecosystem (DBs, Gateway, Microservices, Monitoring tools)
docker compose up --build- Gateway accessible at:
http://localhost:8000/graphql - Grafana:
http://localhost:3000(default user/pass:admin/admin) - Prometheus:
http://localhost:9090 - Loki:
http://localhost:3100 - RabbitMQ Dashboard:
http://localhost:15672(default user/pass:guest/guest)
You can test all APIs using the Postman collection below:
ecommerce-microservices/
│
├── gateway/ → GraphQL API Gateway
├── services/
│ ├── users/ → User Service
│ ├── notifications/ → Notification Service
│ ├── products/ → Product Service
│ ├── orders/ → Order Service
│ └── scheduler/ → Scheduler Service
│
├── monitoring/ → Prometheus config
├── docker-compose.yml → All-in-one orchestration
└── README.md
