This project is a personalized notification system for an e-commerce platform, designed as a microservices-based architecture. It incorporates various technologies to ensure scalability, reliability, and flexibility.
- Programming Language: Golang
- Databases: PostgreSQL, Redis
- Database Migrations: golang-migrate
- Message Broker: Kafka
- Containerization: Docker & Docker Compose
- API Gateway: GraphQL (gqlgen)
- Features:
- Register a user (name, email, preferences)
- Get user details
- Update notification preferences
- Database: PostgreSQL
- Authentication: JWT
- Features:
- Post, mark read, and fetch unread notifications
- Scheduled promotion notifications (cron job) for users with relevant preferences
- Subscribes to the
order-status-updated
Kafka topic to create notifications for users with theorder_updates
preference
- Database: PostgreSQL
- Features:
- Add product
- Get product details
- Fetch all products
- Database: PostgreSQL
- Features:
- Create order
- Fetch order details and orders by user
- Update order status
- Emits
order-status-updated
events via Kafka when order status is updated
- Database: PostgreSQL
- Features:
- Unified GraphQL API for client interaction
- JWT middleware for protected routes
- Admin middleware for restricted actions
- Redis caching for frequently queried data (e.g., product listings)
- Data aggregation from all microservices
- GraphQL Framework: gqlgen
- Cache: Redis
Queries marked with "JWT" require a Bearer token in Authorization header, which can be received after registering a user.
Queries marked with "Admin" require x-api-key
in headers, which should match ADMIN_SECRET_KEY
in Gateway service .env file.
The entire architecture can be run with a single command:
docker-compose up
Use the Makefile to build and run all services at once:
make build
make run
Or run an individual service:
go run cmd/user-service/main.go