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

58 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 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
  • πŸ“‹ Order Processing: Complete order lifecycle management
  • ⭐ Review System: Product reviews and ratings
  • πŸ›‘οΈ Rate Limiting: In-memory rate limiting for API protection
  • ⚑ Caching: In-memory caching for improved performance
  • πŸ“§ Email Notifications: Nodemailer integration for transactional emails

πŸš€ Tech Stack

βš™οΈ Backend

Node.js + TypeScript

Express.js Framework

πŸ’Ύ Database

MongoDB + Mongoose

In-Memory Cache

πŸ” Security

JWT Authentication

Rate Limiting + Helmet

🏁 Getting Started

πŸ“‹ Prerequisites

  • Node.js (v16 or higher)
  • MongoDB

πŸ“₯ 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
  • 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/signup - 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
  • 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)
β”œβ”€β”€ 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 in-memory store
  • πŸ”‘ JWT token authentication
  • πŸ” Password hashing with bcryptjs
  • βœ… Input validation and sanitization

πŸ’‘ Made with ❀️ for E-commerce

License Deployed on Render

API Documentation β€’ Report Bug β€’ Request 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

Contributors