A comprehensive e-commerce microservices architecture built with containerized services, featuring modern CI/CD pipelines, monitoring, and observability.
- ποΈ Architecture Overview
- π Services
- π§ Development Setup
- π³ Docker & Local Development
- π CI/CD Pipeline
- βΈοΈ Kubernetes Deployment
- π Monitoring & Observability
- π Security
- π Project Structure
ShopStack implements a microservices-based e-commerce platform with the following core components:
- Web Frontend - Nginx-based UI gateway with reverse proxy
- User Service - User authentication and management (MongoDB + Redis)
- Catalog Service - Product catalog management (MongoDB)
- Cart Service - Shopping cart functionality (Redis)
- Payment Service - Payment processing with RabbitMQ messaging
- Shipping Service - Order fulfillment and shipping (MySQL)
- Ratings Service - Product rating and review system (MySQL)
- Dispatch Service - Order processing and dispatch via RabbitMQ
- MongoDB - Primary database for User, Catalog, and Cart services
- Redis - Caching layer for User and Cart services
- MySQL - Database for Shipping and Ratings services
- RabbitMQ - Message queuing for Payment and Dispatch services
- OpenTelemetry - Distributed tracing and metrics
- Elasticsearch - Centralized logging and search
- Kibana - Log visualization and analysis
- Prometheus - Metrics collection and alerting
- Grafana - Metrics visualization (disabled in favor of Kibana)
- Fluentd/Fluentbit - Log aggregation and forwarding
- AWS CodeBuild - Automated build and deployment
- Amazon ECR - Container registry
- ArgoCD - GitOps continuous deployment
- Slack Integration - Build and deployment notifications
- Technology: Nginx + React SPA
- Port: 8080 (exposed)
- Features: Reverse proxy, static asset serving, service routing
- Health Check:
/endpoint - Dependencies: catalogue, user, shipping, payment
- Monitoring: Instana APM integration
- Technology: Node.js/Express
- Database: MongoDB + Redis
- Features: JWT authentication, user management, profile management
- Health Check:
/healthendpoint - Dependencies: mongodb, redis
- Technology: Node.js/Express
- Database: MongoDB
- Features: Product catalog, search, inventory management
- Health Check:
/healthendpoint - Dependencies: mongodb
- Technology: Node.js/Express
- Database: Redis (session storage)
- Features: Shopping cart, session management, cart persistence
- Health Check:
/healthendpoint - Dependencies: redis
- Technology: Node.js/Express
- Message Queue: RabbitMQ
- Features: Payment processing, multiple gateway support (WorldPay)
- Health Check:
/healthendpoint - Dependencies: rabbitmq
- Security: PCI compliance considerations
- Technology: Node.js/Express
- Database: MySQL
- Features: Order fulfillment, shipping calculation, tracking
- Health Check:
/healthendpoint - Dependencies: mysql
- Technology: Node.js/Express
- Database: MySQL
- Features: Product ratings, reviews, averaging system
- Health Check:
/_healthendpoint (different path) - Environment: Production mode enabled
- Dependencies: mysql
- Technology: Node.js/Express
- Message Queue: RabbitMQ
- Features: Order processing, event dispatch, workflow orchestration
- Dependencies: rabbitmq
- Note: No health check endpoint
- Docker & Docker Compose
- Node.js 16+ (for local development)
- AWS CLI (for CI/CD)
- Git (for version control)
# Clone the repository
git clone https://github.com/Uj5Ghare/Kops-Microservices-Project.git
cd Kops-Microservices-Project
# Copy environment file
cp .env.example .env
# Edit environment variables
nano .env
# Start all services
docker-compose up -d
# View logs
docker-compose logs -f [service-name]
# Stop services
docker-compose down# Required for Docker Compose
REPO=shopstack # Docker repository name
TAG=1.0.0 # Docker image tag
INSTANA_AGENT_KEY=your-key # Instana monitoring key
# Required for CI/CD
AWS_ACCOUNT_ID=your-aws-account-id
PROJECT=shopstack
TARGET_BRANCH=k8s/staging # or k8s/preprod- MongoDB: Custom image built from
mongo/directory - Redis: Official Redis 6.2-alpine image
- RabbitMQ: Official RabbitMQ 3.8-management-alpine image
- MySQL: Custom image built from
mysql/directory with NET_ADMIN capabilities - Microservices: Built from individual service directories with standardized health checks
- Network: Shared
shopstacknetwork for inter-service communication
All services implement standardized health checks using:
curl -H "X-INSTANA-SYNTHETIC: 1" -f http://localhost:8080/healthExceptions:
- Web Frontend: Uses
/endpoint instead of/health - Ratings Service: Uses
/_healthendpoint - Dispatch Service: No health check endpoint
Web β Catalogue, User, Shipping, Payment
User β MongoDB, Redis
Catalogue β MongoDB
Cart β Redis
Payment β RabbitMQ
Shipping β MySQL
Ratings β MySQL
Dispatch β Rabbitmq
- Build Spec:
buildspec.yml - Triggers: Git push to
k8s/stagingandk8s/preprod - Environments: Staging and Production
- Registry: Amazon ECR
- Pre-build: ECR login and change detection
- Build: Docker image creation with multi-platform support
- Post-build: Git operations and Slack notifications
- Deploy: Helm chart updates and ArgoCD sync
- Semantic Versioning: Automatic patch version increment
- Tag Strategy:
MAJOR.MINOR.PATCHformat - Rollback Support: Previous version tracking
- Build Notifications: Start and completion alerts
- Deployment Notifications: Environment-specific channels
- Failure Alerts: Immediate error reporting
The ShopStack project uses a GitOps-based branching strategy with environment-specific branches:
π Repository Structure:
βββ k8s/staging β Staging environment deployments
βββ k8s/preprod β Production environment deployments
βββ main/develop β Development (feature branches)
Kops-Microservices-Project/
βββ π argocd/ # ArgoCD Application manifests
β βββ cart.yaml # Cart service ArgoCD app
β βββ catalogue.yaml # Catalog service ArgoCD app
β βββ user.yaml # User service ArgoCD app
β βββ ... # Other services
βββ π helm/ # Helm charts for each service
β βββ cart/ # Cart service Helm chart
β β βββ Chart.yaml # Chart metadata
β β βββ values.yaml # Default configuration
β β βββ templates/ # Kubernetes templates
β βββ catalogue/ # Other service charts
β βββ ...
βββ π valuefiles/ # Environment-specific Helm values
β βββ argocd-values.yaml # ArgoCD configuration
β βββ prometheus-values.yaml # Monitoring config
β βββ ... # Other infrastructure configs
βββ π [service-dirs]/ # Source code and Dockerfiles
Each microservice has a dedicated ArgoCD Application manifest:
# argocd/cart.yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: cart
namespace: argocd
spec:
destination:
namespace: shopstack # Target Kubernetes namespace
server: https://kubernetes.default.svc
project: default
source:
helm:
parameters: # Helm value overrides
- name: hpa.enabled
value: "true"
- name: defaults.namespace.name
value: "shopstack"
valueFiles:
- values.yaml # Helm values file
path: helm/cart # Helm chart path in repo
repoURL: https://github.com/Uj5Ghare/Kops-Microservices-Project.git
targetRevision: k8s/staging # π― KEY: Branch to track
syncPolicy:
automated:
prune: true # Auto-remove resources
selfHeal: true # Auto-fix driftEach service has a standardized Helm chart:
# helm/cart/values.yaml
defaults:
namespace:
name: shopstack
deploy:
replicaCount: 1
image:
repository: ghcr.io/shopstack/shopstack-cart
tag: latest # π Updated by CI/CD
tolerations:
key: app
operator: Equal
value: shopstack # π― Standardized tolerations
env:
- name: REDIS_HOST
value: "redis"
- name: CATALOGUE_HOST
value: "catalogue"
service:
type: ClusterIP
ports:
http:
port: 8080
targetPort: 8080
hpa:
enabled: true
maxReplicas: 3
minReplicas: 1# Developer makes changes
git checkout -b feature/new-feature
# ... make changes ...
git commit -m "Add new feature"
git push origin feature/new-feature
# CI/CD Pipeline (buildspec.yml) triggers:
# 1. Detects changed service folder
# 2. Builds Docker image
# 3. Pushes to ECR with new tag
# 4. Updates Helm values with new image tag
# 5. Pushes to k8s/staging branch# ArgoCD monitors k8s/staging branch
# Detects changes in helm/[service]/values.yaml
# Automatically deploys to staging environment# After staging validation:
git checkout k8s/preprod
git merge k8s/staging
git push origin k8s/preprod
# ArgoCD deploys to production- Purpose: Define which services to deploy and how
- Target:
k8s/stagingork8s/preprodbranches - Namespace: All services deploy to
shopstacknamespace - Sync Policy: Automated with self-healing
- Purpose: Kubernetes resource templates for each service
- Structure: Standardized across all services
- Configuration: Environment-agnostic defaults
- Templates: Deployment, Service, HPA, Ingress, etc.
- Purpose: Environment-specific configurations
- Infrastructure: Monitoring, logging, security tools
- Tolerations: Standardized
app=shopstackpattern - Integration: ArgoCD, Prometheus, Elasticsearch, etc.
graph LR
A[Developer Push] --> B[CI/CD Pipeline]
B --> C[Build Docker Image]
C --> D[Push to ECR]
D --> E[Update Helm Values]
E --> F[Push to k8s/staging]
F --> G[ArgoCD Detects Changes]
G --> H[Deploy to Staging]
H --> I[Testing & Validation]
I --> J[Manual Approval]
J --> K[Merge to k8s/preprod]
K --> L[ArgoCD Deploy to Production]
# ArgoCD Application Dependencies:
web β catalogue, user, shipping, payment, ratings
user β mongodb, redis
catalogue β mongodb
cart β redis
payment β rabbitmq
shipping β mysql
ratings β mysql
dispatch β rabbitmq# Cart Service
REDIS_HOST: redis
CATALOGUE_HOST: catalogue
INSTANA_AUTO_PROFILE: true
# User Service
REDIS_HOST: redis
MONGO_URL: mongodb://mongodb:27017/userstolerations:
key: app
operator: Equal
value: shopstack
affinity:
nodeAffinity:
key: app
operator: In
values: shopstack- GitOps: Everything is code-controlled and versioned
- Environment Isolation: Separate branches for staging/production
- Automated Deployments: ArgoCD handles deployment automatically
- Standardization: Consistent structure across all services
- Scalability: Easy to add new services following the same pattern
- Rollback: Simple branch-based rollback capability
- Observability: Integrated monitoring and logging stack
- Tool: Kubernetes Operations (kops)
- Environments:
- Staging:
k8s/stagingbranch - Production:
k8s/preprodbranch
- Staging:
All services use standardized tolerations:
tolerations:
key: app
operator: Equal
value: shopstack- GitOps: Automated deployments from Git
- Helm Charts: Dynamic value updates
- Sync Strategy: Automated with manual overrides
- Health Monitoring: Application and cluster health
- Unified Namespace:
shopstackfor all services - Isolation: Environment-specific deployments
- Resource Management: Centralized resource quotas
- Fluentd/Fluentbit: Log collection and forwarding
- Elasticsearch: Centralized log storage and indexing
- Kibana: Log visualization and analysis dashboard
- CloudWatch: AWS log aggregation backup
- Prometheus: Metrics collection from all services
- AlertManager: Alert routing and management
- Custom Alerts: Application-specific monitoring rules
- Slack Integration: Real-time alert notifications
- OpenTelemetry: End-to-end request tracing
- Service Mesh: Inter-service communication monitoring
- Performance Analysis: Request latency and error tracking
- Instana Integration: APM and synthetic monitoring
All services expose /health endpoints:
- Response Format: JSON with service status
- Dependencies: Database and external service checks
- Automated Testing: Synthetic transaction monitoring
- Base Images: Official and trusted base images
- Minimal Privileges: Least-privilege container execution
- Secret Management: Kubernetes secrets and environment variables
- Image Scanning: Automated vulnerability scanning
- Service Mesh: Internal network isolation
- TLS Encryption: Inter-service communication
- API Gateway: Centralized access control
- Rate Limiting: DDoS protection and abuse prevention
- Encryption at Rest: MongoDB and Redis encryption
- Encryption in Transit: TLS for all communications
- PII Protection: Personal data anonymization
- Compliance: GDPR and PCI DSS considerations
Kops-Microservices-Project/
βββ π Service Directories
β βββ web/ # Frontend application
β βββ user/ # User management service
β βββ catalogue/ # Product catalog service
β βββ cart/ # Shopping cart service
β βββ payment/ # Payment processing service
β βββ shipping/ # Shipping fulfillment service
β βββ ratings/ # Product rating service
β βββ dispatch/ # Order dispatch service
β βββ mongo/ # Database configuration
β βββ mysql/ # Database scripts
βββ π Infrastructure
β βββ docker-compose.yaml # Local development setup
β βββ buildspec.yml # CI/CD pipeline
β βββ arch.png # Architecture diagram
βββ π Kubernetes
β βββ valuefiles/ # Helm value files
β βββ argocd-values.yaml
β βββ prometheus-values.yaml
β βββ elasticsearch-values.yaml
β βββ [other service configs]
βββ π Configuration
β βββ .env.example # Environment template
β βββ .gitignore # Git ignore rules
βββ π Documentation
βββ README.md # This file
βββ LICENSE # Project license
Each service follows the standard structure:
[service]/
βββ Dockerfile # Container build definition
βββ package.json # Node.js dependencies
βββ src/ # Application source code
βββ helm/ # Kubernetes deployment charts
β βββ values.yaml # Service configuration
βββ tests/ # Unit and integration tests
# Clone and setup
git clone https://github.com/Uj5Ghare/Kops-Microservices-Project.git
cd Kops-Microservices-Project
cp .env.example .env
# Edit environment variables with your values
nano .env
# Start all services
docker-compose up -d
# Access services
open http://localhost:8080 # Web frontend
# Check service health
curl http://localhost:8080/health # Web service
curl http://localhost:8080/health # Other services (via web proxy)# Build specific service
docker-compose build catalogue
# Start specific service with dependencies
docker-compose up -d mongodb catalogue
# View service logs
docker-compose logs -f catalogue
# Access service directly (if exposed)
curl http://localhost:8080/health # Web service only# Deploy to staging
git checkout k8s/staging
git push origin k8s/staging
# Deploy to production
git checkout k8s/preprod
git push origin k8s/preprod- Kibana Dashboard:
https://observability.ujwal5ghare.xyz - Prometheus: Available via cluster port forwarding
- ArgoCD:
https://argocd.ujwal5ghare.xyz
graph LR
A[Developer Push] --> B[CodeBuild Trigger]
B --> C[Build & Test]
C --> D[Push to ECR]
D --> E[Update Helm Values]
E --> F[ArgoCD Sync]
F --> G[Kubernetes Deploy]
G --> H[Health Check]
H --> I[Slack Notification]
# Check logs
docker-compose logs [service-name]
# Verify environment
docker-compose config
# Check port conflicts
netstat -tulpn | grep [port]# Check build logs
aws codebuild batch-get-builds --project-name shopstack
# Verify ECR permissions
aws ecr get-authorization-token# Check ArgoCD status
kubectl get applications -n argocd
# Verify tolerations
kubectl describe nodes- Issues: GitHub Issues
- Discussions: GitHub Discussions
This project is licensed under the MIT License - see the LICENSE file for details.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
Built with β€οΈ for the ShopStack e-commerce platform

