You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Mahdi
8613180c87
|
2 weeks ago | |
---|---|---|
src | 2 weeks ago | |
.env.sample | 2 weeks ago | |
.eslintrc.js | 2 weeks ago | |
.gitignore | 2 weeks ago | |
.prettierrc | 2 weeks ago | |
README.md | 2 weeks ago | |
nest-cli.json | 2 weeks ago | |
package-lock.json | 2 weeks ago | |
package.json | 2 weeks ago | |
tsconfig.build.json | 2 weeks ago | |
tsconfig.json | 2 weeks ago |
README.md
CRUD
Backend API for E-commerce Application
This is a simple Backend Service API for a E-commerce Application with various endpoints built using Nest.js, PostgreSQL & Sequelize.
Features
- Built with Nest.js.
- PostgreSQL and Sequelize for database management.
- Implements JWT Authentication.
- RESTful APIs for user management:
- Create, Read, Update, and Delete (CRUD) operations.
Technologies Used
- Nest.js
- PostgreSQL with Sequelize
- JWT for authentication
- ARGON2 for password hashing
Installation and Setup
Prerequisites
- Node.js and npm installed on your system.
- postgreSQL connection (local or cloud).
1. Clone the Repository
git clone https://github.com/MahdiTajikKazemi/e-commerce-api-nestjs-postgres-sequelize
2. Setup Backend
- Install dependencies:
npm install
- Create a
.env
file in thebackend
directory and configure it:Set your environment variables in .env.sample file.
- Start the server:
npm run start:dev
Usage
- Start the backend server.
- Open your 'Postman' | 'insomnia' or whatever testing api app you are comfortable using and then begin hitting enpoints listed below.
API Endpoints
Authentication
POST /api/v1/auth/signup
: Register a new user and get a JWT token.POST /api/v1/auth/login
: Login and get a JWT token.
User Management
GET /api/v1/users/
: Get a list of all users (admin only).POST /api/v1/users/
: Create a user (admin only).PATCH /api/v1/users/:id
: Update a specific user (admin only).DELETE /api/v1/users/:id
: Remove a specific user (admin only).GET /api/v1/users/:id
: Get a specific user (admin only).
Folder Structure
└── 📁src
└── 📁core
└── 📁constants
└── index.ts
└── 📁database
└── database.config.ts
└── database.module.ts
└── database.providers.ts
└── 📁interfaces
└── dbConfig.interface.ts
└── 📁modules
└── 📁auth
└── auth.controller.ts
└── auth.module.ts
└── auth.service.ts
└── jwt.strategy.ts
└── local.strategy.ts
└── 📁orders
└── 📁dto
└── create-order.dto.ts
└── index.ts
└── update-order.dto.ts
└── 📁entities
└── order-status.entity.ts
└── order.entity.ts
└── order-statuses.providers.ts
└── orders.controller.ts
└── orders.module.ts
└── orders.providers.ts
└── orders.service.ts
└── 📁products
└── 📁dto
└── create-product.dto.ts
└── index.ts
└── update-product.dto.ts
└── 📁entities
└── product.entity.ts
└── products.controller.ts
└── products.module.ts
└── products.providers.ts
└── products.service.ts
└── 📁users
└── 📁dto
└── create-user.dto.ts
└── index.ts
└── update-user.dto.ts
└── 📁entities
└── user.entity.ts
└── users.controller.ts
└── users.module.ts
└── users.providers.ts
└── users.service.ts
└── app.controller.ts
└── app.module.ts
└── app.service.ts
└── main.ts
Future Enhancements
- Integrate redis for cashing
License
This project is licensed under the MIT License.
Mahdi Tajik Kazemi