Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/anusree6154s/qkart-backend-2
Backend for Crio module - QKart Backend
https://github.com/anusree6154s/qkart-backend-2
jest jwt mongodb mongoose nodejs passportjs reactjs
Last synced: 20 days ago
JSON representation
Backend for Crio module - QKart Backend
- Host: GitHub
- URL: https://github.com/anusree6154s/qkart-backend-2
- Owner: Anusree6154s
- Created: 2024-08-14T04:50:15.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-11-05T09:16:37.000Z (about 2 months ago)
- Last Synced: 2024-11-05T10:26:46.262Z (about 2 months ago)
- Topics: jest, jwt, mongodb, mongoose, nodejs, passportjs, reactjs
- Language: JavaScript
- Homepage: https://qkart-backend-2-jlz8.onrender.com/v1/swagger/docs
- Size: 6.83 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
QKart Backend
Backend for QKart - An E-commerce application
View QKart Backend •
View QKart Frontend •
View API Documentation
## Table of Contents
1. [Project Overview](#project-overview)
2. [Setup Instructions](#setup-instructions)
3. [Project Breakdown](#project-breakdown)## Project Overview
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.
### Tech Stack
- Node.js
- Express.js
- MongoDB
- Mongoose ODM
- Passport.js
- JOI Validation
- Jest Framework### Features
- 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.## Setup Instructions
- ### Backend
- #### Installation
```bash
# clone repo
git clone https://github.com/Anusree6154s/qkart-backend-2
cd qkart-backend-2# install dependencies
npm install
```- #### Set Up Environment Variables in server
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
```- #### Running the Server
```bash
npm start
```- ### Frontend
- #### Running the Client
For the frontend, navigate to the frontend directory and run:
```bash
cd ../frontend
npm install
npm start
```## Project Breakdown
### Project Structure for backend
```
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
```### Technical Architecture
- #### Components
- **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.- #### Design Pattern
- **Layered Architecture**: This approach helps in separating concerns, making the code more maintainable and scalable.
QKart Layered Architecture
- #### Deployment Architecture
- **Hosting**: The application is deployed on **Render** for ease of use and automatic deployments.
- **Server**: Node.js server for handling requests.- #### Security
- **Authentication**: JWT (JSON Web Tokens) for secure user authentication.
JWT Token authentication flow for QKart APIs
### Features Implemented
- **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.### Potential Improvements
- Wishlist functionality for users.
- User reviews and ratings for products.
- Admin dashboard for managing products and users.
- Enhanced error handling and logging mechanisms.