A modern, production-ready, and open-source NestJS API starter kit designed to help you build scalable, maintainable, and secure backend applications with best practices out of the box.
This starter kit comes with an opinionated but flexible setup focused on real-world backend needs:
- JWT Authentication – Using Passport
- Database Setup – Prisma ORM for PostgreSQL, Schema migrations
- Data Objects - Type-safe DTOs via Zod
- API Documentation – Fully configured Swagger / OpenAPI docs
- Background Jobs – BullMQ queues with Redis support
- Logging – Pino structured logging with filters
- Standardized Responses – Consistent JSON response format
- Rate Limiting
- Conventional commits linting
- Requirements
- Getting Started
- Running the App
- API Documentation
- Response Format
- Testing
- Logging
- Contributing
- License
- Node.js (>= 18.x)
- pnpm or npm
- PostgreSQL database
- Redis server
# Clone the repository
git clone https://github.com/Edu-Vin/nestjs-api-starter.git
cd nestjs-api-starter
# Install dependencies
pnpm install
# Copy environment example and fill in your values
cp .env.example .env# Development with hot reload
pnpm run start:dev
# Production build
pnpm run build
pnpm run start:prodSwagger UI is available at:
GET /docsAll API responses follow a consistent format:
Success Response
{
"status": 'success',
"message": "Operation successful",
"data": {
// Response data here
}
}Error Response
{
"status": 'error',
"message": "Error description",
"data": {
// Error data here
}
}
# Run all tests
pnpm test
# E2E tests
pnpm test:e2e
# Coverage
pnpm test:cov
Structured JSON logging using Pino:
- Errors and performance traces
- Redacted sensitive fields
- Easily integratable with monitoring
Want to improve this starter? Great!
We follow conventional commits (linted via commitlint)
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Open a Pull Request
This project is open-source and available under the MIT License.