https://github.com/bl4cktrum/nestjs-boilerplate
NestJs Framework typescript boilerplate that implements orm, authentication and so on.
https://github.com/bl4cktrum/nestjs-boilerplate
authentication configuration nestjs typeorm typescript
Last synced: 2 months ago
JSON representation
NestJs Framework typescript boilerplate that implements orm, authentication and so on.
- Host: GitHub
- URL: https://github.com/bl4cktrum/nestjs-boilerplate
- Owner: bl4cktrum
- Created: 2023-10-07T16:59:54.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-05-21T18:19:19.000Z (about 2 years ago)
- Last Synced: 2024-05-21T19:43:57.350Z (about 2 years ago)
- Topics: authentication, configuration, nestjs, typeorm, typescript
- Language: TypeScript
- Homepage:
- Size: 122 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
[circleci-url]: https://circleci.com/gh/nestjs/nest
Nest framework TypeScript starter repository based poiler plate.
(Based on Node.js 18.18.0 LTS)
## Description
- Database connection handled by typeorm and @nestjs/typeorm module.
- Multiple environment configuration handled by cross-env and @nestjs/config module.
- Authentication features implemented by passport.js.
-
Bcrypt has been used to hash and compare strings. - Exceptions has been handled by filters, responses has been standardized by interceptors, custom decorators and class-transformer. Check out user controller, service and entity to see usage example.
## Typeorm Implementation
`Database informations` are specified in `src/db/data-source.ts` file. Also `entities'` path and `migration folder` path are. If you change the location of this file, do not forget to update the script.
```
// package.json
// first one is placed to just handle data-source. So it is recommended to use migration:*
"scripts": {
...
"typeorm": "npm run build && typeorm -d dist/db/data-source.js",
"migration:generate": "ts-node src/utils/migration-generate.ts",
"migration:run": "npm run typeorm -- migration:run",
"migration:revert": "npm run typeorm -- migration:revert"
...
}
```
to generate a new migration ```npm run migration:generate ```
```bash
$ npm run migration:generate -- CreateUserTable
```
## Environment Variables & Configuration Service
Set vars in `.env` files then add the new var in `src/app.config.ts` to be able to use it from ConfigService.
If you want to create new `environment` you have to create new scripts that sets `NODE_ENV` to run app in your env.
### ! Do not forget the ignore env files from .gitignore
```markdown
// .gitignore
**/*.env
!env/dev.env
```
## License
Nest is [MIT licensed](LICENSE).