WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

narasimha-1511/notification-microservies

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🛒 Personalized Notification System — Microservices-Based E-commerce Backend

Node.js Docker GraphQL MongoDB RabbitMQ Monitoring


🧠 Overview

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.


🔧 Architecture

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
Loading

🧩 Services

🧑‍💼 User Service

  • Register/Login with JWT
  • User preferences for notification types
  • Preference updates & authentication middleware

🔔 Notification Service

  • Store, mark, fetch notifications
  • Event listeners for orders, promos, recos
  • Respect user preferences

📦 Product Service

  • Product catalog management
  • Inventory updates via order events

🧾 Order Service

  • Order placement, updates, and tracking
  • Emits events for inventory + user notifications

⏰ Scheduler Service

  • Cron-based notification triggers
  • Periodic promotions & order status checks

🚪 GraphQL Gateway

  • Unified API layer
  • Authentication middleware
  • Aggregates data from all microservices
  • Redis-based caching

📬 Event-Driven Communication

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

🔐 Authentication

  • JWT Tokens (generated in User Service)
  • All protected GraphQL mutations require a valid token
  • Token is verified in the GraphQL Gateway

📊 Observability & Monitoring

  • Loki → stores logs from all services
  • Prometheus → scrapes /metrics from services
  • Grafana → visualizes both (use dashboards or build your own)

📸 Screenshots:

Grafana Overview Notification Dashboard


⚙️ Local Development Setup

📦 Prerequisites

🧪 Running Locally

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

📮 Postman Collection

You can test all APIs using the Postman collection below:

https://www.postman.com/aviation-geologist-50887892/workspace/narasimha-projects/collection/68603dd24acaedd6ec650f04?action=share&creator=42408643&active-environment=42408643-d918b243-596b-460f-9146-8fbb744bc02e


📁 Folder Structure

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

About

scalable ecommer-microservices with personalized notifications

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published