Skip to content

KarthickRamAlagar/FastCommerce---Backend-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FAST COMMERCE -- PRODUCTION GRADE E-COMMERCE BACKEND SYSTEM

Fast Commerce Banner

High-Performance E-Commerce Backend built using Express.js, PostgreSQL, Redis, JWT Authentication, Inventory Management, Cart Reservation System, Checkout, Orders, and Cashfree Payments.


📌 Overview

Fast Commerce is a production-grade backend architecture designed for modern e-commerce applications.

The system focuses on:

  • Scalability
  • Inventory Accuracy
  • Secure Authentication
  • High Performance Caching
  • Payment Integration
  • Auditability
  • Modular Architecture

The project demonstrates how enterprise commerce systems handle:

Authentication
Products
Inventory
Cart Reservation
Checkout
Orders
Payments
Caching
Analytics
Admin Operations

🛠 Technology Stack

Layer Technology
Runtime Node.js
Framework Express.js
Database PostgreSQL
Cache Layer Redis
Authentication JWT
Authorization RBAC
Validation Zod
API Documentation Swagger
Image Storage Cloudinary
Email Service Resend
Security Helmet
Rate Limiting Express Rate Limit
Payments Cashfree
Password Hashing bcrypt

🏗 System Architecture

Fast Commerce Architecture

📦 Modules

Authentication

  • User Registration
  • Login
  • Logout
  • Refresh Tokens
  • OTP Verification
  • Password Reset
  • JWT Authentication
  • Redis Session Layer

Admin Management

  • Get Users
  • User Statistics
  • User Role Updates
  • Soft Delete Users

Product Catalog

  • Create Products
  • Update Products
  • Delete Products
  • Product Search
  • Product Listing

Product Media

  • Cloudinary Upload
  • Product Images
  • Product Videos
  • Primary Image Management

Inventory Management

Tracks:

Total Stock
Available Stock
Reserved Stock
Sold Stock

Inventory Formula:

available_stock =
total_stock
- reserved_stock
- sold_stock

Inventory Movements

Tracks every stock operation:

STOCK_IN
STOCK_OUT
RESERVED
RELEASED
SOLD
RETURNED
DAMAGED
ADJUSTMENT

Cart System

Features:

  • Add Item
  • Update Quantity
  • Remove Item
  • Clear Cart
  • Cart Summary

Integrated with Inventory Reservation.


Checkout

Features:

  • Cart Validation
  • Inventory Validation
  • Price Validation
  • Checkout Summary
  • Order Preparation

Orders

Features:

  • Order Creation
  • Order Items
  • Order Status Tracking
  • Order History
  • Order Management

Payments

Integrated with:

Cashfree Payment Gateway

Supports:

  • Payment Initiation
  • Payment Verification
  • Webhooks
  • Failed Payments
  • Successful Payments
  • Payment History

🔐 Authentication Architecture

User Login
     │
     ▼
Generate JWT Access Token
     │
     ▼
Generate Refresh Token
     │
     ▼
Store Refresh Token in Redis
     │
     ▼
Protected API Access

🛒 Cart → Checkout → Order → Payment Flow

Add Product To Cart
          │
          ▼

Reserve Inventory
          │
          ▼

Create Checkout
          │
          ▼

Validate Inventory
          │
          ▼

Create Order
          │
          ▼

Initiate Cashfree Payment
          │
          ▼

Payment Success
          │
          ▼

Convert Reserved → Sold
          │
          ▼

Order Completed

📊 Inventory Lifecycle

Admin Adds Stock
        │
        ▼

STOCK_IN

        │
        ▼

Customer Adds To Cart

        │
        ▼

RESERVED

        │
        ▼

Checkout Success

        │
        ▼

SOLD

        │
        ▼

Order Delivered

🗄 Database Design

Core Tables

Table
users
products
product_media
inventory
inventory_movements
carts
cart_items
checkouts
checkout_items
orders
order_items
payments

⚡ Redis Usage

Used For:

Refresh Tokens

OTP Storage

Rate Limiting

Product Cache

Inventory Cache

Cart Cache

Analytics Cache

Session Management

📖 API Documentation

Swagger Documentation:

http://localhost:8000/api-docs/RedisImplementation/

🚀 Installation

Clone Repository

git clone https://github.com/KarthickRamAlagar/FastCommerce---Backend-System

Install Dependencies

npm install

Environment Setup

PORT=8000

DATABASE_URL=

JWT_SECRET=

JWT_REFRESH_SECRET=

REDIS_URL=

CLOUDINARY_CLOUD_NAME=
CLOUDINARY_API_KEY=
CLOUDINARY_API_SECRET=

RESEND_API_KEY=

CASHFREE_APP_ID=
CASHFREE_SECRET_KEY=

Run Development Server

npm run dev

📈 Current Features Completed

✅ Authentication

✅ RBAC

✅ Redis Integration

✅ Product Catalog

✅ Product Media

✅ Inventory Management

✅ Inventory Movements

✅ Cart System

✅ Checkout

✅ Orders

✅ Payments (Cashfree)

✅ Swagger Documentation

✅ Rate Limiting

✅ Cloudinary Integration

🎯 Future Improvements

Wishlist Module

Coupon System

Address Management

Returns & Refunds

Notification Service

Admin Dashboard

Microservices Migration

Docker Deployment

CI/CD Pipeline

Queue Processing (BullMQ)

👨‍💻 Author

Karthick Ramalagar

Backend Developer

Built for learning scalable e-commerce backend architecture using:

Express.js
PostgreSQL
Redis
JWT
Cashfree
Swagger
Cloudinary

About

Fast Commerce — A production-grade e-commerce backend built with Express.js, PostgreSQL, Redis, JWT, Cloudinary, and Cashfree, featuring inventory management, cart reservation, checkout, orders, payments, RBAC, and Swagger APIs.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors