Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Notification Service

A production-grade, event-driven notification platform built with Golang, Apache Kafka, and PostgreSQL.

The Notification Service is responsible for consuming business events from Kafka and delivering notifications across multiple channels such as Email, SMS, Push Notifications, Slack, Microsoft Teams, WhatsApp, and Webhooks.

Rather than being tightly coupled with business services, this platform follows an Event-Driven Architecture (EDA) where services publish domain events and the Notification Service reacts asynchronously.

The long-term goal of this project is to evolve into a highly scalable Event Processing Platform capable of handling millions of events per day with reliability, observability, and fault tolerance.


🌟 Vision

Every business produces events.

Course Created
Payment Successful
Order Delivered
Password Changed
User Registered
Subscription Expired
Invoice Generated

Instead of every microservice sending emails, SMS, or push notifications directly, each service simply publishes an event.

Producer

↓

Kafka

↓

Notification Platform

↓

Email
SMS
Push
Slack
WhatsApp
Webhooks

This creates loosely coupled systems that are easier to scale and maintain.


🎯 Goals

Build an enterprise-grade notification platform demonstrating:

  • Event-Driven Architecture
  • Domain Driven Design
  • Clean Architecture
  • SOLID Principles
  • Kafka Consumer Groups
  • Horizontal Scalability
  • High Availability
  • Fault Tolerance
  • Idempotent Processing
  • Retry Mechanisms
  • Dead Letter Queues
  • Transactional Outbox Pattern
  • Distributed Systems Best Practices

πŸ— High Level Architecture

                    +----------------------+
                    | Course Service       |
                    +----------+-----------+
                               |
                               |
                     course.created
                               |
                               β–Ό
                    +----------------------+
                    | Apache Kafka         |
                    +----------+-----------+
                               |
          +--------------------+-------------------+
          |                    |                   |
          β–Ό                    β–Ό                   β–Ό
 Notification Service   Analytics Service   Search Service
          |
          β–Ό
  +---------------------------+
  | Notification Engine       |
  +-------------+-------------+
                |
      +---------+---------+
      |         |         |
      β–Ό         β–Ό         β–Ό
   Email      SMS      Push

πŸ›  Tech Stack

Language

  • Golang

Messaging

  • Apache Kafka

Database

  • PostgreSQL

Containerization

  • Docker
  • Docker Compose

Logging

  • slog (Structured Logging)

Future

  • Prometheus
  • Grafana
  • OpenTelemetry
  • Jaeger
  • Kubernetes
  • Helm
  • Istio

πŸ“‚ Project Structure

notification-service/

β”œβ”€β”€ api/
β”œβ”€β”€ cmd/
β”‚   └── server/
β”‚       └── main.go
β”‚
β”œβ”€β”€ domain/
β”‚
β”œβ”€β”€ events/
β”‚
β”œβ”€β”€ handler/
β”‚   β”œβ”€β”€ consumer/
β”‚   └── http/
β”‚
β”œβ”€β”€ internal/
β”‚   β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ config/
β”‚   β”œβ”€β”€ constants/
β”‚   β”œβ”€β”€ database/
β”‚   β”œβ”€β”€ kafka/
β”‚   β”œβ”€β”€ logger/
β”‚   β”œβ”€β”€ mapper/
β”‚   β”œβ”€β”€ router/
β”‚   └── usecase/
β”‚
β”œβ”€β”€ repository/
β”‚
β”œβ”€β”€ service/
β”‚
β”œβ”€β”€ shared/
β”‚
└── migrations/

Current Features

  • Kafka Consumer
  • Structured Logging
  • Graceful Shutdown
  • Configurable Consumer Groups
  • PostgreSQL Integration
  • Event Deserialization

Planned Features

Phase 1

  • Consume Kafka Events
  • Process Course Created Events
  • Worker Pool
  • Configurable Consumers

Phase 2

  • Email Notifications
  • SMS Notifications
  • Push Notifications
  • Slack Notifications

Phase 3

  • Retry Topics
  • Dead Letter Queue (DLQ)
  • Exponential Backoff
  • Poison Message Handling

Phase 4

  • Idempotent Consumers
  • Duplicate Event Detection
  • Exactly Once Processing

Phase 5

  • Transactional Outbox Pattern
  • Event Replay
  • Audit Logs
  • Event Versioning

Phase 6

  • Prometheus Metrics
  • Grafana Dashboards
  • Distributed Tracing
  • OpenTelemetry

Phase 7

  • Kubernetes Deployment
  • Helm Charts
  • Auto Scaling
  • Rolling Updates

Phase 8

  • Multi Tenant Support
  • Notification Templates
  • Template Versioning
  • Dynamic Variables

Example:

Hello {{first_name}}

A new course "{{course_name}}" has been published.

Phase 9

  • User Notification Preferences

Example

User A

βœ“ Email

βœ— SMS

βœ“ Push

βœ“ Slack

Phase 10

  • Scheduling Notifications
Send immediately

Send after 30 minutes

Send tomorrow morning

Send every Monday

Phase 11

  • Workflow Engine

Example

User Registered

↓

Send Welcome Email

↓

Wait 2 Days

↓

Send Discount Coupon

↓

Wait 7 Days

↓

Notify Sales Team

Phase 12

  • AI Powered Notifications

  • Smart Send Time

  • AI Generated Email Content

  • Personalized Messages

  • Language Translation

  • Spam Prediction


Performance Goals

  • 100K+ Events / Minute
  • Horizontal Scaling
  • Zero Downtime Deployments
  • At-Least-Once Delivery
  • Configurable Retry Strategy
  • High Throughput
  • Low Latency

Reliability Features

  • Consumer Groups
  • Manual Offset Commit
  • Retry Topics
  • Dead Letter Queue
  • Idempotent Consumers
  • Circuit Breakers
  • Graceful Shutdown
  • Backpressure Handling

Security

  • TLS Communication
  • SASL Authentication
  • JWT Authentication
  • Secrets Management
  • RBAC
  • Audit Logs

Monitoring

  • Prometheus
  • Grafana
  • OpenTelemetry
  • Jaeger
  • Structured Logs
  • Health Checks
  • Readiness Probes
  • Liveness Probes

Future Integrations

  • Amazon SES
  • SendGrid
  • Twilio
  • Firebase Cloud Messaging
  • OneSignal
  • Slack
  • Microsoft Teams
  • Discord
  • WhatsApp Business API
  • Webhooks

Long-Term Vision

This project is not just a notification microservice.

The long-term objective is to evolve it into a Cloud Native Event Processing Platform capable of serving as the communication backbone for large-scale distributed systems.

The platform will support:

  • Multi-channel notifications
  • Event orchestration
  • Workflow automation
  • Event replay
  • Analytics
  • AI-assisted notification delivery
  • Multi-tenant SaaS deployments
  • Enterprise observability
  • Kubernetes-native deployments
  • High availability and fault tolerance

Ultimately, this platform can be extended into a commercial SaaS offering where organizations publish business events once and configure how, when, and where notifications are deliveredβ€”without modifying their business services.

About

Cloud-native notification platform built using Golang, Apache Kafka, PostgreSQL, and Docker with enterprise design patterns and distributed system principles.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages