You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Secure user authentication with token-based system
π₯ Role-Based Access Control
Admin, Vendor, and Customer roles
π¦ Product Management
Full CRUD operations with advanced filtering
π Shopping Cart
Complete cart management system
π Category Management
Organize products by categories
π€ User Management
Admin user management capabilities
π§ Email Notifications
Password reset and welcome emails
π API Documentation
Complete Swagger/OpenAPI documentation
π Advanced Search
Text search and filtering capabilities
π Analytics
Product statistics and reporting
π οΈ Tech Stack
Backend
Database
Authentication & Security
Documentation & Testing
Development Tools
API Endpoints
Authentication (6 endpoints)
Method
Endpoint
Description
Access
POST
/api/auth/register
User registration
Public
POST
/api/auth/login
User login
Public
POST
/api/auth/forgot-password
Request password reset
Public
PATCH
/api/auth/reset-password/:token
Reset password
Public
PATCH
/api/auth/change-password
Change password
Authenticated
GET
/api/auth/profile
Get user profile
Authenticated
π Categories (5 endpoints)
Method
Endpoint
Description
Access
GET
/api/categories
Get all categories
Public
GET
/api/categories/:id
Get category by ID
Public
POST
/api/categories
Create category
Admin
PUT
/api/categories/:id
Update category
Admin
DELETE
/api/categories/:id
Delete category
Admin
Products (8 endpoints)
Method
Endpoint
Description
Access
GET
/api/products
Get all products with pagination/filtering
Public
GET
/api/products/stats
Get product statistics
Public
GET
/api/products/top
Get top 10 most expensive products
Public
GET
/api/products/low-stock
Get low stock products
Public
GET
/api/products/:id
Get product by ID
Public
POST
/api/products
Create product
Vendor/Admin
PUT
/api/products/:id
Update product
Owner/Admin
DELETE
/api/products/:id
Delete product
Owner/Admin
Users (5 endpoints)
Method
Endpoint
Description
Access
GET
/api/users
Get all users
Admin
GET
/api/users/:id
Get user by ID
Admin
POST
/api/users
Create user
Admin
PUT
/api/users/:id
Update user
Admin
DELETE
/api/users/:id
Delete user
Admin
π Cart (5 endpoints)
Method
Endpoint
Description
Access
GET
/api/cart/:userId
Get cart by user ID
Authenticated
POST
/api/cart/:userId/items
Add item to cart
Authenticated
PUT
/api/cart/:userId/items/:id
Update cart item
Authenticated
DELETE
/api/cart/:userId/items/:id
Remove item from cart
Authenticated
DELETE
/api/cart/:userId
Delete entire cart
Authenticated
Installation
Prerequisites
Setup Steps
# 1οΈβ£ Clone the repository
git clone https://github.com/ornella-beza/API-ECOMMERCE.git
cd API-ECOMMERCE
# 2οΈβ£ Install dependencies
npm install
# 3οΈβ£ Create environment file
cp .env.example .env
# 4οΈβ£ Start MongoDB service# Make sure MongoDB is running on your system# 5οΈβ£ Run the application
npm run dev
npm run dev # π₯ Start development server with hot reload
npm start # π Start production server
npm run build # ποΈ Build TypeScript to JavaScript
π€ Contributing
We welcome contributions! Here's how you can help:
Fork the repository
Create a feature branch (git checkout -b feature/amazing-feature)
Commit your changes (git commit -m 'Add amazing feature')
Push to the branch (git push origin feature/amazing-feature)
Open a Pull Request
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π Contact
SIMBI BEZA Ornella
β If you found this project helpful, please give it a star!
About
A complete Node.js/TypeScript REST API for e-commerce applications with authentication, role-based access control, and comprehensive CRUD operations.