This repo will representative of authentication service and authorization service
ACK NestJs is a Http NestJs v11.x boilerplate. Best uses for backend service.
You can request feature or report bug with following this link
- Stateful Authorization, using
redis-sessionandJWT. - Must run MongoDB as a
replication setfordatabase transactions. - If you change the environment value of
APP_ENVtoproduction, it will disable Documentation. - For monitoring, this project will use
sentry.io, and sent unhandled error and/orinternal server error. - Since version
7.4.0, the project uses theES512algorithm for JWT authentication. - When using multiple protection decorators, they must be applied in the correct order:
@ExampleDoc() @PolicyAbilityProtected({...}) @PolicyRoleProtected(...) @UserProtected() @AuthJwtAccessProtected() @ApiKeyProtected() @Get('/some-endpoint')
- Improve eslint rule for better code quality (high priority, in v8)
- Move some function in service layer into repository module, because a bit wrong implementation (high priority, in v8
- 2FA Feats (high priority, in v8)
- Reset password (medium priority, in v8)
- Export Module in Background using bullmq (medium priority, in v8)
- Unit test (medium priority)
- Add Github SSO (low priority)
- Privacy Policy Module (versioning, lowest priority)
- Term and Condition Module (versioning, lowest priority)
If you find this project helpful and would like to support its development, you can buy me a coffee
or support via PayPal
I assume that everyone who comes here is a programmer with intermediate knowledge. To get the most out of this project, here's what you should understand:
- NestJs Fundamentals, as the main Framework. A NodeJs Framework with full TypeScript support.
- Typescript Fundamentals, as the main Programming Language. This will help you read and write the code.
- ExpressJs Fundamentals, as the base NodeJs Framework. This will help you understand how the NestJs Framework works.
- Understanding of databases, especially NoSQL and MongoDB.
- Repository Design Pattern or Data Access Object Design Pattern. This will help in reading and writing the source code.
- The SOLID Principle for better code writing.
- Optional. Microservice Architecture. This can help you understand this project more deeply.
- Optional. The Twelve Factor Apps. This can help with project deployment.
- Optional. Docker.
The project is built using the following technologies and versions:
| Name | Version |
|---|---|
| NestJs | v11.x |
| NestJs Swagger | v11.0.x |
| Node | v22.13.x |
| Typescript | v5.8.x |
| Mongoose | v8.12.x |
| MongoDB | v8.x |
| Yarn | v1.22.x |
| Docker | v27.4.x |
| Docker Compose | v2.31.x |
- Easy to maintenance
- NestJs Habit
- Component based / modular folder structure
- Stateful authentication and authorization
- Repository Design Pattern
- Follow Community Guide Line
- Follow The Twelve-Factor App
- NestJs 11.x π₯³
- Typescript π
- Production ready π₯
- MongoDB integrate by using mongoose π
- Cached response with redis.
- Queue bullmq with redis.
- Logger with pino π²
- SWC (Speedy Web Compiler) Compiler, fast compiler.
- Authorization, Role, and session Management (can revoke).
- Repository Design Pattern.
- Authentication (
Access Token,Refresh Token,API Key,Google SSO,Apple SSO) - Export data with CSV or Excel by using
decorator. - Support multi-language
i18nπ£, can controllable with request headerx-custom-lang - Request validation for all request params, query, dan body with
class-validation - Swagger / OpenAPI 3 included.
- Url Versioning, default version is
1. - Server Side Pagination.
- Sentry.io for Monitoring Tools.
- Support Docker installation.
- Husky GitHook for run linter before commit πΆ.
- Linter with EsLint for Typescript.
For detailed installation instructions (both standard and Docker-based), please refer to the Installation.
The project includes a migration system for populating the database with initial data using nestjs-command. Migration functions include:
- Seeding default API keys, countries, roles, and users
- Managing email templates for the notification system
- Commands for adding or removing seed data
For complete documentation and instructions on using migrations, see the Migration.
Distributed under MIT licensed.
I welcome contributions to this project! To contribute, follow these steps:
- Fork the repository.
- Create a new branch:
git checkout -b feature/your-feature-name. - Make your changes and commit them:
git commit -m 'Add some feature'. - Push to the branch:
git push origin feature/your-feature-name. - Open a pull request.
Please ensure your code follows the project's coding standards and includes appropriate tests.
If your branch is behind the origin/main branch, please update your branch and resolve any conflicts before opening a pull request.