Skip to content

End-to-end DevOps project for a sample e-commerce platform using GitHub Actions, Docker, Terraform, and Ansible.

Notifications You must be signed in to change notification settings

Shakeelkhuhro/ExampleCorp-Ecommerce

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

34 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›’ ExampleCorp E-commerce Platform

A cloud-native, full-stack e-commerce application that demonstrates production-grade development, DevOps automation, and scalable deployment strategies. Built using React.js, Node.js, and a complete modern DevOps toolchain.

CI/CD License: MIT


✨ Live Experience

  • 🌐 Frontend: Mobile-first, responsive, modern UI
  • πŸ”— API: Secure, RESTful backend with full CRUD
  • πŸ“± Performance: Optimized load, fast interactions

🎯 Key Features

πŸ›οΈ E-commerce Functionality

  • Product Catalog - Browse, search, and filter products
  • Shopping Cart - Add/remove items with persistent storage
  • User Authentication - JWT-based login/register system
  • Order Management - Complete order processing workflow
  • Admin Dashboard - Product and user management
  • Wishlist - Save favorite products

🎨 Modern UI/UX

  • Professional Design - Clean, modern interface with gradients
  • Responsive Layout - Mobile-first design with CSS Grid/Flexbox
  • Interactive Elements - Smooth animations and hover effects
  • Typography - Premium fonts (Inter & Poppins)
  • Accessibility - WCAG compliant with proper focus states

πŸ”§ Technical Excellence

  • Secure REST API with Express.js
  • MongoDB schemas designed for performance & relationships
  • Best practices: CORS, Helmet, bcrypt, JWT
  • Optimized with compression, caching, and validations
  • Structured for unit and integration testing

πŸ” Enterprise Security

  • πŸ”‘ HashiCorp Vault - Centralized secret management
  • πŸ”„ Secret Rotation - Automated credential updates
  • πŸ›‘οΈ Zero Hardcoded Secrets - All credentials vault-managed
  • πŸ”’ Multi-Environment - Secure config per environment
  • πŸ“Š Audit Logging - Complete security compliance
  • 🚨 Real-time Monitoring - Security event tracking

πŸ—οΈ Architecture

graph TB
    subgraph "🎭 Frontend Layer"
        A[πŸ‘€ User] --> B[βš›οΈ React App]
        B --> B1[🏠 HomePage]
        B --> B2[πŸ›οΈ ProductsPage]
        B --> B3[πŸ›’ Shopping Cart]
        B --> B4[πŸ‘€ User Profile]
        B5[🎨 Components] --> B
        B6[πŸ“± React Router] --> B
    end
    
    subgraph "🌐 API Gateway Layer"
        B --> C[πŸ”— Express.js API]
        C --> C1[πŸ” Auth Middleware]
        C --> C2[βœ… Validation]
        C --> C3[πŸ›‘οΈ Security Headers]
        C --> C4[πŸ“Š Rate Limiting]
    end
    
    subgraph "🎯 Business Logic Layer"
        C --> D1[πŸ“¦ Product Service]
        C --> D2[πŸ‘₯ User Service] 
        C --> D3[πŸ›’ Order Service]
        C --> D4[πŸ” Auth Service]
        D1 --> D5[πŸ“ CRUD Operations]
        D2 --> D5
        D3 --> D5
    end
    
    subgraph "πŸ’Ύ Data Layer"
        D5 --> E[πŸƒ MongoDB]
        E --> E1[πŸ‘₯ Users Collection]
        E --> E2[πŸ“¦ Products Collection]
        E --> E3[πŸ›’ Orders Collection]
        E --> E4[πŸ“Š Indexes & Relations]
    end
    
    subgraph "πŸ” Security Layer"
        F1[πŸ”‘ JWT Tokens] --> C1
        F2[πŸ”’ bcrypt Hashing] --> D2
        F3[πŸ›‘οΈ Helmet Security] --> C3
        F4[🌐 CORS Policy] --> C
    end
    
    subgraph "πŸš€ DevOps Pipeline"
        G[πŸ“± GitHub Repo] --> H[πŸ”„ GitHub Actions]
        H --> H1[πŸ§ͺ CI Testing]
        H --> H2[πŸ—οΈ Build Process]
        H2 --> I[🐳 Docker Images]
        I --> J[πŸ“¦ Docker Hub]
        J --> K[☁️ DigitalOcean]
    end
    
    subgraph "πŸ—οΈ Infrastructure"
        L[πŸ“‹ Terraform] --> M[🌐 Load Balancer]
        L --> N[πŸ–₯️ Droplets]
        L --> O[πŸ”§ Networking]
        P[βš™οΈ Ansible] --> N
        M --> N
        N --> K
    end
    
    style A fill:#e1f5fe
    style B fill:#f3e5f5
    style C fill:#e8f5e8
    style E fill:#fff3e0
    style G fill:#fce4ec
Loading

πŸ”„ Data Flow Architecture

sequenceDiagram
    participant U as πŸ‘€ User
    participant F as βš›οΈ Frontend
    participant A as πŸ”— API
    participant M as πŸ›‘οΈ Middleware
    participant S as 🎯 Service
    participant D as πŸ’Ύ Database
    
    U->>F: Interact with UI
    F->>A: HTTP Request
    A->>M: Security Check
    M->>M: Validate & Authenticate
    M->>S: Process Business Logic
    S->>D: Database Operation
    D->>S: Return Data
    S->>A: Formatted Response
    A->>F: JSON Response
    F->>U: Updated UI
Loading

πŸ—οΈ Microservices-Ready Design

graph LR
    subgraph "🎯 Core Services"
        A1[πŸ‘₯ User Service]
        A2[πŸ“¦ Product Service]
        A3[πŸ›’ Order Service]
        A4[πŸ’³ Payment Service]
    end
    
    subgraph "πŸ”§ Support Services"
        B1[πŸ” Auth Service]
        B2[πŸ“§ Email Service]
        B3[πŸ“Š Analytics Service]
        B4[πŸ” Search Service]
    end
    
    subgraph "🌐 API Gateway"
        C[πŸšͺ Gateway]
    end
    
    C --> A1
    C --> A2
    C --> A3
    C --> A4
    C --> B1
    C --> B2
    C --> B3
    C --> B4
Loading

🌐 Tech Stack

Frontend

  • React.js + Axios + TailwindCSS
  • JWT-based auth
  • CI/CD via GitHub Actions

Backend

  • Node.js (Express.js)
  • MongoDB (Mongoose)
  • Redis (Caching sessions)
  • REST APIs with Swagger Docs
  • Middleware (Helmet, CORS, express-validator)

DevOps

  • GitHub Actions (CI/CD)
  • Terraform (Infra provisioning)
  • Ansible (Server configuration)
  • Docker + Docker Compose (Containerization)
  • DigitalOcean (Deployment)

πŸ“ Project Structure


ExampleCorp/
β”œβ”€β”€ .github/
β”‚   └── workflows/
β”‚       β”œβ”€β”€ ci.yaml                # Continuous Integration workflow
β”‚       └── cd.yaml                # Continuous Deployment workflow
β”‚
β”œβ”€β”€ frontend/                      # Frontend (React) Application
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/            # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ pages/                 # Individual pages/views
β”‚   β”‚   β”œβ”€β”€ styles/                # CSS / styling assets
β”‚   └── package.json               # Frontend dependencies and scripts
β”‚
β”œβ”€β”€ backend/                       # Backend (Node.js + Express)
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ models/                # MongoDB schemas
β”‚   β”‚   β”œβ”€β”€ routes/                # API endpoints
β”‚   β”‚   β”œβ”€β”€ middleware/            # Security, auth, etc.
β”‚   β”‚   β”œβ”€β”€ config/                # DB connection and configs
β”‚   └── package.json               # Backend dependencies and scripts
β”‚
β”œβ”€β”€ infra/                         # Infrastructure as Code (Terraform)
β”‚   β”œβ”€β”€ main.tf                    # Main configuration
β”‚   β”œβ”€β”€ variables.tf               # Input variables
β”‚   └── terraform.tfvars.example  # Sample configuration file
β”‚
└── docs/                          # Project documentation


πŸš€ Quick Start

Prerequisites

  • Node.js 18+ and npm
  • MongoDB (local or Atlas)
  • Git

1. Clone & Install

git clone https://github.com/Shakeelkhuhro/ExampleCorp-Ecommerce.git
cd ExampleCorp-Ecommerce

# Install backend dependencies
cd backend
npm install

# Install frontend dependencies
cd ../frontend
npm install

2. Environment Setup

# Backend environment
cd backend
cp .env.example .env
# Edit .env with your MongoDB URI and JWT secret

# Seed sample data (optional)
npm run seed

3. Development Mode

# Terminal 1 - Start backend (Port 5000)
cd backend
npm run dev

# Terminal 2 - Start frontend (Port 3000)
cd frontend
npm start

4. Access Application


πŸ“š API Documentation

Authentication

POST /api/users/register    # User registration
POST /api/users/login       # User login
GET  /api/users/profile     # Get user profile
PUT  /api/users/profile     # Update profile

Products

GET    /api/products        # Get all products (with filtering)
GET    /api/products/:id    # Get single product
POST   /api/products        # Create product (Admin)
PUT    /api/products/:id    # Update product (Admin)
DELETE /api/products/:id    # Delete product (Admin)

Orders

GET  /api/orders/myorders   # Get user orders
GET  /api/orders/:id        # Get single order
POST /api/orders            # Create new order
PUT  /api/orders/:id/pay    # Mark as paid

🎨 UI Components

Responsive Design

  • πŸ“± Mobile First - Optimized for all devices
  • 🎯 Interactive - Hover effects and animations
  • 🎨 Modern - Gradient themes and glassmorphism
  • β™Ώ Accessible - WCAG compliant

Key Components

  • Header - Navigation with cart and user icons
  • ProductCard - Interactive product display
  • Footer - Links and social media
  • HomePage - Hero section with features
  • ProductsPage - Search and filter functionality

πŸ”§ Development

Available Scripts

Backend

npm start        # Production server
npm run dev      # Development with nodemon
npm run seed     # Populate database with sample data
npm test         # Run tests (when implemented)

Frontend

npm start        # Development server
npm run build    # Production build
npm test         # Run tests
npm run eject    # Eject Create React App (use carefully)

Environment Variables

# Backend (.env)
NODE_ENV=development
PORT=5000
MONGO_URI=mongodb://localhost:27017/examplecorp
JWT_SECRET=your-super-secret-jwt-key
JWT_EXPIRE=30d
FRONTEND_URL=http://localhost:3000

🚒 Deployment

Infrastructure (Terraform)

cd infra
cp terraform.tfvars.example terraform.tfvars
# Edit terraform.tfvars with your cloud provider tokens
terraform init
terraform plan
terraform apply

Configuration (Ansible)

cd ansible
# Configure your inventory and playbooks
ansible-playbook -i inventory deploy.yml

CI/CD (GitHub Actions)

  • Automatic testing on pull requests
  • Build and deploy on main branch
  • Environment-specific deployments

πŸ“Š Key Metrics & Performance

  • ⚑ Load Time: < 2s initial page load
  • πŸ“± Mobile Score: 95+ Lighthouse score
  • πŸ”’ Security: A+ SSL rating
  • πŸ“ˆ Uptime: 99.9% availability target
  • πŸš€ API Response: < 100ms average

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

🧠 Learning Outcomes

  • βœ… Full-Stack Development - React + Node.js + MongoDB
  • βœ… Modern UI/UX - Responsive design principles
  • βœ… API Design - RESTful architecture
  • βœ… Authentication - JWT implementation
  • βœ… Database Design - MongoDB relationships
  • βœ… DevOps Practices - CI/CD, IaC, automation
  • βœ… Security - Input validation, CORS, Helmet
  • βœ… Testing - Unit and integration testing setup

πŸ“„ License

MIT License Β© 2025 Shakeel Khuhro


πŸ™ Acknowledgments

  • Create React App - Frontend bootstrapping
  • Express.js - Backend framework
  • MongoDB - Database solution
  • Font Awesome - Icon library
  • Unsplash - Placeholder images

⭐ Star this repository if you found it helpful!

About

End-to-end DevOps project for a sample e-commerce platform using GitHub Actions, Docker, Terraform, and Ansible.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published