SecondHand ET — NestJS REST API for a peer-to-peer used goods marketplace (Ethiopia). Handles auth, listings, categories, saved listings, ratings, reports, and buyer/seller dashboards. PostgreSQL
# SecondHand ET — Backend (API)
**Vintage Challenge – Round 1 | VinTech PLC**
NestJS + TypeORM + PostgreSQL REST API powering the SecondHand ET used-goods marketplace.
> Frontend repo: `secondhand-et-web` (see its own README for setup)
> This document is the **source of truth for the API contract** — the frontend repo's README links back to this file. Keep both in sync when routes change.
> **Change log:** this repo was rebuilt from a fresh `nest new` scaffold, switching from Prisma to **TypeORM**, and adopting a `modules/ /{controller, usecase, persistence}` structure (following the `lms-api` reference project) instead of the earlier module-per-feature-flat layout. This README reflects the current structure — earlier Prisma-based instructions are superseded.
---
## Table of Contents
1. Tech Stack
2. Folder Structure
3. Database
4. Entities (TypeORM)
5. Environment Variables
6. Local Setup
7. Migrations
8. Auth & Roles
9. API Documentation
10. Error Response Format
11. Swagger
12. Git Workflow
13. Build Status
14. Milestones
15. Security Checklist
---
## 1. Tech Stack
| Concern | Choice |
| ------------ | ------------------------------------------------------------------------------------------------- |
| Framework | NestJS (TypeScript) |
| Database | PostgreSQL 16 (Docker, **port 5433** — 5432 is taken by a separate local project on this machine) |
| ORM | **TypeORM** (switched from Prisma) |
| Migrations | TypeORM CLI, `synchronize: false` — migrations only, no auto schema sync |
| Auth | JWT (access + refresh) via `@nestjs/passport` + `passport-jwt` |
| Validation | `class-validator` / `class-transformer` DTOs …