{"id":25931105,"url":"https://github.com/einzsweiz/realtimenotifications","last_synced_at":"2026-05-09T10:02:18.203Z","repository":{"id":279997950,"uuid":"940610144","full_name":"EinzSweiz/RealTimeNotifications","owner":"EinzSweiz","description":"Event-driven microservice for real-time notifications using WebSockets, Kafka, Celery, and Redis.","archived":false,"fork":false,"pushed_at":"2025-02-28T16:37:38.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-28T21:17:42.210Z","etag":null,"topics":["celery","event-driven-architecture","fastapi","kafka","microservices","mongodb","rabbitmq","real-time","redis-cluster","redis-pubsub","websocket"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EinzSweiz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-28T13:35:12.000Z","updated_at":"2025-02-28T16:37:41.000Z","dependencies_parsed_at":"2025-02-28T21:17:49.424Z","dependency_job_id":"9bbcfd06-9b11-477c-8d7e-f04b616b797b","html_url":"https://github.com/EinzSweiz/RealTimeNotifications","commit_stats":null,"previous_names":["einzsweiz/realtimenotifications"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EinzSweiz%2FRealTimeNotifications","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EinzSweiz%2FRealTimeNotifications/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EinzSweiz%2FRealTimeNotifications/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EinzSweiz%2FRealTimeNotifications/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EinzSweiz","download_url":"https://codeload.github.com/EinzSweiz/RealTimeNotifications/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241758968,"owners_count":20015247,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["celery","event-driven-architecture","fastapi","kafka","microservices","mongodb","rabbitmq","real-time","redis-cluster","redis-pubsub","websocket"],"created_at":"2025-03-03T23:57:33.360Z","updated_at":"2026-05-09T10:02:13.171Z","avatar_url":"https://github.com/EinzSweiz.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"📡 Event-Driven Notification Microservice\n\n🚀 Overview\n\nThis microservice provides real-time notifications using WebSockets, Kafka, Redis, Celery, and RabbitMQ.\nIt allows users to receive instant updates via WebSockets while ensuring event-driven processing for creating, fetching, and reading notifications.\n\n🌟 Key Features\n\nWebSocket-based real-time notifications 📡\n\nEvent-driven architecture using Kafka 🎯\n\nAsynchronous task execution with Celery \u0026 RabbitMQ ⚡\n\nRedis Pub/Sub for WebSocket updates 🚀\n\nMongoDB for notification storage 📂\n\nEmail notifications using Celery 📧\n\nFully Dockerized with docker-compose 🐳\n\n🎯 System Architecture\nsequenceDiagram\n    participant Frontend as WebSocket Client\n    participant FastAPI as WebSocket Server\n    participant KafkaProducer as Kafka Producer\n    participant Kafka as Kafka Broker\n    participant KafkaConsumer as Kafka Consumer\n    participant Redis as Redis Pub/Sub\n    participant MongoDB as MongoDB\n    participant Celery as Celery Worker\n    participant Email as Email Service\n    participant Prometheus as Metrics Collector\n    participant Grafana as Monitoring Dashboard\n\n    Frontend -\u003e\u003e FastAPI: Send Notification Event\n    FastAPI -\u003e\u003e KafkaProducer: Forward Event to Kafka\n    KafkaProducer -\u003e\u003e Kafka: Publish Event\n\n    Kafka -\u003e\u003e KafkaConsumer: Consumer Reads Event\n    KafkaConsumer -\u003e\u003e MongoDB: Store Notification\n    KafkaConsumer -\u003e\u003e Redis: Publish WebSocket Update\n    KafkaConsumer -\u003e\u003e Celery: Trigger Email Notification\n\n    Celery -\u003e\u003e Email: Send Email\n\n    Redis -\u003e\u003e FastAPI: Push WebSocket Update\n    FastAPI -\u003e\u003e Frontend: Send Notification to Client\n\n    KafkaConsumer -\u003e\u003e Prometheus: Expose Kafka Metrics\n    Redis -\u003e\u003e Prometheus: Expose Redis Metrics\n    Prometheus -\u003e\u003e Grafana: Provide Monitoring Data\n\n\n🚀 How to Run the Project Locally\n\n1️⃣ Clone the repository\n\ngit clone https://github.com/EinzSweiz/RealTimeNotifications.git\ncd event-driven-notifications\ndocker-compose up --build  # or use Makefile automation\n\n📡 WebSocket API Usage\n\n🔌 Connecting to WebSocket\n\nws://localhost:8002/ws/{user_id}\n\n📩 Sending Events\n\n1️⃣ Create Notification\n{\n  \"type\": \"notification\",\n  \"event\": \"create\",\n  \"message\": \"Your application was rejected\",\n  \"notification_type\": \"proposal_rejected\",\n  \"user_email\": \"user@example.com\"\n}\n\n2️⃣ Fetch Notifications\n\n{\n  \"type\": \"notification\",\n  \"event\": \"fetch\"\n}\n\n\n3️⃣ Mark Notification as Read\n\n{\n  \"type\": \"notification\",\n  \"event\": \"read\",\n  \"notification_id\": \"some-uuid\"\n}\n\n📊 Monitoring with Prometheus \u0026 Grafana\n🔹 How We Collect Metrics\n\nWe implemented custom exporters for:\n\n    Kafka Exporter → Collects Kafka consumer lag, partition offsets, and message rates.\n    Redis Exporter → Tracks Pub/Sub events, cache hits/misses, and WebSocket updates.\n    WebSocket Metrics → Monitors active connections and message flow.\n    Celery Exporter → Measures task execution time and queue performance.\n2️⃣ Access Prometheus Metrics\n\n    Prometheus UI → http://localhost:9090\n    \n    To query specific metrics, use:\n    up\n    kafka_messages_total\n    redis_pubsub_messages\n    celery_task_duration_seconds\n    websocket_active_connections\n3️⃣ Access Grafana Dashboard\n\n    Grafana UI → http://localhost:3000\n    Default login:\n        Username: admin\n        Password: admin\n    Add Prometheus as a data source in Grafana.\n    \n🛠 Running Tests\n\npytest tests/ or make test(Makefile automatization)\nThis will run unit tests for WebSocket, Kafka consumers, and DDD entities.\n\n📊 Future Improvements\n\n    Prometheus + Grafana for monitoring 📊 (DONE ✅)\n    Add authentication \u0026 user management 🔒\n    Deploy to AWS using EC2 ☁️\n    \n4️⃣ Available Metrics\n\n    Kafka Events Processed: kafka_messages_total\n    Redis WebSocket Updates: redis_pubsub_messages\n    Celery Task Execution Time: celery_task_duration_seconds\n    WebSocket Active Connections: websocket_active_connections\n\n💡 Contributing\n\nIf you’d like to improve this project, feel free to fork \u0026 submit a PR!\n\n🏆 Author\n\n👨‍💻 [Riad Sultanov] – Email: riad.sultanov.1999@gmail.com\n\n🚀 Feel free to star ⭐ this repository if you find it useful!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feinzsweiz%2Frealtimenotifications","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feinzsweiz%2Frealtimenotifications","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feinzsweiz%2Frealtimenotifications/lists"}