Skip to content

ShopSphere is a microservices-based e-commerce platform built with Node.js, Express, MongoDB, Redis, RabbitMQ, BullMQ, and gRPC. It features service-to-service communication, async workflows, real-time order tracking, an API gateway, and scalable architecture designed for high-performance applications.

Notifications You must be signed in to change notification settings

shivvv-ang/ShopSphere

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🛍️ Shop Sphere

Shop Sphere is a fully-featured microservices-based e-commerce platform designed for scalability, modularity, and high performance. Built with modern technologies and best practices, the platform consists of decoupled services that interact via RabbitMQ and gRPC, enabling seamless asynchronous and high-speed communication.


🧩 Microservices Architecture

Shop Sphere is composed of the following services:

1. 👤 Customer Service

Responsible for managing customer-related operations:

  • 🔐 Authentication
  • 🛒 Cart & Wishlist
  • 🧾 Order History
  • 🔔 Unread notifications (with a TTL of 1 day)

gRPC Client to Product Service:

  • Fetching personalized product recommendations based on:
    • Wishlist
    • Previous orders

2. 📦 Product Service

Handles everything related to products and sellers:

  • 🛠️ Seller authentication
  • 📋 CRUD operations for products
  • 🔍 Advanced search via MongoDB Aggregation Pipeline
  • 🖼️ Image uploads to AWS S3

gRPC Server:

  • Accepts wishlist/orders from Customer Service
  • Returns personalized recommendations

3. 🛒 Shopping Service

Manages core shopping actions:

  • 🛍️ Add/Remove products from cart
  • 🔄 Order placement & cancellation
  • 💖 Wishlist management
  • 🚚 Simulated deliveries using BullMQ
  • 📡 Real-time delivery tracking via WebSocket (Socket.io)

4. 🌐 API Gateway

Acts as the entry point for all client requests:

  • 🔁 Reverse proxy to route requests to the appropriate services
  • 🛡️ Implements rate limiting for protection against DDoS attacks

🛠️ Tech Stack

🔧 Backend

  • Node.js, Express.js
  • MongoDB, Redis
  • RabbitMQ, BullMQ
  • gRPC, Socket.io
  • AWS SDK (S3)

🎨 Frontend

  • React, Tailwind CSS
  • Redux
  • Socket.io Client

💡 Frontend Optimizations

  • 🧼 DRY Principles
  • ✂️ Code splitting
  • 🖼️ Lazy loading images
  • ⚡ Memoization
  • 🔍 Debounced search
  • 📄 Pagination

⚙️ Environment Variables

🔐 Below are the required .env configurations for each service. Be sure to create a .env file in the root of each microservice directory.

👤 Customer Service
MONGO_DB_URI=
ACCESS_TOKEN_SECRET=
REFRESH_TOKEN_SECRET=
ACCESS_TOKEN_EXPIRY=
REFRESH_TOKEN_EXPIRY=
PORT=
RABBITMQ_URL=
FRONTEND_URL=
RECOMMENDATION_GRPC_ENDPOINT=
📦 Product Service
MONGO_DB_URI=
ACCESS_TOKEN_SECRET=
SELLER_ACCESS_TOKEN_SECRET=
SELLER_ACCESS_TOKEN_EXPIRY=
SELLER_REFRESH_TOKEN_SECRET=
SELLER_REFRESH_TOKEN_EXPIRY=
PORT=
RABBITMQ_URL=
AWS_S3_BUCKET_NAME=
AWS_S3_CLIENT_ACCESS_KEY=
AWS_S3_CLIENT_SECRET_KEY=
AWS_REGION=
🛒 Shopping Service
MONGO_DB_URI=
PORT=
ACCESS_TOKEN_SECRET=
REDIS_HOST=
REDIS_PORT=
REDIS_PASSWORD=
RABBITMQ_URL=
SOCKET_PORT=
FRONTEND_URL=
🌐 API Gateway
REDIS_URL=
CUSTOMER_SERVICE_URL=
PRODUCT_SERVICE_URL=
SHOPPING_SERVICE_URL=
PORT=
FRONTEND_URL=

🧪 Installation & Setup

📦 Prerequisites

Make sure the following tools/services are installed:


🚀 Running the Project

1️⃣ Install Dependencies

cd Customer && npm install
cd Product && npm install
cd Shopping && npm install
cd gateway && npm install

2️⃣ Set Up Environment Variables

  • Create .env files for each service (Customer, Product, Shopping, gateway) as described above.

3️⃣ Start Redis & RabbitMQ Servers ⚠️

  • Use WSL, Ubuntu, or Docker depending on your environment to launch Redis and RabbitMQ.

4️⃣ Start Backend Services

npm run start
# Run this inside each service directory

5️⃣ Start the Frontend

cd frontend
npm install
npm run dev

6️⃣ Start gRPC Server (Product Service)

Make sure your package.json in src/Product has the following:

"scripts": {
  "start:grpc": "node src/grpcServer.js"
}

Then run:

cd src/Product
npm run start:grpc

7️⃣ Start BullMQ Worker (Shopping Service)

Check the script in src/Shopping/package.json:

"scripts": {
  "start:bullmq": "nodemon src/Queue/worker.js"
}

Then run:

cd src/Shopping
npm run start:bullmq

📌 Project Highlights

Modular Microservice Architecture
📡 gRPC for fast, type-safe inter-service communication
📨 RabbitMQ for decoupled message brokering
📷 AWS S3 for secure image storage
Real-Time Updates using Socket.io
🛡️ API Gateway for routing, rate limiting, and centralized security
⏱️ BullMQ for background jobs like order delivery simulation


🔮 Future Enhancements

  • 📊 Admin dashboard with analytics
  • 🧠 Smarter product recommendations with ML
  • 💳 Integrate payment gateways (Stripe, Razorpay)
  • 🐳 Full CI/CD pipeline with Docker & Kubernetes

🤝 Contributing

Contributions are welcome! 💡

  • Fork this repository
  • Create a feature branch
  • Open a PR with your changes
  • For major updates, open an issue first to discuss

Let’s build something amazing together! ✨


Happy Coding! 🚀

About

ShopSphere is a microservices-based e-commerce platform built with Node.js, Express, MongoDB, Redis, RabbitMQ, BullMQ, and gRPC. It features service-to-service communication, async workflows, real-time order tracking, an API gateway, and scalable architecture designed for high-performance applications.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages