Welcome to the E-commerce Shoes Shop project! This is a comprehensive backend system for an online shoe store.
- NodeJS - Express - PostgreSQL - Sequelize -Dockerize
demo-eco.mp4
- User Authentication: Secure session-based authentication.
- Profile Management: Users can update their profiles and change their passwords.
- Product Interaction: Users can like products and add them to their basket.
- Basket Management: Users can view and manage the products in their basket.
- Database Design: A well-designed and normalized database following best practices.
- and more ...
The database is designed with best practices and normalization rules in mind. Below is the Entity-Relationship Diagram (ERD):
The database design for this E-commerce Shoes Shop project showcases several key advantages due to its adherence to normalization principles:
-
Normalized Schema: The schema is designed to be in at least Third Normal Form (3NF), minimizing data redundancy and ensuring data integrity. Each entity is represented by a table with only related data stored in it.
-
Scalability: The design supports easy addition of new products, categories, and brands, and can be extended with new features without restructuring the database.
-
Clear Relationships: Relationships between entities (e.g., users, products, categories) are well-defined using foreign keys, ensuring referential integrity and data consistency.
-
Efficient Performance: By reducing redundant data, the design enhances query performance. Proper indexing on frequently queried columns can further boost performance.
-
Data Integrity: Foreign keys and constraints ensure that the data remains consistent and valid. For example, each
product
must be associated with a validbrand
. -
Modular Design: The separation of data into different tables (e.g.,
user_account
,product
,variant
,category
) makes the database easier to manage and understand.
- 1NF
- 2NF
- 3NF
This design ensures an efficient, consistent, and scalable database for the E-commerce Shoes Shop application.
Please note that the purchasing functionality is not yet implemented in this project.
Here's a quick look at the project structure:
project-root/
├── controllers/
│ ├── authController.js
│ ├── errorController.js
│ ├── productController.js
│ ├── userController.js
│ └── ...other controllers
├── dev-data/
│ ├── data/
│ └── mockData.js
├── models/
│ ├── associations.js
│ ├── db.js
│ ├── productModel.js
│ ├── userModel.js
│ └── ...other models
├── public/
├── routes/
│ ├── authRoutes.js
│ ├── productRoutes.js
│ ├── userRoutes.js
│ ├── basketRoutes.js
│ ├── likeRoutes.js
│ └── viewRoutes.js
├── utils/
│ ├── AppError.js
│ ├── catchAsync.js
│ └── errorHandler.js
├── views/
│ └── ...view templates
├── .eslintrc.json
├── .gitignore
├── .prettierrc
├── app.js
├── config.env
├── example.env
├── package-lock.json
├── package.json
└── server.js
To set up the project locally, follow these steps:
To set up the project using Docker, follow these steps:
-
Clone the repository:
git clone https://github.com/yourusername/ecommerce-shop.git cd ecommerce-shop
-
Build and start the Docker containers:
docker-compose up --build
Set up environment variables: Create a config.env
file in the root directory and add the necessary environment variables. Ensure the DB_HOST is set to db.
-
Clone the repository:
git clone https://github.com/yourusername/ecommerce-shop.git cd ecommerce-shop
-
Install dependencies:
npm install
-
Set up environment variables: Create a
config.env
file in the root directory and add the necessary environment variables. -
Run the mock data script:
node ./dev-data/mockData.js
npm start
-
Development Mode:
npm run dev
-
Production Mode:
npm run start:prod