Skip to content

A robust and scalable e-commerce backend built with Node.js, designed to support real-world online store operations. This project implements secure authentication, efficient data handling, and high-performance architecture using modern backend technologies.

Notifications You must be signed in to change notification settings

anzirish/Glimpse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🛍️ Glimpse E-commerce Backend

A robust and scalable e-commerce API built with modern technologies

Live Demo Status

🛠️ Built With

TypeScript Node.js Express MongoDB Redis JWT


🌟 Live API

Base URL: https://glimpse-backend-9gln.onrender.com

Health Check: https://glimpse-backend-9gln.onrender.com/health

✨ Features

  • 🔐 Authentication & Authorization: JWT-based authentication with refresh tokens
  • 📦 Product Management: CRUD operations for products with search and filtering
  • 🛒 Shopping Cart: Persistent cart management with Redis caching
  • 📋 Order Processing: Complete order lifecycle management
  • Review System: Product reviews and ratings
  • 🛡️ Rate Limiting: Redis-backed rate limiting for API protection
  • Caching: Redis caching for improved performance
  • 📧 Email Notifications: Nodemailer integration for transactional emails

🚀 Tech Stack

⚙️ Backend

Node.js + TypeScript

Express.js Framework

💾 Database

MongoDB + Mongoose

Redis Cache

🔐 Security

JWT Authentication

Rate Limiting + Helmet

🏁 Getting Started

📋 Prerequisites

  • Node.js (v16 or higher)
  • MongoDB
  • Redis

📥 Installation

  1. Clone the repository:
git clone <repository-url>
cd glimpse-backend
  1. Install dependencies:
npm install
  1. Configure environment variables:
cp .env.example .env

Edit .env with your configuration:

  • Database connection strings
  • JWT secrets
  • Redis URL
  • Email credentials
  • Admin secret
  1. Build the project:
npm run build
  1. Start the server:
# Development
npm run dev

# Production
npm start

📡 API Endpoints

Base URL: https://glimpse-backend-9gln.onrender.com/api/v1

🔐 Authentication

  • POST /auth/register - Register new user
  • POST /auth/login - User login
  • POST /auth/refresh - Refresh access token
  • POST /auth/logout - User logout

📦 Products

  • GET /products - Get all products (with filters)
  • GET /products/:id - Get product by ID
  • POST /products - Create product (admin)
  • PUT /products/:id - Update product (admin)
  • DELETE /products/:id - Delete product (admin)

🛒 Cart

  • GET /cart - Get user cart
  • POST /cart - Add item to cart
  • PUT /cart/:itemId - Update cart item
  • DELETE /cart/:itemId - Remove item from cart

📋 Orders

  • GET /orders - Get user orders
  • GET /orders/:id - Get order by ID
  • POST /orders - Create new order
  • PUT /orders/:id - Update order status (admin)

⭐ Reviews

  • GET /reviews/product/:productId - Get product reviews
  • POST /reviews - Create review
  • PUT /reviews/:id - Update review
  • DELETE /reviews/:id - Delete review

🚀 Deployment

This application is deployed on Render.

🔧 Environment Variables on Render

Make sure to set all required environment variables in your Render dashboard:

  • MONGODB_URI_PROD - Production MongoDB connection string
  • REDIS_URL - Redis connection URL
  • JWT_SECRET, JWT_REFRESH_SECRET, JWT_RESET_SECRET
  • EMAIL_USER, EMAIL_PASS
  • ADMIN_SECRET
  • FRONTEND_URL
  • NODE_ENV=production

🔨 Build Command

npm install && npm run build

▶️ Start Command

npm start

📁 Project Structure

src/
├── config/         # Configuration files (DB, Redis)
├── controllers/    # Route controllers
├── middleware/     # Custom middleware (auth, rate limiting, error handling)
├── models/         # Mongoose models
├── routes/         # API routes
├── services/       # Business logic
├── types/          # TypeScript type definitions
├── utils/          # Utility functions (cache, helpers)
└── app.ts          # Application entry point

🔒 Security Features

  • 🛡️ Helmet for security headers
  • 🌐 CORS configuration
  • ⏱️ Rate limiting with Redis
  • 🔑 JWT token authentication
  • 🔐 Password hashing with bcryptjs
  • ✅ Input validation and sanitization

💡 Made with ❤️ for E-commerce

License Deployed on Render

API DocumentationReport BugRequest Feature

About

A robust and scalable e-commerce backend built with Node.js, designed to support real-world online store operations. This project implements secure authentication, efficient data handling, and high-performance architecture using modern backend technologies.

Topics

Resources

Stars

Watchers

Forks