nestjs-clean-architecture-postgres

A modular NestJS boilerplate with CQRS, Event Sourcing, DDD, Clean Architecture and Postgres. Built-in observability with Prometheus & Grafana, API docs via Swagger and Dockerized deployment. Ideal for scalable, maintainable applications.

dockerboilerplatetypescriptdocker-composeboilerplate-templategrafanapostgresqlswaggerdomain-driven-designprometheusclean-architectureevent-driven-architecture
FreeRepo

Preview

nestjs-clean-architecture-postgres preview

Overview

This is an advanced NestJS boilerplate implementing Domain-Driven Design, Clean Architecture, CQRS and Event Sourcing with PostgreSQL and TypeORM. It provides a structured foundation to ship fast with proper separation of concerns across domain, application, API and infrastructure layers, plus comprehensive security features including JWT authentication, OAuth2 integration, role-based access control, encrypted data storage, Docker containerization, health checks, structured logging, Prometheus

Features

domain-driven-designclean-architecturecqrs-patternevent-sourcingevent-driven-architecturerepository-patterndependency-inversionjwt-authenticationgoogle-oauth2-integrationapple-sign-inrole-based-access-controlpassword-hashing-bcryptsensitive-data-encryption-aes256blind-indexingcsrf-protectionhealth-checksrate-limitingrequest-throttlingswagger-api-docsdocker-containerizationdocker-composeprometheus-metricsgrafana-dashboardsunit-testsintegration-testse2e-testshigh-test-coveragemocking-patterns

Feature Flags

userDashboardauthenticationblogemailsauthorizationanalyticsloggingErrorTrackingapiDocsrateLimitingformsValidation

Recommended Use Cases

scalable-enterprise-applicationsmaintainable-backend-systemsmicroservices-foundationevent-driven-systemscomplex-business-logicmulti-tenant-applications

Frontend

None

Backend

nestjstypescripttypeormpostgresql

Auth Providers

passportjwtgoogle-oauth2apple-sign-inlocal

Deployment Targets

dockergcpdocker-compose

Payment Providers

None

Quick Facts

โญ Stars
15
๐Ÿด Forks
3
๐Ÿ”„ Active
Unknown

Stack

Framework
nestjs
Language
typescript
Database
postgresql
Auth
jwt, oauth2, google-oauth2, apple-sign-in
ORM
typeorm
Testing
jest, supertest
Monitoring
prometheus, grafana
Logging
structured-logging

Data Layer

Databases
postgresql, mongodb
ORM
typeorm

UI Stack

Developer Experience

Docker
Yes
Tests
Yes
Quickstart
Yes
env.example
No

Pricing

Classification
free
Selected
โ€”
Notes
Open source boilerplate template
Get Started with this Boilerplate