Building Production-Ready NestJS Apps: Introducing Nestier
Starting a new NestJS project? Tired of setting up the same architecture patterns, authentication, and infrastructure code over and over? I've been there too.
That's why I built Nestier — a production-ready NestJS boilerplate that demonstrates best practices in enterprise application development.
What is Nestier?
Nestier is a comprehensive NestJS boilerplate that implements Hexagonal Architecture (ports & adapters) and the Generic Repository Pattern. It's designed to help you build scalable, maintainable applications from day one.
Key Features
✨ Hexagonal Architecture - Clean separation of concerns with domain, application, infrastructure, and presentation layers
🔐 JWT Authentication - Complete auth flow with password reset
📊 Generic Repository Pattern - Reusable CRUD operations via TypeORM
🔍 Advanced Search - Dynamic filtering with multiple comparators
📝 80%+ Test Coverage - 212 tests (127 unit + 85 E2E)
🐳 Docker Ready - Full stack with MongoDB and SonarQube
📚 Swagger/OpenAPI - Auto-generated API documentation
🛡️ Security First - Helmet, rate limiting, input validation
Architecture Overview
The project follows a strict hexagonal architecture with four distinct layers:
Domain Layer → Business logic, entities, repository interfaces
Application Layer → Use cases, services, orchestration
Infrastructure → TypeORM repositories, adapters, external services
Presentation → Controllers, DTOs, validation
This architecture ensures that your business logic remains independent of frameworks and external concerns, making your code more testable and maintainable.
Three Implementation Examples
Nestier includes three example modules that demonstrate different implementation approaches:
- Category Module - Simple CRUD using base components
- Product Module - Extended with custom use cases and repository methods
- User Module - Full custom implementation with JWT authentication
This gives you flexibility to choose the right pattern for each feature in your application.
Quick Start
Getting started is straightforward:
# Clone the repository
git clone https://github.com/BrahimAbdelli/nestier.git
cd nestier
# Install dependencies
npm install
# Set up environment
cp .env.example .env
# Start the app
npm run start:dev
The API will be available at http://localhost:3000/api with Swagger docs at http://localhost:3000/docs.
Why Hexagonal Architecture?
Traditional layered architectures often lead to tight coupling between layers. Hexagonal architecture solves this by:
- Isolating business logic from infrastructure concerns
- Making testing easier through dependency inversion
- Enabling flexibility to swap implementations (e.g., switch databases)
- Improving maintainability with clear boundaries
Here's a simple example of how the repository pattern works:
// Domain layer - Repository interface (port)
interface BaseRepository<T> {
findById(id: string): Promise<T | null>;
findAll(): Promise<T[]>;
create(entity: T): Promise<T>;
}
// Infrastructure layer - TypeORM implementation (adapter)
class TypeOrmBaseRepository<T> implements BaseRepository<T> {
// TypeORM-specific implementation
}
What's Included
- ✅ JWT authentication with password reset flow
- ✅ Advanced search with filtering and pagination
- ✅ Soft delete functionality
- ✅ AutoMapper for entity ↔ domain ↔ DTO mapping
- ✅ Winston logger with structured logging
- ✅ Mailjet integration for emails
- ✅ Comprehensive error handling
- ✅ Docker and Docker Compose setup
- ✅ CI/CD with GitHub Actions
- ✅ SonarQube integration for code quality
Perfect For
- 🚀 Starting new NestJS projects
- 📚 Learning hexagonal architecture patterns
- 🏢 Building enterprise applications
- 🎓 Teaching clean architecture principles
- ⚡ Rapid prototyping with production-ready foundation
Get Started Today
Ready to build your next application with a solid foundation?
👉 Star the repository: github.com/BrahimAbdelli/nestier
👉 Article: brahimabdelli.dev/articles/2026/nestier/
Have questions or suggestions? Feel free to open an issue or start a discussion!
What patterns do you use in your NestJS projects? Share your thoughts in the comments below! 👇