This eCommerce project leverages the power of the MERN stack, combined with Redux for efficient state management. It utilizes React,a JavaScript library for building user interfaces, along with Create React App for compiling and bundling the frontend code. MongoDB, a flexible NoSQL database, is employed to handle the storage of product catalogs, user profiles, orders, and other essential data. Node.js, a server-side runtime environment, works in tandem with Express.js, a web application framework, to handle backend logic, routing, and communication with the MongoDB database. For interacting with MongoDB in a Node.js environment, the project integrates Mongoose, an Object-Relational Mapping (ORM) library, which simplifies the process of defining schemas, creating models, and performing database operations.
To get a local copy up and running follow these simple example steps.
Before getting started, make sure you have the following software installed:
- MongoDB Server - Download and install MongoDB Server for your operating system.
- MongoDB Compass - Download and install MongoDB Compass, a visual interface for working with MongoDB.
- Node.js - Download and install Node.js, which includes npm, the package manager for Node.js modules.
Recommended:
node
:>=18.16.0
.MongoDB Server
:>=6.0.6
andMongoDB Compass GUI
:1.37.0 - Stable
.- MongoDB Compass GUI it is preferred but not necessary, if you are familiar with writing commands in MongoDB.
Name | Description |
---|---|
public/ | Static assets (images). |
src/components | React components that are used for specific pages. |
src/actions | Indicate what can possibly be done to the states. |
src/reducers | Indicate transformations of the states. |
src/constants | Provide a way to define and manage fixed values in a central location. |
Name | Description |
---|---|
config | Configuration of the environment variables and database connection. |
controllers | Managing back end pages and responding directly to HTTP requests. |
models | Connecting them to database and using them in controllers. |
middlewares | Intercepting and processing requests and responses. |
tests | Unit tests and integration tests for testing the functionality and reliability of the backend code. |
routes | Route handlers and endpoint definitions for the backend API. |
utils | Reusable functionality and assist in various tasks throughout the backend application. |
- Clone the repository.
git clone https://github.com/ArjanaaTernava/eCommerce.git
or
git clone git@github.com:ArjanaaTernava/eCommerce.git
- Install all dependencies at the root folder using:
npm install
- Navigate to the frontend directory with the cd frontend command and install all dependencies using:
cd frontend
npm install
- Remember to add config variables values in the config.env file in backend/config folder.
npm run dev
npm start
npm run seeder
We have used the Mocha framework for testing our application. Mocha is a popular JavaScript testing framework that provides a clean and easy-to-use interface for writing test cases.
To run the tests, follow these steps:
- Make sure you have all the dependencies installed by running:
npm install
- Execute the tests using the command:
npm test
Mocha will then run the test suites and display the results in the terminal.
We have used Swagger for documenting our API endpoints and models. Swagger provides a standardized way to describe and visualize APIs, making it easier for developers to understand and interact with the endpoints.