Skip to content

About

Event-driven microservices system using Django, Kafka, and MongoDB for real-time notification processing

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

🚀 Event-Driven Notification System (Django + Kafka + MongoDB)

A production-style event-driven microservices architecture built using Django, Kafka, and MongoDB. This system captures events from multiple services and processes them asynchronously to generate user notifications.


🧠 Architecture Overview

Auth Service        → Kafka
Payment Service     → Kafka
Email Service       → Kafka
                         ↓
                Notification Service (Consumer)
                         ↓
                      MongoDB
                         ↓
                Notification APIs

⚙️ Tech Stack

  • Backend: Django, Django REST Framework
  • Messaging: Apache Kafka
  • Database: MongoDB
  • Containerization: Docker & Docker Compose
  • API Testing: Postman

🔥 Features

  • Event-driven architecture using Kafka
  • Multiple producer microservices (Auth, Payment, Email)
  • Asynchronous event processing via Kafka consumer
  • Rule-based notification engine
  • MongoDB for scalable event + notification storage
  • REST APIs for fetching notifications
  • Dockerized setup (one command run)
  • Kafka UI for topic inspection

📦 Services

1. Notification Service

  • Consumes events from Kafka
  • Applies rule engine
  • Stores events & notifications in MongoDB

2. Auth Service

  • Emits USER_LOGIN events

3. Payment Service

  • Emits PAYMENT_SUCCESS / PAYMENT_FAILED
  • Triggers notifications

4. Email Service

  • Emits EMAIL_SENT events

🔁 Event Flow

  1. Producer services send events to Kafka
  2. Kafka stores and streams events
  3. Notification service consumes events
  4. Rule engine evaluates events
  5. Notifications stored in MongoDB
  6. APIs expose notifications

🚀 How to Run (One Command)

docker-compose up --build

🧪 API Endpoints

Auth Service

POST http://localhost:8001/api/login/

Payment Service

POST http://localhost:8002/api/pay/

Email Service

POST http://localhost:8003/api/send-email/

Notification Service

GET http://localhost:8000/api/notifications/
GET http://localhost:8000/api/notifications/?user_id=123

📊 Kafka UI

Access Kafka UI at:

http://localhost:8080

🗄️ MongoDB

Connect via:

mongodb://localhost:27018

⚡ Sample Event

{
  "event_type": "PAYMENT_FAILED",
  "user_id": "123",
  "status": "FAILURE"
}

🧠 Key Concepts Demonstrated

  • Event-driven architecture
  • Microservices communication via Kafka
  • Asynchronous processing
  • Decoupled system design
  • Scalable backend patterns

📌 Future Improvements

  • Retry mechanism & dead-letter queue
  • WebSocket-based real-time notifications
  • Authentication & authorization
  • Monitoring & logging (Prometheus, Grafana)

👨‍💻 Author

Shivam


⭐ If you like this project

Give it a star ⭐ and feel free to fork or contribute!

About

Event-driven microservices system using Django, Kafka, and MongoDB for real-time notification processing

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages