Skip to content

EurusDevSec/ecommerce_Microservice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

85 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

E-Commerce Microservices

CI - Pull Request CD - Deploy to GKE License: MIT Contributors

A scalable e-commerce platform built with microservices architecture on Google Cloud Platform (GCP). This project demonstrates modern cloud-native development practices with automated CI/CD, container orchestration, and multi-database support.

πŸš€ Live Demo

🌐 Public API Endpoint: http://34.143.235.74

πŸ“± Quick Test:

curl http://34.143.235.74/health
curl http://34.143.235.74/products

Status: 🟒 DEPLOYED & RUNNING on Google Kubernetes Engine (GKE)

πŸ“‹ Table of Contents

✨ Features

  • Microservices Architecture: Independently deployable services
  • Multi-Database Support: PostgreSQL for relational data, Firestore for NoSQL
  • Automated CI/CD: GitHub Actions with comprehensive testing
  • Container Orchestration: Kubernetes with auto-scaling and self-healing
  • API Gateway: Centralized API management
  • Monitoring & Logging: Cloud-native observability
  • Security: JWT authentication and secure communication

πŸ—οΈ Architecture

Core Services

Service Technology Database Description
Users Service Node.js/Express PostgreSQL User management, authentication
Products Service Node.js/Express PostgreSQL Product catalog, inventory
Orders Service Node.js/Express Firestore Shopping cart, order processing

Infrastructure Diagram

System Architecture Overview

E-commerce Architecture

CI/CD Pipeline Flow

CI/CD Flow

πŸ› οΈ Technology Stack

Backend & Runtime

  • Node.js 18+ with Express.js
  • Docker for containerization
  • Kubernetes (GKE) for orchestration

Databases

  • Cloud SQL (PostgreSQL) for relational data
  • Firestore for document-based data

Database Architecture

Database Diagram

Cloud Services

  • Google Cloud Platform
    • GKE (Kubernetes Engine)
    • Cloud SQL
    • Firestore
    • Cloud Build
    • Artifact Registry
    • Cloud Monitoring

DevOps & CI/CD

  • GitHub Actions for automation
  • kubectl for cluster management
  • Docker Compose for local development

οΏ½ Security Architecture

Security Architecture

οΏ½πŸš€ Quick Start

Prerequisites

  • Google Cloud SDK (gcloud CLI)
  • Docker Desktop
  • kubectl configured for GKE
  • Node.js 18+
  • Git

1. Clone the Repository

git clone https://github.com/EurusDFIR/ecommerce_Microservice.git
cd ecommerce_Microservice

2. Configure Google Cloud

# Authenticate
gcloud auth login

# Set project
gcloud config set project ecommerce-micro-0037

# Configure kubectl for GKE cluster
gcloud container clusters get-credentials my-ecommerce-cluster --region asia-southeast1

3. Deploy to GKE

# Deploy all services
kubectl apply -f infrastructure/k8s/

# Check deployment status
kubectl get pods -n ecommerce
kubectl get services -n ecommerce

4. Test the APIs

# Health check
curl http://34.143.235.74/health

# Get products
curl http://34.143.235.74/products

# Get categories
curl http://34.143.235.74/categories

πŸ“š API Documentation

Sequence Diagram

API Sequence Diagram

Public Endpoints (LoadBalancer)

Method Endpoint Description
GET /health Service health check
GET /products List all products
GET /products/{id} Get product details
GET /categories List product categories
GET /search?q={query} Search products

Internal Endpoints (ClusterIP)

Service Endpoint Description
Users /auth/register User registration
Users /auth/login User authentication
Users /users/me Get user profile
Orders /cart Shopping cart operations
Orders /orders Order management

Note: Users and Orders services are internal only. For full API testing, use Postman collection in postman/ directory.

πŸ’» Development

Local Development Setup

# Install dependencies for all services
cd services/users-service && npm install
cd ../products-service && npm install
cd ../orders-service && npm install

# Start local databases
docker-compose up -d postgres firestore-emulator

# Run services locally
npm run dev  # in each service directory

Project Structure

ecommerce_Microservice/
β”œβ”€β”€ docs/                     # Documentation
β”‚   β”œβ”€β”€ architecture.md       # Architecture details
β”‚   └── ARCHITECTURE_DIAGRAM.md # Visual diagrams
β”œβ”€β”€ services/                 # Microservices
β”‚   β”œβ”€β”€ users-service/        # User management
β”‚   β”œβ”€β”€ products-service/     # Product catalog
β”‚   └── orders-service/       # Order processing
β”œβ”€β”€ infrastructure/           # Infrastructure as Code
β”‚   └── k8s/                  # Kubernetes manifests
β”œβ”€β”€ postman/                  # API testing collections
β”œβ”€β”€ scripts/                  # Utility scripts
└── README.md

Testing

# Run unit tests
npm test

# Run integration tests
npm run test:integration

# Run E2E tests
npm run test:e2e

🀝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Workflow

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

Code Standards

  • Follow ESLint configuration
  • Write tests for new features
  • Update documentation as needed
  • Ensure all CI checks pass

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ‘₯ Authors

This project was developed by:

  • LΓͺ VΔƒn HoΓ ng
  • Nguyα»…n TuαΊ₯n Việt
  • Diệp Đẑi LΓͺ HoΓ i
  • Nguyα»…n Ngọc HΓ²a
  • ĐoΓ n Thanh PhΓΊc
  • Nguyα»…n VΔƒn Linh

For detailed contributor information, see CONTRIBUTORS.md


Built with ❀️ on Google Cloud Platform

Last updated: October 12, 2025

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 6