https://github.com/netkosolution/nestjs-boilerplate
🚀🎉📚 A feature-rich NestJS starter with built-in enterprise-grade architecture and popular libraries. Supports TypeScript, PostgreSQL/MySQL, TypeORM, JWT Authentication, Docker, and other essential features.
https://github.com/netkosolution/nestjs-boilerplate
auth boilerplate ci crud database docker e2e mailling mongodb mongoose nestjs nestjs-boilerplate nodejs rbac seed swagger typeorm typescript
Last synced: 9 months ago
JSON representation
🚀🎉📚 A feature-rich NestJS starter with built-in enterprise-grade architecture and popular libraries. Supports TypeScript, PostgreSQL/MySQL, TypeORM, JWT Authentication, Docker, and other essential features.
- Host: GitHub
- URL: https://github.com/netkosolution/nestjs-boilerplate
- Owner: netkosolution
- License: mit
- Created: 2025-02-07T03:52:06.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-02-07T06:49:54.000Z (11 months ago)
- Last Synced: 2025-02-16T08:13:49.509Z (10 months ago)
- Topics: auth, boilerplate, ci, crud, database, docker, e2e, mailling, mongodb, mongoose, nestjs, nestjs-boilerplate, nodejs, rbac, seed, swagger, typeorm, typescript
- Language: TypeScript
- Homepage: https://netko-solution.com/nestjs-boilerplate
- Size: 168 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NestJS Boilerplate - Quick Start for Your API Project
**A feature-rich and production-ready NestJS starter** with built-in enterprise-grade architecture and popular libraries. Supports TypeScript, PostgreSQL/MySQL, TypeORM, JWT Authentication, Docker, and other essential features.
## Features
- 🚀 Built with NestJS 10.x & Node.js 18+
- 📝 TypeScript for type safety and better development experience
- 🏗️ Clean Architecture and Domain-Driven Design principles
- 🔐 JWT Authentication & Role-based Authorization
- 🔐 Sign in and sign up via email.
- 🔐 Social sign in (Apple, Facebook, Google, Twitter).
- 🔐 RBAC with custom Roles and Permissions
- 🗃️ TypeORM with PostgreSQL integration
- 📊 Swagger API documentation
- 🔍 Request validation using class-validator
- 🎯 Unit & Integration testing setup with Jest
- 📝 E2E testing with Supertest
- 🔄 CI/CD pipeline with GitHub Actions
- 🐳 Docker & Docker Compose configuration
- 📊 Winston Logger integration
- 🔍 Error handling & logging middleware
- 📧 Mailer service integration
- 🔄 Database migrations and seeders
- 📝 ESLint & Prettier configuration
- 💾 Redis for caching
- 🔄 Bull for queue management
- 📊 Health checks endpoints
## Prerequisites
- Node.js 18+
- PostgreSQL
- Redis
- Docker (optional)
## Getting Started
### Installation
```bash
# Clone the repository
git clone https://github.com/yourusername/nestjs-boilerplate.git
# Install dependencies
npm install
```
### Configuration
1. Copy `.env.example` to `.env`
```bash
cp .env.example .env
```
2. Update environment variables in `.env` file
### Running the app
```bash
# Development
npm run start:dev
# Production mode
npm run start:prod
# Using Docker
docker-compose up
```
### Running tests
```bash
# Unit tests
npm run test
# E2E tests
npm run test:e2e
# Test coverage
npm run test:cov
```
## Project Structure
```
src/
├── config/ # Configuration files
├── core/ # Core modules, guards, decorators
├── modules/ # Feature modules
│ ├── auth/
│ ├── users/
│ └── ...
├── shared/ # Shared resources
└── main.ts # Application entry point
```
### Auth Module
```
src/
└── modules/
└── auth/
├── domain/ # Domain layer
│ ├── entities/ # Domain entities
│ ├── value-objects/ # Value objects
│ ├── repositories/ # Repository interfaces
│ └── services/ # Domain services
│
├── infrastructure/ # Infrastructure layer
│ ├── persistence/ # Database related
│ │ ├── entities/ # TypeORM entities
│ │ ├── repositories/ # TypeORM repositories
│ │ └── migrations/ # Database migrations
│ ├── services/ # External services implementation
│ └── security/ # Security related implementations
│
├── interfaces/ # Interface layer
│ ├── http/ # HTTP controllers
│ │ ├── controllers/
│ │ ├── middlewares/
│ │ ├── guards/
│ │ └── dtos/
│ └── graphql/ # GraphQL resolvers (if needed)
│
├── services/ # Application Services
│ ├── auth.service.ts
│ └── social-auth.service.ts
│
└── auth.module.ts # Module definition
```
## API Documentation
Once the application is running, you can access the Swagger documentation at:
```
http://localhost:3000/api/docs
```
## Database Migrations
```bash
# Generate migration
npm run migration:generate -- src/modules/auth/infrastructure/persistence/migrations/CreateUsersTable
# Run migrations
npm run migration:run
# Revert migrations
npm run migration:revert
```
## Contributing
1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add some 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](LICENSE) file for details.
## Support
If you find this project useful, please give it a ⭐️ on GitHub!
## Authors
- NETKO Solution
## Acknowledgments
- NestJS Team for the amazing framework
- The open-source community for inspiration and support