Product Management API is a Node.js backend built with Express, TypeScript, and Prisma. It provides a secure and scalable REST API for managing products and their updates, including authentication, validation, and role-based access control.
- 🔐 Authentication & Authorization (JWT-based)
- 📦 CRUD Operations for Products & Updates
- ✅ Request Validation with express-validator
- 🛢 Database ORM using Prisma & PostgreSQL
- ⚡ Middleware for Error Handling & Security
- 🛠 Modular Code Structure for Scalability
- Node.js & Express.js
- TypeScript
- Prisma ORM (PostgreSQL)
- Express Validator
- JWT Authentication
git clone https://github.com/alimagdye/product-management-api.git
cd product-management-apinpm installCreate a .env file in the root directory and add the following:
DATABASE_URL=your_database_url
JWT_SECRET=your_secret_key
PORT=5432
npx prisma migrate devnpm run dev| Method | Endpoint | Description |
|---|---|---|
| POST | /signup |
Register a new user |
| POST | /login |
Authenticate a user |
| Method | Endpoint | Description |
|---|---|---|
| GET | /products |
Get all products owned by the authenticated user |
| GET | /products/:id |
Get a specific product by ID (if owned by the user) |
| POST | /products |
Create a new product |
| PUT | /products/:id |
Update a product (if owned by the user) |
| DELETE | /products/:id |
Delete a product (if owned by the user) |
| Method | Endpoint | Description |
|---|---|---|
| GET | /updates |
Get all updates related to products owned by the user |
| GET | /updates/:id |
Get a specific update by ID for a product owned by the user |
| POST | /updates |
Create an update for a product owned by the user |
| PUT | /updates/:id |
Update an update by ID for a product owned by the user |
| DELETE | /updates/:id |
Delete an update by ID for a product owned by the user |
- JWT-based authentication is implemented.
- Protected routes require authentication.
- Request validation ensures secure input handling.