Skip to content

Edu-Vin/nestjs-api-starter

Repository files navigation

NestJS API Starter

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.

Features

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

Table of Contents


Requirements

  • Node.js (>= 18.x)
  • pnpm or npm
  • PostgreSQL database
  • Redis server

Getting Started

# 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

Running the App

# Development with hot reload
pnpm run start:dev

# Production build
pnpm run build
pnpm run start:prod

API Documentation

Swagger UI is available at:

GET /docs

Response Format

All 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
  }
}

Testing

# Run all tests
pnpm test

# E2E tests
pnpm test:e2e

# Coverage
pnpm test:cov

Logging

Structured JSON logging using Pino:

  • Errors and performance traces
  • Redacted sensitive fields
  • Easily integratable with monitoring

Contributing

Want to improve this starter? Great!

We follow conventional commits (linted via commitlint)

  1. Fork the repository
  2. Create your feature branch
  3. Commit your changes
  4. Push to the branch
  5. Open a Pull Request

License

This project is open-source and available under the MIT License.

About

A modern Nestjs API starter kit

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors