Skip to content

moinulse/awesome-nest-boilerplate

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

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

Repository files navigation

πŸš€ Awesome NestJS Boilerplate

NestJS TypeScript PostgreSQL License: MIT

🎯 An opinionated, production-ready NestJS boilerplate with TypeScript, PostgreSQL, and modern development tools

πŸ™ Credits

This project is based on the amazing work by Narek Hakobyan πŸ‡¦πŸ‡²
Original Repository: awesome-nest-boilerplate ⭐

Special thanks to Narek for creating such a comprehensive and well-structured NestJS boilerplate that serves as the foundation for this project.


πŸ“‹ Prerequisite

πŸ› οΈ Tech Stack

Technology Version Purpose
πŸ—οΈ NestJS v11.1.2 Progressive Node.js framework
πŸ’ͺ TypeScript v5.8.3 Strongly typed JavaScript
πŸ—„οΈ TypeORM v0.3.24 Database ORM
🐘 PostgreSQL Latest Primary database
πŸ” ESLint v9.27.0 Code linting with flat config
🎨 Prettier v3.5.3 Code formatting
🐺 Husky v9.1.7 Git hooks for code quality
πŸ§ͺ Jest v29.7.0 Testing framework
πŸ“š Swagger v11.2.0 API documentation
πŸ” JWT v11.0.0 Authentication

πŸš€ Getting Started

# 1. Clone this project
git clone https://github.com/moinulse/awesome-nest-boilerplate {your project name}

# 2. Enter your newly-cloned folder
cd your-project-name

# 3. Create Environment variables file
cp .env.example .env

# 4. Install dependencies
yarn

# 5. Run DB
docker compose up

πŸ”₯ Development

# 4. Run development server and open http://localhost:3000
yarn watch:dev

# Alternative development start
yarn start:dev

# View API documentation (Swagger)
# Navigate to: http://localhost:3000/documentation

πŸ§ͺ Testing & Code Quality

# Run linting
yarn lint

# Fix linting issues automatically
yarn lint:fix

# Run tests
yarn test

# Run tests in watch mode
yarn test:watch

# Run tests with coverage
yarn test:cov

# Run e2e tests
yarn test:e2e

πŸ”„ Database Operations

# Generate a new migration
yarn migration:generate ./src/database/migrations/{migration-name}

# Example: Add post table
yarn migration:generate ./src/database/migrations/add-post-table

# Run pending migrations
yarn migration:run

# Revert last migration
yarn migration:revert

# Create empty migration file
yarn migration:create ./src/database/migrations/{migration-name}

πŸ—οΈ Build & Deploy

# Build for production
yarn build:prod

# Start production server
yarn start:prod

⚑ Features

  • βœ… JWT Authentication - Secure authentication system
  • βœ… Role-based Access Control - User permissions and roles
  • βœ… API Documentation - Auto-generated Swagger docs
  • βœ… Database Migrations - TypeORM migration system
  • βœ… Environment Configuration - Development, staging, production configs
  • βœ… Input Validation - Request validation with class-validator
  • βœ… Error Handling - Comprehensive error handling
  • βœ… Logging - Structured logging system
  • βœ… Health Checks - Application health monitoring
  • βœ… Rate Limiting - API rate limiting protection
  • βœ… CORS Support - Cross-origin resource sharing
  • βœ… Security Headers - Helmet.js security headers
  • βœ… Code Quality - ESLint, Prettier, Husky pre-commit hooks
  • βœ… Testing Setup - Unit and E2E testing with Jest

πŸ”§ Code Quality & Git Hooks

This project uses modern tooling for maintaining code quality:

  • πŸ” ESLint v9 with flat config format (eslint.config.mjs)
  • 🐺 Husky v9 for Git hooks
  • πŸ“ lint-staged for pre-commit linting
  • πŸ’¬ commitlint for conventional commit messages

Git hooks are automatically set up when you run yarn. The hooks will:

  • πŸ” Run ESLint and Prettier on staged files before commit
  • βœ… Validate commit messages follow conventional commit format

πŸ“š Documentation

This project includes comprehensive documentation:

  1. πŸ› οΈ Setup and Development
  2. πŸ—οΈ Architecture
  3. πŸ“ Naming Cheatsheet

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the project
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“„ License

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

🌟 Acknowledgments

  • πŸ™ Narek Hakobyan for the original awesome-nest-boilerplate
  • 🎯 The NestJS team for the amazing framework
  • πŸ’ͺ The TypeScript team for making JavaScript better
  • πŸ”₯ All the open-source contributors who made this possible

⭐ Star this repo if you found it helpful!

Made with ❀️ by developers, for developers

About

Awesome NestJS Boilerplate 😍, Typescript πŸ’ͺ, Postgres πŸŽ‰, TypeORM πŸ₯³

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 79.8%
  • EJS 11.0%
  • JavaScript 8.8%
  • Other 0.4%