Skip to content

This repository contains a fully functional E-commerce API server built with Node.js and Express.js. It provides authentication, user management, product handling, order processing, and security features. The API uses MongoDB as the database and integrates various middleware and third-party services for enhanced functionality.

Notifications You must be signed in to change notification settings

MF-Vv/ECOMMERCE-API-SERVER

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ecommerce API Server

Project Overview

This repository contains a fully functional E-commerce API server built with Node.js and Express.js. It provides authentication, user management, product handling, order processing, and security features. The API uses MongoDB as the database and integrates various middleware and third-party services for enhanced functionality.

Tech Stack

  • Backend Framework: Express.js 4.21.1
  • Database: MongoDB (via Mongoose 8.8.0)
  • Security: Helmet 8.0.0, Express Rate Limit 7.4.1, XSS-Clean 0.1.4, Mongo Sanitize 2.2.0
  • Auth: JWT 9.0.2, BcryptJS 2.4.3
  • File Uploads: express-fileupload 1.5.1
  • Logging: Morgan 1.10.0
  • Development Tools: Nodemon 3.1.7

Features

  • User Authentication & Authorization (JWT, hashed passwords)
  • Role-based Access Control (Admin, Customer)
  • Product Management (Create, Read, Update, Delete)
  • Review & Ratings System
  • Order & Checkout Flow (Integrated with Fake Stripe)
  • Secure API (Rate limiting, Input sanitization, XSS protection)
  • File Upload Handling (For product images)
  • Logging & Error Handling

Installation & Setup

Prerequisites

  • Node.js (v16 or later recommended)
  • MongoDB (Local or Cloud-based like MongoDB Atlas)

Setup

  1. Clone the repository:

    git clone https://github.com/MF-Vv/ECOMMERCE-API-SERVER.git
    cd ECOMMERCE-API-SERVER
  2. Install dependencies:

    npm install
  3. Create a .env file and configure environment variables:

    MONGO_URL=your_mongodb_connection_string
    JWT_SECRET=your_jwt_secret
    COOKIE_SECRET=your_cookie_secret
    JWT_LIFETIME= 1d
    NODE_ENV=production
  4. Start the development server:

    npm run dev
  5. Start in production mode:

    npm start

API Documentation

For detailed API documentation and testing, visit the Postman collection: Postman API Documentation

Deployment:

This API is deployed on Render:

https://ecommerce-api-server-041g.onrender.com

Important Notice:

🚨 Free-tier Limitation: Since this API is hosted on a free Render account, the server may spin down due to inactivity, causing delays of up to 50 seconds when handling requests. Consider using a paid plan for better performance.


Happy Coding! 🚀

About

This repository contains a fully functional E-commerce API server built with Node.js and Express.js. It provides authentication, user management, product handling, order processing, and security features. The API uses MongoDB as the database and integrates various middleware and third-party services for enhanced functionality.

Topics

Resources

Stars

Watchers

Forks