- Role based authentication with firebase 🔐
- PostgreSQL with TypeORM 💾
- Swagger 📚
- Send mails via SMTP server 📧
- FCM notifications ✉️
All entities that have a @VersionColumn
(all by default) will be automatically version checked thanks to the OptimisticLockingSubscriber
from here.
Use the following decorators on your controller class :
@UseGuards(FirebaseAuthGuard, RolesGuard)
@RolesAllowed(Roles.ADMIN)
This will enable access control for all the routes within this controller and allow the ADMIN
users to access all routes by default.
If you want for example to additionally allow USER
users to access a specific route only you can use the same decorator on the route :
@RolesAllowed(Roles.USER)
To allow everyone to access a route and to bypass class-level restrictions on a specific route, you can use the @Public
decorator.
Please see src/users/users.contoller.ts
as an example.
- Install dependencies
$ yarn install
-
Add the
service-account.json
(for firebase authentication) file at the root of the project. -
Create the
.env
file from.env.example
and replace values. -
Setup database
$ docker-compose up -d
# development
$ yarn run start
# watch mode
$ yarn run start:dev
# production mode
$ yarn run start:prod
# unit tests
$ yarn run test
# e2e tests
$ yarn run test:e2e
# test coverage
$ yarn run test:cov