Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tusho7/e-commerce-api

A robust and scalable backend API for a shoes e-commerce platform built with Node.js, Express, and Prisma ORM. This API facilitates user authentication, product management, order processing, and email notifications, leveraging MySQL for data storage and Joi for data validation.
https://github.com/tusho7/e-commerce-api

bcrypt cookie-parser cors expressjs joi-validation mysql-database nodejs nodemailer prisma uuid

Last synced: 24 days ago
JSON representation

A robust and scalable backend API for a shoes e-commerce platform built with Node.js, Express, and Prisma ORM. This API facilitates user authentication, product management, order processing, and email notifications, leveraging MySQL for data storage and Joi for data validation.

Awesome Lists containing this project

README

        

## Shoes E-commerce Website API

### Table of Contents

- [Prerequisites](#Prerequisites)
- [Tech Stack](#Tech-Stack)
- [Getting Started](#Getting-Started)
- [Project Structure](#Project-Structure)

#

### Prerequisites

- Node JS @16.X and up
- npm @8 and up

#

### Tech Stack

- bcrypt @ 5.1.1 - Library for hashing passwords.
- cookie-parser @ 1.4.6 - Middleware for parsing cookies.
- cors @ 2.8.5 - Middleware for enabling CORS in Express.
- dotenv @ 16.4.5 - Zero-dependency module for loading environment variables.
- express @ 4.19.2 - Web framework for Node.js.
- jsonwebtoken @ 9.0.2 - Library for generating JWTs.
- Prisma @ 5.16.2 - Next-generation ORM for Node.js and TypeScript.
- MySQL @ 2.18.1 - MySQL client for Node.js.
- Joi @ 17.13.3 - Data validation library for JavaScript.
- nodemailer @ 6.9.14 - Module for sending emails.
- uuid @ 10.0.0 - Generates UUIDs.

#

### Getting Started

1. First of all you need to clone app repository from github:

```
git clone https://github.com/Tusho7/e-commerce-api
```

2. Next step requires install all dependencies.

```
npm install
```

3. Also you need to create .env file where copy information from .env.example file

```
Create a .env file based on the .env.example template.
Update the variables with your MySQL database connection URI and other configuration settings.
```

4. Run the Prisma migrations to set up the database:

```
npx prisma migrate dev --name init
```

### Project Structure

```
src
├── config # Configuration files
├── controllers # Controller files
├── joi # Joi Validation
├── middlewares # Middleware functions
├── prisma # Database models
├── routes # Router files
├── utils # Utility functions
└── server.js # Main server file

```

### Config: Contains configuration files such as database connection setup.

### Controllers: Handles business logic, interacting with models and returning responses.

### Joi: Contains validations.

### Middlewares: Includes middleware functions for handling requests before they reach the routes.

### Prisma: Defines data models using prisma for interacting with MySQL.

### Routes: Defines API routes and their corresponding controller methods.

### Utils: Utility functions used across the application.

### Server.js: Entry point file that initializes and starts the Express server.

Feel free to adjust the sections and details according to your specific project setup and requirements. This README template provides a clear structure and instructions for setting up and understanding your Shoes E-commerce Website API project.