https://github.com/shahadathhs/ecommerce-inventory-api
A backend API for managing categories, products, and inventory with file upload support.
https://github.com/shahadathhs/ecommerce-inventory-api
docker multer nestjs postgresql prisma supabase-storage swagger-ui
Last synced: 2 months ago
JSON representation
A backend API for managing categories, products, and inventory with file upload support.
- Host: GitHub
- URL: https://github.com/shahadathhs/ecommerce-inventory-api
- Owner: shahadathhs
- Created: 2025-09-19T12:25:16.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-09-20T13:00:45.000Z (10 months ago)
- Last Synced: 2026-05-08T16:56:15.040Z (2 months ago)
- Topics: docker, multer, nestjs, postgresql, prisma, supabase-storage, swagger-ui
- Language: TypeScript
- Homepage: https://ecommerce-inventory-api-irhk.onrender.com/api/docs
- Size: 552 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Ecommerce Inventory API
A backend API for managing categories, products, and inventory with file upload support.
## 📌 Overview
This is a simple **Ecommerce Inventory Management API** built with **NestJS** and **Prisma ORM**.
It supports **Category & Product CRUD operations**, product filtering (by category, price, pagination), and **file upload to Supabase storage**.
### 🔗 Live URL & Swagger API Docs
👉 [https://ecommerce-inventory-api-irhk.onrender.com/api/docs](https://ecommerce-inventory-api-irhk.onrender.com/api/docs)
### 🗂 Database ERD
- ERD Diagram: [View Online](https://dbdiagram.io/d/Ecommerce-Inventory-API-68ce5342960f6d821a025460)
- Diagram Image: available inside the **`/db`** folder at the root of the project
---
## ⚡ Tech Stack
- **[NestJS](https://nestjs.com/)** — backend framework
- **[PostgreSQL](https://www.postgresql.org/)** with **[Prisma ORM](https://www.prisma.io/)**
- **[Neon](https://neon.tech/)** — Postgres database hosting
- **[Supabase Storage](https://supabase.com/storage)** — file upload & management (via Multer)
- **[Swagger](https://swagger.io/)** — API documentation
## ⚙️ Environment Setup
Create a `.env` file in the root directory using `.env.example` as a reference:
```env
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/postgres?schema=public"
JWT_SECRET="super-secret-key"
ACCESS_TOKEN_EXPIRES_IN="7d"
NODE_ENV=development
PORT=4000
SUPABASE_URL="https://xyz.supabase.co"
SUPABASE_SERVICE_ROLE_KEY="service-role-key-with-permissions"
# Ensure the Supabase Storage has a bucket named "product"
# You can create one from Supabase Dashboard → Storage → Create Bucket
```
---
## Running Locally
1. **Clone the repo**
```bash
git clone https://github.com/shahadathhs/ecommerce-inventory-api.git
cd ecommerce-inventory-api
```
2. **Install dependencies**
```bash
pnpm install
```
3. **Generate Prisma client & run migrations**
```bash
pnpm db:generate
pnpm db:migrate
```
4. **Start the server**
```bash
pnpm dev
```
5. **Open Swagger docs**
```
http://localhost:4000/api/docs
```
## 🌐 Deployment
* Backend is hosted on **Render**
* Database is hosted on **Neon**
* File uploads are stored on **Supabase Storage**
## 📁 Project Structure
```
src/
├── modules/
│ ├── category/ # Category management (CRUD)
│ ├── product/ # Product management (CRUD + filters)
│ ├── auth/ # Authentication (login, register, refresh, etc.)
├── common/ # Shared utils, decorators, guards, interceptors
├── lib/
│ ├── prisma/ # Prisma service & client wrapper
│ ├── file/ # Supabase file upload integration
└── main.ts # Application entrypoint
prisma/
├── migrations/ # Database migration files
└── schema/ # Prisma schema definition
prisma.config.js # Prisma CLI/config entry
```
## ✨ Features
* Category CRUD (unique name, slug auto-generated)
* Product CRUD with filters (category, price range, pagination)
* Supabase file upload (with delete handling)
* Swagger API documentation
* Repository pattern architecture