Production-ready RESTful API built with Node.js, TypeScript, Express, Prisma, PostgreSQL, Zod, ESLint, Prettier, Jest, and Docker.
.
├── prisma
│ ├── migrations
│ │ ├── 20260427220500_init
│ │ │ └── migration.sql
│ │ └── 20260427222212_user_table
│ │ └── migration.sql
│ └── schema.prisma
├── src
│ ├── config
│ │ ├── env.ts
│ │ └── prisma.ts
│ ├── controllers
│ │ └── user.controller.ts
│ ├── middleware
│ │ ├── asyncHandler.ts
│ │ ├── errorHandler.ts
│ │ ├── notFound.ts
│ │ └── validate.ts
│ ├── repositories
│ │ └── user.repository.ts
│ ├── routes
│ │ ├── index.ts
│ │ └── user.routes.ts
│ ├── schemas
│ │ └── user.schema.ts
│ ├── services
│ │ └── user.service.ts
│ ├── types
│ │ └── pagination.ts
│ ├── utils
│ │ └── AppError.ts
│ ├── app.ts
│ └── server.ts
├── tests
│ └── user.schema.test.ts
├── docker-compose.yml
├── Dockerfile
├── eslint.config.js
├── jest.config.ts
├── package.json
└── tsconfig.json
Base URL: http://localhost:3000/api
GET /GET /healthGET /users?page=1&limit=10&search=janeGET /users/:idPOST /usersPUT /users/:idDELETE /users/:id
Example POST /users body:
{
"name": "Dipak Poudel",
"email": "dipak@example.com"
}- Install dependencies:
npm install- Copy environment variables:
cp .env.example .env- Start PostgreSQL with Docker:
docker compose up -d postgres- Generate the Prisma client and run migrations:
npm run prisma:generate
npm run prisma:migrate- Start development mode:
npm run devBuild and run locally:
npm run build
npm startRun the full stack with Docker:
docker compose up --buildnpm run lint
npm run format:check
npm test- Input validation and normalization are handled with Zod.
- Prisma parameterized queries protect database access from SQL injection.
- Helmet, CORS, request logging, global error handling, graceful shutdown, pagination, and search are included.