Skip to content

adarshmane146/Amazon-Clone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›’ Amazon Clone – Full Stack E-Commerce Platform

πŸš€ Overview

A full-stack Amazon-inspired e-commerce platform built using:

  • React (Vite)
  • Node.js
  • Express
  • PostgreSQL (pgAdmin 4)
  • JWT Authentication
  • Automated Testing

This project demonstrates a complete e-commerce workflow with relational database design, authentication, cart management, order lifecycle handling, and backend/frontend testing.


✨ Features

πŸ” Authentication

  • User Registration
  • User Login
  • JWT-based Authentication
  • Protected Routes
  • Role-based Access (User/Admin)

πŸ›οΈ E-Commerce Features

  • Product Listing
  • Add to Cart
  • Cart Management (Context API)
  • Checkout Flow
  • Order Placement
  • Order History (My Orders)
  • Admin Order Monitoring

πŸ—„οΈ Database (PostgreSQL)

  • Relational Schema Design
  • Foreign Key Relationships
  • Normalized Tables
  • Referential Integrity
  • Managed using pgAdmin 4

Tables:

  • users
  • products
  • orders
  • order_items

πŸ§ͺ Testing

βœ… Backend Testing

Located in:

backend/tests/
  • Controller unit tests
  • API testing
  • Authentication testing

Run backend tests:

npm test

βœ… Frontend Testing (Playwright)

Located in:

frontend/tests/
  • Shopping flow testing
  • UI validation
  • End-to-end test scenarios

Run frontend tests:

npx playwright test

πŸ—οΈ Project Architecture

AMAZON_CLONE/
β”‚
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ config/
β”‚   β”‚   └── db.js
β”‚   β”œβ”€β”€ controllers/
β”‚   β”œβ”€β”€ middleware/
β”‚   β”œβ”€β”€ routes/
β”‚   β”œβ”€β”€ tests/
β”‚   └── server.js
β”‚
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ context/
β”‚   β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   β”œβ”€β”€ services/
β”‚   β”‚   └── App.jsx
β”‚   β”œβ”€β”€ tests/
β”‚   └── vite.config.js
β”‚
└── README.md

🧠 System Flow

User Flow

User β†’ Register/Login β†’ Browse Products β†’ Add to Cart β†’ Checkout β†’ Place Order β†’ View Order History


βš™οΈ Tech Stack

πŸ–₯️ Frontend

  • React (Vite)
  • Context API
  • Axios
  • Playwright (Testing)

🌐 Backend

  • Node.js
  • Express
  • PostgreSQL
  • pg (Node PostgreSQL driver)
  • JWT
  • REST APIs

πŸ—„οΈ Database

  • PostgreSQL 17
  • Managed via pgAdmin 4

πŸ—„οΈ Database Schema (Simplified)

Users

  • id (PK)
  • name
  • email
  • password
  • role
  • created_at

Products

  • id (PK)
  • name
  • price
  • image
  • created_at

Orders

  • id (PK)
  • user_id (FK β†’ users.id)
  • total
  • status
  • created_at

Order Items

  • id (PK)
  • order_id (FK β†’ orders.id)
  • product_id (FK β†’ products.id)
  • quantity

πŸš€ Getting Started

1️⃣ Clone Repository

git clone https://github.com/adarshmane146/amazon-clone.git
cd amazon-clone

2️⃣ Backend Setup

cd backend
npm install

Create .env file:

PORT=5000
DB_USER=postgres
DB_PASSWORD=your_password
DB_HOST=localhost
DB_PORT=5432
DB_NAME=amazon_db
JWT_SECRET=your_secret_key

Run backend:

npm run dev

Backend runs at:

http://localhost:5000

3️⃣ Frontend Setup

cd frontend
npm install
npm run dev

Frontend runs at:

http://localhost:5173

πŸ“¦ API Endpoints

Authentication

POST /api/auth/register
POST /api/auth/login

Products

GET /api/products

Orders

POST /api/orders
GET /api/orders/myorders

🎯 What This Project Demonstrates

  • Full-stack architecture
  • Relational database design (PostgreSQL)
  • Foreign key relationships
  • Secure authentication (JWT)
  • REST API development
  • State management using Context API
  • Automated backend testing
  • End-to-end frontend testing
  • Clean modular folder structure

πŸ‘¨β€πŸ’» Author

Adarsh Mane B.Tech Computer Science Engineering Full Stack Developer


About

Full-stack Amazon-inspired e-commerce platform built with React (Vite), Node.js, Express, PostgreSQL, JWT authentication, and automated testing.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors