Skip to content

An e-commerce back-end system is a crucial component of online retail platforms, enabling seamless management and operation of digital storefronts. It provides the technological infrastructure necessary for managing an online store's products, categories, and tags, offering functionalities such as adding, updating, and deleting product information.

License

Notifications You must be signed in to change notification settings

naturuplift/ECommerceBackEnd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

E-Commerce Back End


Sequelize ORM - A promise-based Node.js ORM for Postgres, MySQL, MariaDB, SQLite, and Microsoft SQL Server. It features solid transaction support, relations, eager and lazy loading, read replication, and more MySQL - An open-source relational database management system Render (for deployment) - A platform as a service (PaaS) that enables developers to build, run, and operate applications entirely in the cloud express-session - A session middleware for Express.js, used for handling user sessions Node.js - A JavaScript runtime built on Chrome's V8 JavaScript engine, used for building fast and scalable network applications Express.js - A minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications dotenv NPM JavaScript - ES6 GitHub (for repository hosting and project management) - Provides hosting for software development and version control using Git Git (for version control) - A free and open-source distributed version control system University of New Brunswick The MIT License


Description

This project is an E-commerce back end that utilizes the latest technologies, providing an efficient and scalable solution for internet retail companies. Built with an Express.js API and connected to a MySQL database using Sequelize, this application facilitates product, category, and tag management through a RESTful API. This allows businesses to maintain their inventory in a database, offering endpoints for creating, reading, updating, and deleting (CRUD operations) data for categories, products, and tags.

Table of Contents

Demo Video

Open Demo video of Employee Tracker

Features

  • View All Categories, Products, and Tags: Users can retrieve a comprehensive list of all categories, products, and tags stored in the database, each accessible through dedicated API GET routes. This feature ensures that the backend supports scalable read operations for e-commerce inventories.

  • Add New Categories, Products, and Tags: The backend allows for the insertion of new categories, products, and tags into the database via API POST routes. This functionality is crucial for expanding the e-commerce catalog and supporting a growing business.

  • Update Existing Categories, Products, and Tags: With API PUT routes, users can modify the details of existing categories, products, and tags. This feature facilitates dynamic inventory management, allowing changes to product details, categorizations, and tagging as needed.

  • Delete Categories, Products, and Tags: The API DELETE routes enable users to remove categories, products, and tags from the database. This capability is essential for keeping the database clean and up-to-date, ensuring that discontinued products or obsolete categories and tags are properly managed.

  • Structured Database Models with Associations: Utilizes Sequelize to define structured database models for Categories, Products, Tags, and ProductTags, with appropriate associations among them. This structure supports complex queries and relationships, such as finding all products within a category or all tags associated with a product.

  • Environment Variable Configuration: Incorporates the dotenv package to securely configure environment variables. This approach safeguards database credentials and other sensitive information, making the application more secure and easier to configure across different environments.

  • Sequelize Sync on Server Start: Automatically syncs Sequelize models to the MySQL database upon server startup. This feature ensures that the database schema is up-to-date and ready for operations as soon as the server begins running.

Installation

  1. Ensure you have Node.js and MySQL installed on your machine.
  2. Clone the repository to your local machine:
git clone https://github.com/naturuplift/ECommerceBackEnd.git
  1. Navigate to the project directory and install dependencies:
cd ECommerceBackEnd
npm install
  1. Create a .env file in the root directory to store your MySQL username, password, and database name:
DB_NAME='ecommerce_db'
DB_USER='your_mysql_username'
DB_PASSWORD='your_mysql_password'
DB_HOST='your_host'
  1. Use the schema.sql file in the db folder to create your database using MySQL shell commands.
  2. Seed the database:
npm run seed
  1. Start the server:
npm start

Usage

Once the server is running, you can use an API client like Insomnia to test the API routes.

  • GET routes for categories, products, and tags display data in a formatted JSON.

image

  • POST, PUT, and DELETE routes allow for creating, updating, and deleting data in the database.

image image image

Application Functionality

Below are sample screenshots showcasing the application routes functionality.

GET All Categories:

image

GET Category (by Id):

image

GET All Products:

image

GET Product (by Id):

image

GET All Tags:

image

GET Tag (by Id):

image

POST CREATE Category:

image

PUT UPDATE Category (by Id):

image

DELETE DELETE Category (by Id):

image

POST CREATE Product:

image

PUT UPDATE Product (by Id):

image

DELETE DELETE Product (by Id):

image

POST CREATE Tag:

image

PUT UPDATE Tag (by Id):

image

DELETE DELETE Tag (by Id):

image

Database Models

  • Category

    • id (Integer, Primary Key, Auto Increment, Not Null)
    • category_name (String, Not Null)
  • Product

    • id (Integer, Primary Key, Auto Increment, Not Null)
    • product_name (String, Not Null)
    • price (Decimal, Not Null, Validates Decimal)
    • stock (Integer, Not Null, Default Value 10, Validates Numeric)
    • category_id (Integer, References Category model's id)
  • Tag

    • id (Integer, Primary Key, Auto Increment, Not Null)
    • tag_name (String)
  • ProductTag

    • id (Integer, Primary Key, Auto Increment, Not Null)
    • product_id (Integer, References Product model's id)
    • tag_id (Integer, References Tag model's id)

Associations

  • Product belongs to Category
  • Category has many Product models
  • Product belongs to many Tag models through ProductTag
  • Tag belongs to many Product models

Structure

Your directory may have the following structure:

ECommerceBackEnd/
├── config/
   └── connection.js
├── db/
   ├── schema.sql
├── models/
   ├── Category.js
   ├── Product.js
   ├── Tag.js
   ├── ProductTag.js
   └── index.js
├── routes/
   ├── api/
      ├── category-routes.js
      ├── product-routes.js
      ├── tag-routes.js
      └── index.js
   └── index.js
├── seeds/
   ├── category-seeds.js
   ├── product-seeds.js
   ├── productTag-seeds.js
   ├── tag-seeds.js
   └── seed.js
├── .env
├── .gitignore
├── package.json
├── package-lock.json
├── server.js
└── README.md

Starter Code

To start with this project we used the following Starter Code

State Flow Diagram

For a visual representation of the sequence of actions involved in the employee tracker, refer to the State Flow Diagram provided in the project documentation.

Feel free to reach out, contribute, or provide feedback to make the Password Generator Project even more robust and user-friendly!

Contributing

Your contributions are welcome! Please feel free to submit issues and pull requests with improvements or suggestions.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

An e-commerce back-end system is a crucial component of online retail platforms, enabling seamless management and operation of digital storefronts. It provides the technological infrastructure necessary for managing an online store's products, categories, and tags, offering functionalities such as adding, updating, and deleting product information.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published