Backend for QKart - An E-commerce application
View QKart Backend • View QKart Frontend • View API Documentation
QKart is an E-commerce application providing a wide range of products for users. This project focuses on the backend development, implementing robust REST APIs and ensuring secure user interactions.
- Node.js
- Express.js
- MongoDB
- Mongoose ODM
- Passport.js
- JOI Validation
- Jest Framework
- User registration and authentication via JWT.
- Secure API endpoints with token-based authentication.
- Management of user shopping carts (add, update, remove products).
- Checkout process with integration tests to ensure functionality.
- Comprehensive API documentation for developers.
-
-
# clone repo git clone https://github.com/Anusree6154s/qkart-backend-2 cd qkart-backend-2 # install dependencies npm install
-
Create a .env file in the root directory and add the following configurations:
JWT_ACCESS_EXPIRATION_MINUTES = your_jwt_exp_minutes JWT_REFRESH_EXPIRATION_DAYS = your_jwt_exp_days JWT_SECRET = your_jwt_secret MONGODB_URL = your_mongodb_uri NODE_ENV = development PORT = your_desired_port_other_than_8081 # PORT 8081 is client port
-
npm start
-
-
-
For the frontend, navigate to the frontend directory and run:
cd ../frontend npm install npm start
-
For the frontend, navigate to the frontend directory and run:
qkart-backend/
│
└── src/
├── api-doc/
│ ├── docs.html
| ├── logo.png
| └── swagger.js
├── config/
│ ├── config.js
| ├── passport.js
| └── tokens.js
├── controllers/
│ ├── auth.controller.js
| ├── cart.controller.js
│ ├── index.js
| ├── product.controller.js
| └── user.controller.js
├── middlewares/
│ ├── auth.js
| ├── error.js
| └── validate.js
├── models/
| ├── cart.model.js
│ ├── index.js
| ├── product.model.js
| └── user.model.js
├── routes/
| └── v1/
| └── auth.route.js
| ├── cart.route.js
| ├── index.js
| ├── product.route.js
| ├── swagger.route.js
| └── user.route.js
├── services/
│ ├── auth.service.js
| ├── cart.service.js
| ├── index.js
│ ├── product.service.js
| ├── token.service.js
| └── user.service.js
├── utils/
│ ├── ApiError.js
| ├── catchAsync.js
| └── pick.js
├── validations/
│ ├── auth.validation.js
| ├── cart.validation.js
| ├── custom.validation.js
│ ├── index.js
| ├── product.validation.js
| └── user.validation.js
├── app.js
└── index.js
-
- Backend:
- Node.js & Express.js: For building a robust REST API, chosen for their non-blocking architecture and scalability, making it ideal for handling multiple requests simultaneously.
- Database:
- MongoDB & Mongoose: Used for flexible data storage and easy data manipulation.
- Backend:
-
-
Layered Architecture: This approach helps in separating concerns, making the code more maintainable and scalable.
-
-
- Hosting: The application is deployed on Render for ease of use and automatic deployments.
- Server: Node.js server for handling requests.
-
-
Authentication: JWT (JSON Web Tokens) for secure user authentication.
-
- User Registration: Allows new users to create an account.
- User Authentication: Secure login process using JWT tokens.
- Shopping Cart Management: APIs for adding, updating, and removing items from the cart.
- Checkout Process: Finalizes purchases and handles payment logic.
- Wishlist functionality for users.
- User reviews and ratings for products.
- Admin dashboard for managing products and users.
- Enhanced error handling and logging mechanisms.