A microservices-based notification system that sends emails and push notifications asynchronously through message queues.
Accomplishments
Architected and led a microservices-based distributed notification system spanning 5 services (API Gateway, User, Email, Push, Template) plus RabbitMQ, Redis, and PostgreSQL, all orchestrated via Docker Compose on an isolated backend bridge network.
Designed a message-driven, decoupled architecture using a RabbitMQ notifications.direct direct exchange that routes payloads to email.queue or push.queue based on notification_type, with a notification.status queue and a failed.queue dead-letter queue.
Built the NestJS API Gateway that validates/authenticates incoming requests and publishes them to the appropriate queue via a NotificationService.routeNotification method that asserts a durable exchange and publishes by routing key.
Refactored the API Gateway to use Prisma for its data layer, added request validation, and added a global ResponseInterceptor to standardize the API response envelope (success, message, data, meta).
Implemented the FastAPI Email Service consumer that reads from email.queue, enforces idempotency, sends the email, and marks the request processed — using an aio_pika robust connection with QoS prefetch of 10.
Added Redis-based idempotency (Idempotency.is_processed / mark_processed) keyed on request_id with a configurable TTL (default 1 day) to prevent duplicate email deliveries.
Implemented an exponential-backoff retry pipeline in the email consumer: failed messages are re-published with an x-retries header up to MAX_RETRIES, then routed to the dead-letter queue for manual inspection.
Built a reusable async CircuitBreaker (CLOSED/OPEN/HALF states with fail threshold and reset timeout) applied as a decorator around the SMTP send function to prevent hammering a failing provider.
Implemented async HTML email delivery over Gmail SMTP with STARTTLS via aiosmtplib, including dynamic template rendering by calling the Template Service /templates/render endpoint.
Built the FastAPI Template Service with versioned template CRUD, code/language lookup, paginated listing, and a /render endpoint that performs variable substitution to produce subject/body.
Delivered the NestJS Push Service integrating Firebase Cloud Messaging (sendEachForMulticast) for multi-device push, with Redis idempotency (push:{notification_id}), an in-service circuit breaker, and FCM dry-run token validation.
Implemented the push queue consumer with durable queues, prefetch of 10, exponential-backoff retries (capped at 30s), dead-letter routing after max retries, and publishing delivery/failure status to the notification.status queue.
Built the NestJS User Service handling authentication (signup/login/JWT), user CRUD, contact info and notification preferences, including a current-user decorator and user-update functionality.
Added /health endpoints across services and Docker Compose health-check-based dependency ordering (e.g. email-service waits for healthy Postgres/RabbitMQ) for reliable orchestration.
Containerized every service with individual Dockerfiles and optimized production/multi-stage builds, and authored the comprehensive project README documenting architecture, message-queue setup, request formats, and performance targets (1,000+ notifications/min, 99.5% delivery success).
Coordinated a multi-contributor workflow via feature branches and pull requests (e.g. push-service, api-gateway-service, user-service, template-service PRs), reviewing and merging others’ work into main.