Welcome to my first backend project for the Online Store! In this project, I combine my knowledge of Node.js, Express, and MySQL/Sequelize to develop a RESTful API for managing an online store. 🚀
🛴 The eCommerce project I've developed focuses on a scooter rental store, leveraging the power of MySQL and Sequelize as the database and ORM, respectively. The system comprises several key entities, enabling efficient store management and offering scalability for future expansions.
🏪 Store Table: This table stores information about scooter rental stores. Each store is associated with multiple scooters available for rent.
🛴 Scooters Table: In this table, details of the scooters available for rent are recorded. It is related in a one-to-many relationship with the Store table, meaning one store can have multiple scooters for rent.
👥 Customers Table: Customer data using the scooter rental service is registered here.
📈 Intermediate CustomerScooter Table: This table plays a crucial role as it establishes a many-to-many relationship between customers and scooters. Each entry in this table indicates which customer has rented which scooter at a given time 🕒.
🏪 The database architecture allows the scooter rental store to maintain a detailed record of its stores, available scooters, and customers. Furthermore, the many-to-many relationship between scooters and customers through the intermediate table provides flexibility to handle multiple rentals by a customer and the ability to track the scooters in use 📈.
📈🌟 The project's scalability is ensured, as new stores and services can be added in the future seamlessly, maintaining data integrity and efficient management. This provides a solid foundation for the continuous growth of the scooter rental store and adaptation to changing market needs.
📊 Midway through the project, we discovered the Trello tool for project workflow, and it has proven to be invaluable in organizing my tasks in the project.
Once the project's requirements have been analyzed, the student will need to develop a RESTful API capable of:
- 🔐 User registration using Bcrypt.
- 🚪 User login with tokens and middleware.
- ✍️ Creating a CRUD.
↔️ Establishing at least one "Many to Many" and one "One to Many" relationship.- 🌱 Using seeders to populate the initial database.
Make sure the README is excellent. 😉✨
For the development of this API, we will be using the following technologies:
- Node.js
- Express
- MySQL
- Sequelize
- Jwt
- Postman
The project will be hosted in a public GitHub repository, and we will appreciate the presence of multiple branches and commits with clear and readable commit messages to analyze the project's evolution. It is essential for the repository to include a comprehensive README.
- Products CRUD: Endpoint for managing products.
- Create Product: Create a new product.
- Update Product: Update an existing product.
- Delete Product: Delete a product.
- List Products with Categories: Display products along with their categories.
- Product by ID: Retrieve a product by its ID.
- Filter by Name: Search for products by name.
- Filter by Price: Search for products by price.
- Sort by Price: Sort products from highest to lowest price.
- Creation Validation: Validate that all fields are completed when creating a product.
- Authentication Required: Only authenticated users can create, update, and delete products.
- Categories CRUD: Endpoint for managing categories.
- Create Category: Create a new category.
- Update Category: Update an existing category.
- Delete Category: Delete a category.
- View Categories with Products: Display categories along with the products that belong to them.
- Category by ID: Retrieve a category by its ID.
- Filter by Name: Search for categories by name.
- View Orders with Products: Display orders along with the products they contain.
- Create Order: Create a new order.
- User Registration: Register a user using Bcrypt.
- Log In: Log in a user using Bcrypt and JWT.
- User Information: Retrieve information of the logged-in user, including their orders and the products in each order.
- Log Out: Allow the user to log out.
- Registration Validation: Validate that all fields are completed when creating a user.
- Create 5 Products with Seeder: Populate the database with 5 initial products.
- Role Implementation: Create an "Admin" role to allow only users with that role to create, update, and delete products.
- Multer Middleware: Investigate and apply the Multer middleware to attach images when creating or updating products.
- Reviews CRUD: Add endpoints for managing reviews.
- Display Reviews: Show reviews along with the user who made them.
- Update Endpoints: Update the endpoints to display products with their categories and reviews.
🚀 This is an example of how you may give instructions on setting up your project locally. To get a local copy up and running, follow these simple example steps.
📋 This is an example of how to list things you need to use the software and how to install them.
- npm
npm install express mysql2 sequelize bcryptjs jsonwebtoken
🔧 Below is an example of how you can instruct your audience on installing and setting up your app.
- Clone the repo
git clone https://github.com/cescalberola/ScooterRent_backend_project.git
- Install NPM packages
npm install express mysql2 sequelize bcryptjs jsonwebtoken
- Ready to start!
npm start
🙌 Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
🌟 If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/YourName
) - Commit your Changes (
git commit -m 'Add some YourName'
) - Push to the Branch (
git push origin feature/YourName
) - Open a Pull Request