Skip to content

A feature-rich, scalable e-commerce backend (and eventually full-stack) platform that mimics core Amazon functionality.

Notifications You must be signed in to change notification settings

eddyseed/AmazonClone

Repository files navigation

Amazon Clone (Backend Model)

Scalable E-Commerce Backend with Microservices

This repository contains the backend model of an Amazon E-Commerce clone built using Nest.js microservices, powered by PostgreSQL, Redis for caching, and delivered via Docker.
It was originally planned as a full-stack project, but is now focused purely on the backend system design to ensure scalability and reliability.


📌 Services Implemented

  1. Auth Service – Handles user authentication, authorization, and token management (JWT).
  2. Product Service – Manages product catalog, details, and availability.
  3. Cart Service – Uses the product-service to fetch products and manage carts.
    🗄️ Saves cart data in cache memory using Redis for high performance.
  4. API Gateway – Routes client requests to respective microservices via Nginx.

⚙️ Tech Stack & Versioning

🖥 Backend Frameworks

  • Nest.js 11.0.1
  • Node.js 20.x

🛠 Libraries & Tools

  • Class Validator & Class Transformer
  • TypeORM (with PostgreSQL support)
  • Bcrypt.js (Password Hashing)
  • Dotenv (Environment Configurations)
  • JSON Web Tokens (JWT Authentication)

⚓ Database & Caching

  • PostgreSQL 17.4
  • Redis (for session & cart caching)
  • Firestore (NoSQL, optional for analytics / secondary storage)

🛠 Dev Operations

  • Docker 28.0.4
  • Nginx (Reverse Proxy & Load Balancer)
  • GitHub Actions (CI/CD)

⚒ Other Tools

  • DBeaver (DB management)

🚀 Setup & Configuration (Local Machine)

1. Install Node.js

Verify installation:

node -v
npm -v

## Configuration for Local Machine

### 1. Download and Install [Node.js](https://nodejs.org/en/download)

- Go to the official Node.js website by clicking the link above.

- Download the LTS (Long-Term Support) version for stability.

- Follow the installation instructions based on your operating system:

 `Windows/macOS`: Run the installer and follow the setup wizard.

`Linux`: Use your package manager (`apt`, `dnf`, or `yum`) or download the binaries directly.


### 📦 Debian/Ubuntu (APT)
```bash
sudo apt update
sudo apt install nodejs npm -y
  • To get the latest version, it's better to use NodeSource:
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt install -y nodejs

📦 Fedora (DNF)

sudo dnf install nodejs -y
  • To get the latest version, it's better to use NodeSource:
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo dnf install -y nodejs

📦 RHEL/CentOS (YUM)

sudo yum install nodejs -y
  • To get the latest version, it's better to use NodeSource:
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo yum install -y nodejs

macOS: Recommended: Using Homebrew

brew install node


Verify installation by running the following commands in your terminal:

node -v
npm -v


2. Download and Install Docker

(Docker part is not yet implemented in this project, but you can set it up for containerization and deployment.)

Verify installation by running the following commands in your terminal:

docker --v

or

docker --version


3. Configure .env.sample for PostgreSQL

Change the secret as per your database keys:

POSTGRES_USER=
POSTGRES_PASSWORD=
POSTGRES_DB=amazon_clone
DATABASE_URL=
JWT_SECRET=

✅ Now, we are good to build an image of our application and run the instance of our application.

Open Terminal or Powershell (Windows)

Run the following command:

docker-compose up -d --build

Edit typeorm.config.ts and set

synchronize: true


🔗 References to Stacks Used

  1. Node.js - https://nodejs.org/en/download
  2. Next.js - https://nextjs.org/docs/app/getting-started/installation
  3. React.js - https://react.dev/learn
  4. Tailwind CSS - https://tailwindcss.com/
  5. Lightning CSS - https://lightningcss.dev/docs.html
  6. Nest.js - https://docs.nestjs.com/
  7. PostgreSQL - https://www.postgresql.org/docs/
  8. Firestore - https://firebase.google.com/docs/firestore/quickstart
  9. Docker - https://docs.docker.com/
  10. nginx - http://nginx.org/en/docs/beginners_guide.html
  11. ShadCN/UI - https://ui.shadcn.com/docs/installation/next
  12. Vercel - https://vercel.com/

About

A feature-rich, scalable e-commerce backend (and eventually full-stack) platform that mimics core Amazon functionality.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published