A mini CRM application for managing leads, comments, search, filtering, and pagination.
Stack: Next.js (App Router) · NestJS · PostgreSQL · Prisma · TypeScript · Docker
- Leads CRUD: create, read, update, delete
- Lead comments with nested lead route
- Search by name, email, company
- Filter by status
- Pagination and sorting support
- Backend validation and Swagger API docs
- Docker Compose setup for local development
Prerequisites: Node.js 18+, PostgreSQL running locally
Backend:
cd backend
cp .env.example .env # fill in your DATABASE_URL
npm install
npx prisma migrate deploy
npm run start:devFrontend:
cd frontend
cp .env.example .env.local # fill in NEXT_PUBLIC_API_URL
npm install
npm run dev- Backend: http://localhost:4000
- Frontend: http://localhost:3000
- Swagger: http://localhost:4000/api/docs
docker compose up --build- Frontend: http://localhost:3000
- Backend: http://localhost:4000
- Swagger: http://localhost:4000/api/docs
backend/.env.example
DATABASE_URL=postgresql://lead_user:lead_pass@localhost:5432/lead_dbfrontend/.env.example
NEXT_PUBLIC_API_URL=http://localhost:4000/apiBase URL: http://localhost:4000/api
GET /leads- Query params:
page,limit,search,status,sort,order
- Query params:
POST /leadsGET /leads/:idPATCH /leads/:idDELETE /leads/:id
GET /leads/:leadId/commentsPOST /leads/:leadId/comments
backend/– NestJS API serverfrontend/– Next.js UI applicationdocker-compose.yml– local development with PostgreSQL, backend, frontendbackend/prisma/– Prisma schema and migrations
frontendexpectsNEXT_PUBLIC_API_URLto point to the backend API.- When using Docker Compose, the backend is available on port
4000.