Skip to content
/ nest-boilerplate Public template

NestJS boilerplate with Typescript 🎢, Postgres 🐬, TypeORM πŸŽ‰and fully CI-CD with GitHub Action πŸƒβ€β™‚οΈ and GKE🐳

Notifications You must be signed in to change notification settings

Notekunn/nest-boilerplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Nest Logo TypeORM Logo PostgreSQL Logo Jest Logo Prettier Logo ESLint Logo Docker Logo

GitHub Actions Logo CommitLint Logo Semantic Release Logo Swagger Logo Fastify Logo

Description

Nest boilerplate with Typescript 🎢, Postgres 🐬, TypeORM πŸŽ‰ and fully CI-CD with GitHub Action πŸƒβ€β™‚οΈ

Features

  • πŸš€ NestJS with TypeScript
  • πŸ“¦ PNPM as package manager
  • πŸ—„οΈ PostgreSQL with TypeORM
  • πŸ“ Swagger API documentation
  • πŸ§ͺ Jest for testing
  • 🎨 Prettier for code formatting
  • πŸ” ESLint for code linting
  • 🐳 Docker support
  • πŸ”„ GitHub Actions for CI/CD
  • πŸ“ Conventional Commits with CommitLint
  • πŸš€ Semantic Release for versioning

Prerequisites

  • Node.js (v22 or higher)
  • PNPM (v8 or higher)
  • PostgreSQL (v14 or higher)
  • Docker (optional, for containerization)

Setup GitHub Action Secret

  1. Create a personal access token with write:packages scope here
  2. Add a secret PAT with the generated token value in your repository settings

Installation

# Install dependencies
$ pnpm install

# Copy environment file
$ cp .env.example .env

Configuration

  1. Update the .env file with your database credentials and other configuration
  2. Default configuration includes:
    • Database connection
    • JWT settings
    • API port
    • Swagger documentation settings

Running the app

# development
$ pnpm start

# watch mode
$ pnpm start:dev

# production mode
$ pnpm start:prod

# debug mode
$ pnpm start:debug

API Documentation

Once the application is running, you can access the Swagger documentation at:

http://localhost:3000/api

Testing

# unit tests
$ pnpm test

# e2e tests
$ pnpm test:e2e

# test coverage
$ pnpm test:cov

# test watch mode
$ pnpm test:watch

Database Management

# generate migration
$ pnpm migration:generate MigrationName
# or
$ pnpm build && pnpm typeorm migration:generate -p ./src/database/migrations/MigrationName

# run migration
$ pnpm migration:run

# revert migration
$ pnpm migration:revert

# drop schema
$ pnpm typeorm schema:drop

# create migration
$ pnpm migration:create MigrationName

Docker Support

# Build image
$ docker build -t nest-boilerplate .

# Run container
$ docker run -p 3000:3000 nest-boilerplate

Project Structure

src/
β”œβ”€β”€ config/           # Configuration files
β”œβ”€β”€ database/         # Database configuration and migrations
β”œβ”€β”€ modules/          # Feature modules
β”œβ”€β”€ common/           # Common utilities and decorators
β”œβ”€β”€ filters/          # Exception filters
β”œβ”€β”€ guards/           # Guards
β”œβ”€β”€ interceptors/     # Interceptors
β”œβ”€β”€ middlewares/      # Middlewares
β”œβ”€β”€ pipes/            # Pipes
└── main.ts          # Application entry point

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'feat: add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

NestJS boilerplate with Typescript 🎢, Postgres 🐬, TypeORM πŸŽ‰and fully CI-CD with GitHub Action πŸƒβ€β™‚οΈ and GKE🐳

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •