This backend powers real-time FCM push notifications, async processing, and microservices for driver/customer engagement on Monlai. Built with scalability, observability, and modularity in mind.
- Go (Golang) – Backend language for all microservices
- Gin – Lightweight HTTP framework
- Uber Fx – Dependency injection framework for modular service composition
Each of the following services runs independently in Docker containers:
notify– Handles Firebase push notification logicdriver– Driver management microservicecustomer– Customer-related microservice
- AWS SQS: Queue-based decoupling for driver and user notification triggers
- Concurrent Workers: Fixed goroutine worker pool listens on channel
notifyChan
- Token Storage: FCM tokens for each user/driver are stored using role-based Redis keys
- (Optional) Redis Strategy Pattern:
- Used via
strategy.GetTokenStrategy(role)abstraction - Enables plug-and-play support for customer/driver-specific token handling
- Used via
- Redis Pub/Sub / Locking (if implemented in extensions):
- Considered for distributed coordination and event notification (pending code trace)
- Amazon SQS
DRIVER_QUEUE_URLfor messages targeting driversUSER_QUEUE_URLfor messages targeting users- Ensures loose coupling and retry durability
- Messages deleted after successful enqueue or delivery
- Firebase Cloud Messaging (FCM) – Delivered via the Go Admin SDK
- Per-user token targeting – Dynamically fetched from Redis
- Dynamic message composition – Structured payloads built per role/message context
- Prometheus Client (Go) – Metrics exposed on
/notify/metrics - Grafana Dashboard – Connected via Prometheus scrape config to visualize:
- Memory usage
- Go runtime stats
- Queue handler latency
- API Gateway Proxying – AWS Gateway routes public traffic to private
/metricsfor Prometheus
- Firebase Service Account JSON – Injected securely into container via volume
.envfile – Centralized configuration for:- AWS credentials
- Queue URLs
- Redis URL
- Firebase JSON path
- Docker: Multi-container deployment (
driver,customer,notify) - Docker Compose: Local orchestration
- GitHub Actions:
- CI/CD pipeline: builds, pushes to DockerHub, and SSH deploys to EC2
- Writes service account and
.envdynamically
- Amazon EC2 – Hosts all Docker containers
- API Gateway (AWS) – Publicly exposes FCM registration and metrics endpoints
- Redis – In-memory caching & token store (hosted or containerized)