v2.0.0 — Now with CLI setup

notification-service

Internal backend-to-backend notification microservice for sending email notifications with queue-based processing and retries.

Built for reliability

Everything you need to send notifications at scale — with confidence.

Queue-based Processing

Async delivery via RabbitMQ decouples your API from email sending for maximum throughput.

Automatic Retries + DLQ

Exponential backoff retries with Dead Letter Queue routing ensure no notification is lost.

Delivery Tracking

Full lifecycle tracking in PostgreSQL: queued → sending → sent, with status check endpoints.

Webhook Callbacks

Receive HTTP callbacks for delivery status updates in your calling services.

Health & Readiness

Liveness and readiness endpoints for Kubernetes and Docker health checks.

API Key Auth + Rate Limiting

Optional per-service API key authentication and Redis-based rate limiting.

How it works

A simple, reliable pipeline from request to inbox.

Backend Services

Auth · Order · User

Notification API

Express.js + Validation

RabbitMQ

Queue · Retry · DLQ

Worker

Email processing

SMTP Provider

Gmail · SendGrid · SES

Async queue deliveryRetry on failureStatus tracked in PostgreSQL

Get started in minutes

Two paths to running notification-service locally.

1

Use the CLI tool

Interactive wizard to generate .env, docker-compose.yml, and verify your setup.

npx notification-service init
2

Or clone manually

Clone the repo, install dependencies, and configure your .env file.

git clone https://github.com/khodakivskyi/notification-service.git && cd notification-service
3

Start dependencies

Spin up PostgreSQL and RabbitMQ with Docker Compose.

docker-compose up -d
4

Run the service

Start the API server and worker processes. Database migrations run automatically.

npm run dev && npm run dev:workers
5

Send your first notification

The API queues the notification and returns an ID. Workers deliver it asynchronously.

curl -X POST http://localhost:3001/api/notifications/send \
  -H "Content-Type: application/json" \
  -d '{"email":"user@example.com","subject":"Hello","htmlContent":"<h1>It works!</h1>"}'