This project offers a robust Node.js API for building an e-commerce application, empowering you to create a feature-rich online store.
- TypeScript: Enhances code safety and maintainability through strong typing.
- Express: Leverages the versatility of Express for handling API requests and responses efficiently.
- TypeORM: Simplifies database interactions and object-relational mapping for seamless data management (supports MySQL).
- CORS Middleware (
cors
): Enables Cross-Origin Resource Sharing (CORS) to facilitate communication with frontend applications from different domains.
Prerequisites:
- Node.js and npm (or yarn) installed on your system.
Installation:
-
Clone this repository:
git clone [https://github.com/your-username/storefy.git](https://github.com/your-username/storefy.git)
-
Navigate to the project directory:
cd storefy
-
Install dependencies:
npm install
-
Create .env file for development with the following variables
- PORT=
- DB_NAME=
- DB_HOST=
- DB_ROOT_USER=
- DB_ROOT_PASSWORD=
- DB_USER=
- DB_PASSWORD=
- DB_PORT=
-
For production create production.env file with the same variables
-
Run migrations
npm run m:run
-
Run your your proyect
npm start:dev
Or
npm start:prod
-
Customers are connected to Purchases with a one-to- many (1:N) relationship. This means that one customer can make many purchases.
-
Products are connected to Purchases with a many-to-many (N:N) relationship. This means that one product can be purchased by many customers, and one customer can purchase many products.
-
Custom purchases are indicated by a one-to-one (1:1) relationship between Customers and Products. This could represent a scenario where a customer has a custom order for a product.
Essentially, the purchasing process depicted illustrates how customers can purchase various products, with the possibility of customization.