https://github.com/gichbuoy/e-commerce-backend-api
E-Commerce App with REST API | Node | MongoDB | Advanced Authentication
https://github.com/gichbuoy/e-commerce-backend-api
api ecommerce-api express javascript mvc-architecture nodejs
Last synced: about 2 months ago
JSON representation
E-Commerce App with REST API | Node | MongoDB | Advanced Authentication
- Host: GitHub
- URL: https://github.com/gichbuoy/e-commerce-backend-api
- Owner: Gichbuoy
- Created: 2024-01-23T14:15:55.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-06T22:02:28.000Z (over 2 years ago)
- Last Synced: 2025-06-05T00:14:38.171Z (about 1 year ago)
- Topics: api, ecommerce-api, express, javascript, mvc-architecture, nodejs
- Language: JavaScript
- Homepage:
- Size: 1.64 MB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## E-Commerce Backend API
- This is a backend API for an E-Commerce platform built using Node.js. It provides various endpoints for managing products, orders, users, and authentication.
## Features
- **Product Management**: CRUD operations for managing products.
- **Order Management**: Create, read, update, and delete orders.
- **User Management**: Register, login, and manage user accounts.
- **Authentication**: JWT-based authentication for securing API endpoints.
- **Validation**: Input validation and error handling.
- **Authorization**: Role-based access control for restricting endpoints based on user roles.
- **Database**: Integration with MongoDB for data storage.
## Technologies Used
- Node.js
- Express.js
- MongoDB
- Mongoose
- JSON Web Tokens (JWT) for authentication
- bcrypt for password hashing
- Helmet for security headers
## Installation
1. Clone the repository:
```
git clone https://github.com/Gichbuoy/E-Commerce-Backend-API.git
```
2. Navigate to the project directory:
```
cd E-Commerce-Backend-API
```
3. Install dependencies
```
npm install
```
4. Set up environment variables by creating a `.env` file and adding the following variables:
```
PORT=3000
MONGOCOMPASS=
JWT_SECRET=
```
5. Start the server
```
npm start
```
## Usage
Once the server is running, you can access the API endpoints using tools like [Postman](https://learning.postman.com/docs/introduction/overview/) or [Insomnia](https://docs.insomnia.rest/) or directly from the [Frontend application](https://github.com/Gichbuoy/E-commerce-website).
## Screenshots
`Connection to mongoDB`
.png)
`User Login`
.png)
`Registering new User`
.png)
`Blocking a User`
.png)
`Refresh Token for Authentication`
.png)
`Create new Product`
.png)
`Declare the data schema for MongoDB Model`
.png)
`Products fetched from mongoDB Compass`
.png)
`Get Products by ID`
.png)
`Get All Products`
.png)
## API Endpoints
For detailed information about the available endpoints, refer to the [API Documentation](./API_DOCUMENTATION.md).
## Authentication
Authentication is required for certain endpoints. To authenticate, include a JWT token in the request headers:
To obtain a JWT token, you must first register as a user and then login using your credentials.
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.