Skip to content

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

 
 
 

Contributors

Languages