Skip to content

jillani-07/skycommerce

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›’ SkyCommerce β€” Production MERN E-Commerce on AWS

CI/CD Pipeline AWS ECS Docker Terraform MongoDB Node.js React

A production-grade full-stack e-commerce platform built with the MERN stack and deployed on AWS using industry-standard DevOps practices. Features a fully automated CI/CD pipeline β€” every git push to main automatically builds, tests, and deploys to AWS ECS Fargate with zero downtime.

🌐 Live URL: http://skycommerce-alb-1652530944.ap-south-1.elb.amazonaws.com


πŸ“Έ Screenshots

Homepage

Homepage

Admin Dashboard

Admin Dashboard

CI/CD Pipeline β€” GitHub Actions

CI/CD Pipeline

AWS ECS Services

ECS Services

CloudWatch Monitoring Dashboard

CloudWatch


πŸ—οΈ Architecture

User Browser β”‚ β–Ό AWS Application Load Balancer (ALB) β”‚ β”œβ”€β”€ /api/* ──► Backend ECS Fargate (Node.js :5001) β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β” β”‚ β”‚ MongoDB β”‚ β”‚ β”‚ Atlas β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ AWS Secrets β”‚ β”‚ β”‚ Manager β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ └── /* ──► Frontend ECS Fargate (Nginx :80) β”‚ React.js SPA (Redux) All containers ──► CloudWatch Logs + Alarms


πŸš€ CI/CD Pipeline

Every push to main triggers automatic deployment:

git push origin main β”‚ β–Ό GitHub Actions (~4 minutes) β”‚ β”œβ”€β”€ Job 1: Test & Lint (15s) β”‚ Backend syntax check β”‚ Frontend build verification β”‚ β”œβ”€β”€ Job 2: Build & Push (60s) β”‚ Docker build (linux/amd64) β”‚ Push to AWS ECR β”‚ └── Job 3: Deploy to ECS (2m 38s) Update ECS services Zero downtime rolling deploy Wait for health checks


πŸ› οΈ Tech Stack

Application

Layer Technology
Frontend React.js 18, Redux Toolkit, Tailwind CSS, Vite
Backend Node.js 20, Express.js, REST API
Database MongoDB Atlas (managed cloud)
Auth JWT with HTTP-only cookies
Payment Stripe (test mode)

DevOps & Cloud

Tool Purpose
Docker Multi-stage builds, Nginx, non-root security
AWS ECS Fargate Serverless container orchestration
AWS ECR Private Docker image registry
AWS ALB Load balancer with path-based routing
AWS VPC Custom network, public/private subnets
AWS Secrets Manager Secure secrets β€” never in code
AWS CloudWatch Logs, metrics, 4 alarms, dashboard
Terraform 34 AWS resources as Infrastructure as Code
GitHub Actions 3-job CI/CD pipeline
Git + GitHub Branch protection, PR workflow

☁️ AWS Infrastructure (Terraform IaC)

34 resources managed as code β€” entire infrastructure recreatable in 5 minutes:

Networking VPC, 4 Subnets, IGW, Route Tables, Security Groups Load Balancing ALB, 2 Target Groups, Listener, Path Rules Containers ECS Cluster, 2 Task Definitions, 2 Fargate Services Registry 2 ECR Repositories with lifecycle policies Security 2 IAM Roles, 2 IAM Policies, Secrets Manager Monitoring 2 Log Groups, 4 Alarms, Dashboard, SNS Topic


πŸ“ Project Structure

SkyCommerce/
β”œβ”€β”€ .github/
β”‚   └── workflows/
β”‚       └── deploy.yml          # GitHub Actions CI/CD
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ config/
β”‚   β”‚   └── db.js               # MongoDB connection
β”‚   β”œβ”€β”€ controllers/            # Business logic handlers
β”‚   β”œβ”€β”€ middleware/             # Auth, error, upload
β”‚   β”œβ”€β”€ models/                 # Mongoose schemas
β”‚   β”œβ”€β”€ routes/                 # API endpoints
β”‚   β”œβ”€β”€ Dockerfile              # Multi-stage build
β”‚   └── server.js               # Express entry point
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/         # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ pages/              # Route pages
β”‚   β”‚   β”œβ”€β”€ redux/              # State management
β”‚   β”‚   └── utils/              # Axios interceptors
β”‚   β”œβ”€β”€ Dockerfile              # Multi-stage + Nginx
β”‚   β”œβ”€β”€ nginx.conf              # Production Nginx config
β”‚   └── vite.config.js          # Vite configuration
β”œβ”€β”€ terraform/
β”‚   β”œβ”€β”€ main.tf                 # Provider + data sources
β”‚   β”œβ”€β”€ vpc.tf                  # Network infrastructure
β”‚   β”œβ”€β”€ ecs.tf                  # ECS cluster + services
β”‚   β”œβ”€β”€ ecr.tf                  # Docker image registry
β”‚   β”œβ”€β”€ alb.tf                  # Load balancer + routing
β”‚   β”œβ”€β”€ iam.tf                  # Roles and policies
β”‚   β”œβ”€β”€ secrets.tf              # AWS Secrets Manager
β”‚   β”œβ”€β”€ cloudwatch.tf           # Monitoring + alerts
β”‚   β”œβ”€β”€ variables.tf            # Input variables
β”‚   └── outputs.tf              # Output values
β”œβ”€β”€ screenshots/                # Project screenshots
β”œβ”€β”€ docker-compose.yml          # Local development
└── README.md

✨ Features

Customer

  • Browse and search products by category/keyword
  • Product details with ratings and reviews
  • Shopping cart with quantity management
  • Checkout with shipping address
  • Order history and tracking
  • JWT authentication (register/login/logout)

Admin

  • Dashboard with revenue, orders, users metrics
  • Full product CRUD (create, edit, delete)
  • Order management (mark as delivered)
  • User management

πŸ”’ Security

  • All secrets in AWS Secrets Manager β€” zero secrets in code
  • JWT tokens with bcrypt password hashing (10 rounds)
  • Non-root user inside Docker containers
  • IAM least privilege β€” CI/CD user has minimum permissions
  • Branch protection β€” PRs required, no direct push to main
  • ECR image scanning on every push
  • Network isolation with VPC security groups

πŸ“Š Monitoring

Alarm Threshold Action
Backend CPU > 80% Email alert
Backend Memory > 80% Email alert
ALB 5XX Errors > 10/min Email alert
Response Time > 5 seconds Email alert

πŸƒ Local Development

# Clone
git clone https://github.com/jillani-07/skycommerce.git
cd skycommerce

# Backend
cd backend
cp .env.example .env
npm install
npm run dev

# Frontend (new terminal)
cd frontend
npm install
npm run dev

# Or run everything with Docker
docker-compose --env-file .env.docker up --build

Seed database:

cd backend
node seeder.js
# Admin: admin@skycommerce.com / admin123456

πŸ‘€ Author

Jillani Ansari


πŸ“„ License

MIT License

About

Production MERN e-commerce on AWS with full DevOps pipeline Add topics: mern, aws, docker, terraform, github-actions, ecs, devops, nodejs, react, mongodb

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages