WORK IN PROGRESS
A production-grade, distributed e-commerce backend system built with Go, gRPC, Kafka, GraphQL, and Kubernetes.
This project demonstrates a complete microservices architecture for an e-commerce platform, featuring:
- Microservices Architecture: 5 independently deployable services
- Event-Driven Design: Asynchronous communication via Kafka
- API Gateway: Unified GraphQL interface
- Authentication: JWT-based auth with role-based access control
- Caching: Redis for performance optimization
- Observability: Prometheus + Grafana monitoring, ELK logging
- Container Orchestration: Docker Compose + Kubernetes
- CI/CD: Automated testing and deployment pipelines
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β GraphQL Gateway β
β (Unified API + Authentication) β
ββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββ
β gRPC
ββββββββββββΌβββββββββββ¬βββββββββββ¬βββββββββββ
β β β β β
ββββββΌββββ βββββΌβββββ βββββΌβββββ βββββΌββββββ ββββΌββββββββββ
βAccount β βCatalog β β Order β βPayment β βNotificationβ
βService β βService β βService β βService β β Service β
ββββββ¬ββββ βββββ¬βββββ βββββ¬βββββ βββββ¬ββββββ ββββ¬ββββββββββ
β β β β β
βββββββββββ΄βββββββββββ΄βββββββββββ΄βββββββββββ
β
Kafka Event Bus
β
βββββββββββββββββββΌββββββββββββββββββ
β β β
PostgreSQL Redis Elasticsearch
- User registration and authentication
- JWT token generation and validation
- Role-based access control (USER/ADMIN)
- Password hashing with bcrypt
Tech Stack: Go, gRPC, PostgreSQL, JWT
- Product CRUD operations
- Full-text search with Elasticsearch
- Redis caching for performance
- Inventory management
Tech Stack: Go, gRPC, Elasticsearch, Redis
- Order creation and management
- Order status tracking
- Integration with Account & Catalog services
- Event publishing to Kafka
Tech Stack: Go, gRPC, PostgreSQL, Kafka
- Payment processing (Stripe mock integration)
- Idempotency key support
- Transaction management
- Event-driven status updates
Tech Stack: Go, gRPC, PostgreSQL, Kafka, Redis
- Email notifications (SMTP mock)
- Event-driven notifications
- Template-based messaging
- Notification history
Tech Stack: Go, Kafka
- Unified API for all services
- Authentication middleware
- Rate limiting
- Query complexity analysis
Tech Stack: Go, gqlgen, gRPC clients
Languages & Frameworks:
- Go 1.21+
- gRPC & Protocol Buffers
- GraphQL (gqlgen)
Databases:
- PostgreSQL 15
- Elasticsearch 8
- Redis 7
Message Queue:
- Apache Kafka
Observability:
- Prometheus (metrics)
- Grafana (dashboards)
- ELK Stack (logging)
DevOps:
- Docker & Docker Compose
- Kubernetes
- GitHub Actions (CI/CD)
Testing:
- Go testing framework
- Testcontainers (integration tests)
- k6 (load testing)
- Go 1.21 or higher
- Docker & Docker Compose
- Protocol Buffers compiler (protoc)
- kubectl (for Kubernetes deployment)
- Clone the repository
git clone https://github.com/Ujjwaljain16/E-commerce-Backend.git
cd E-commerce-Backend- Install dependencies
go mod download- Generate Protocol Buffer code
make proto-gen- Start infrastructure services
docker-compose up -d- Run database migrations
make migrate-up- Start all services
# Terminal 1: Account Service
cd account/cmd/account && go run main.go
# Terminal 2: Catalog Service
cd catalog/cmd/catalog && go run main.go
# Terminal 3: Order Service
cd order/cmd/order && go run main.go
# Terminal 4: Payment Service
cd payment/cmd/payment && go run main.go
# Terminal 5: Notification Service
cd notification/cmd/notification && go run main.go
# Terminal 6: GraphQL Gateway
cd graphql && go run main.go- Access the GraphQL Playground
http://localhost:8000/playground
mutation {
register(input: {
name: "John Doe"
email: "john@example.com"
password: "SecurePass123!"
}) {
account {
id
name
email
}
accessToken
}
}mutation {
createProduct(input: {
name: "Laptop"
description: "High-performance laptop"
price: 999.99
}) {
id
name
price
}
}mutation {
createOrder(input: {
accountId: "acc_123"
products: [
{ id: "prod_456", quantity: 2 }
]
}) {
id
totalPrice
status
}
}make testmake integration-testmake coveragemake load-test- URL: http://localhost:9090
- Service-level metrics (RED: Rate, Errors, Duration)
- Business metrics (orders/sec, revenue)
- URL: http://localhost:3000
- Credentials: admin/admin
- Pre-configured dashboards for all services
- URL: http://localhost:5601
- Centralized logging with correlation IDs
docker-compose up --build# Deploy to Kubernetes
kubectl apply -f k8s/
# Check deployment status
kubectl get pods -n ecommerce
# Access services
kubectl port-forward svc/graphql-gateway 8000:8080ecommerce-microservices/
βββ account/ # Account service
β βββ pb/ # Generated protobuf code
β βββ cmd/account/ # Service entrypoint
β βββ migrations/ # Database migrations
β βββ *.go # Service implementation
βββ catalog/ # Catalog service
βββ order/ # Order service
βββ payment/ # Payment service
βββ notification/ # Notification service
βββ graphql/ # GraphQL gateway
βββ pkg/ # Shared packages
β βββ auth/ # JWT utilities
β βββ kafka/ # Kafka producer/consumer
β βββ cache/ # Redis client
β βββ logger/ # Structured logging
β βββ metrics/ # Prometheus metrics
βββ k8s/ # Kubernetes manifests
βββ monitoring/ # Prometheus, Grafana configs
βββ tests/ # Integration & load tests
βββ docker-compose.yaml
βββ Makefile
Contributions are welcome! Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.
Ujjwal Jain
- GitHub: @Ujjwaljain16
- LinkedIn: Ujjwal Jain
- Inspired by microservices architectures at Amazon, Netflix, and Uber
- Built as a learning project to demonstrate production-grade backend engineering
- Order Creation: 800+ req/sec
- Product Search: 1200+ req/sec
- Authentication: 500+ req/sec
- P95 Latency: < 100ms for all endpoints
- JWT-based authentication
- Password hashing with bcrypt
- Input validation on all endpoints
- SQL injection prevention
- Rate limiting
- CORS configuration
β If you find this project useful, please consider giving it a star!