A modern, microservices-based e-commerce platform built with Node.js, React, and OpenShift.
The platform consists of the following microservices:
- Gateway Service (Port 3000): API Gateway that routes requests to appropriate services
- Homepage Service (Port 3001): Handles the main shopping interface
- Catalog Service (Port 3002): Manages product catalog and categories
- Cart Service (Port 3003): Handles shopping cart operations
- Checkout Service (Port 3004): Manages order processing and checkout
- PostgreSQL Database: Persistent storage for all services
- Docker
- OpenShift cluster (local or cloud)
- oc CLI
- Node.js 20.x
- npm 10.x
- Install dependencies for each service:
cd gateway && npm install
cd ../homepage && npm install
cd ../catalog && npm install
cd ../cart && npm install
cd ../checkout && npm install
- Set up environment variables:
cp .env.example .env
- Start the development servers:
# In separate terminals
cd gateway && npm run dev
cd homepage && npm run dev
cd catalog && npm run dev
cd cart && npm run dev
cd checkout && npm run dev
Make the build script executable and run it:
chmod +x build-images.sh
./build-images.sh
This will build and push all service images to Docker Hub under the aryansr
namespace.
- Login to your OpenShift cluster:
oc login --token=<your-token> --server=<your-server>
- Create the project (namespace):
oc new-project playfair
- Create storage resources:
# Create PersistentVolume and StorageClass
oc apply -f k8s/storage-class.yaml
oc apply -f k8s/local-pv.yaml
- Create ConfigMap and Secrets:
oc create configmap playfair-config --from-file=k8s/configmap.yaml
oc create secret generic playfair-secret --from-file=k8s/secret.yaml
- Deploy all services:
oc apply -f k8s/
- Create routes for external access:
oc expose service gateway
Check the status of all pods:
oc get pods -n playfair
Check routes and services:
oc get routes -n playfair
oc get services -n playfair
View deployment status:
oc status
Scale deployments if needed:
oc scale deployment/gateway --replicas=3
The platform uses PostgreSQL with the following main tables:
- categories: Product categories
- products: Product information
- cart_items: Shopping cart items
- orders: Customer orders
- order_items: Items within orders
The platform includes:
- OpenShift monitoring and metrics
- Liveness probes for service health checks
- Resource limits and requests for all pods
- Integration with OpenShift's built-in monitoring stack
- Row Level Security (RLS) enabled for all database tables
- Secure communication between services using OpenShift's internal network
- Environment variables for sensitive data
- OpenShift secrets for credentials
- RBAC policies for access control
.
├── gateway/ # API Gateway service
├── homepage/ # Homepage service
├── catalog/ # Catalog service
├── cart/ # Cart service
├── checkout/ # Checkout service
├── postgres/ # PostgreSQL configuration
├── k8s/ # OpenShift/Kubernetes manifests
├── supabase/ # Database migrations
└── build-images.sh # Docker build script
Required environment variables:
POSTGRES_USER=playfair
POSTGRES_PASSWORD=your_password
POSTGRES_DB=playfair
POSTGRES_HOST=postgres
POSTGRES_PORT=5432
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
MIT License - See LICENSE file for details