nest
nest copied to clipboard
Starter Pack with batteries included (auth, roles, users, TypeORM, registration, etc.)
Is there an existing issue that is already proposing this?
- [X] I have searched the existing issues
Is your feature request related to a problem? Please describe it
NestJS is amazing, but I miss a customizable starter's template that provides the "batteries", similar to a default Django project or Spring Initializer. As a user, I want to be able to start a NestJS project and not focus on fundamental and repetitive tasks that are relevant for most projects, such as configuring authentication, authorization, roles and role-based access, define a user model, configure endpoints for registration and password recovery, hashing passwords, JWT based login, refresh tokens), configuring logging, configuring TypeORM, added Swagger support. Instead, I want to be able to create a new project, and immediately start working on my own implementation by create endpoints for functionality that I need (e.g., specific CRUD operations for my project, such as managing books), without the aforementioned overhead. I feel that many users who work with NestJS, including myself, spend 85-90% of their time to (learn how to) configure fundamental functionality, while they should instead be enabled to directly focus on the remaining 10-15% of their work, namely implementing their custom endpoints.
Describe the solution you'd like
When creating a new NestJS project, I want to be able to specify the functionality that I need:
- Authentication and authorization (includes: JWT, refresh token, Auth model (password recovery, login, registration, logging of authentication and authorization events, hashing passwords)
- Users model (CRUD-operations, user activation, user deactivation, user roles)
- Validation of requests, DTOs
- Guards: authentication, authorization using roles
- TypeOrm integration (both enabled and support for Users model)
- Database migrations
- Integration of Swagger, applied to Auth and User model
- Logging enabled
Other functionality could, of course, also be added.
It would be nice if I could tick the boxes for what I need, which generates a tailor-made project with the functionality that I desire. This functionality is comparable to the Spring Initializer: https://start.spring.io/
One comparable solution for NestJS that I found is https://github.com/monstar-lab-oss/nestjs-starter-rest-api, but this project is not maintained by the NestJS development team.
Teachability, documentation, adoption, migration strategy
A user starts a new NestJS project with:
nest new project-name --starter
Then the system prompts: Select the functionality that you need
[ ] Authentication [ ] Authorization [ ] Users model [ ] Swagger [ ] TypeORM [ ] Logging [ ] Database migrations [ ] Guards bundle [ ] Strict validation of requests and DTO [ ] User role
What is the motivation / use case for changing the behavior?
There are three motivations:
- To substantially decrease the learning curve for new NestJS developers, by preventing that they should learn about fairly "low-level" functionality while they instead should be enabled to implement their desired endpoints and re-use guards that are provided by NestJS.
- To stimulate that developers use NestJS "the right way", where they can re-use the safe and hardened functionality implemented by well-experienced NestJS developers. This increases the overall security and safety of APIs developed using NestJS. In other words, the public may consider NestJS as a very safe system.
- To enable quick development using NestJS, since developers don't need to spend their time on basic functionality but can directly, after generating a new project, start working on implementing their endpoints.