The backend API supports the following use cases:
- Users can create records with an e-mail and password.
- Users can change their e-mail address and password.
- A user's password is validated to be at least 8 characters long.
- Users is able to remove themselves from the application.
- Users is able to add hobbies. A hobby has a name and a description.
- Users is able to change the name and description of their hobbies.
- Users is able to see a list of their hobbies.
- Uses NodeJS
- Uses Typescript
- Uses NestJS
- Uses Postgres with Knex.js
- Boilerplate Jest + NestJS unit tests
- Endpoints documented with Swagger
$ npm install# development
$ docker-compose up
# run db migrations to create tables
$ npm run db:migrate:run# development
$ npm run start:debug# unit tests
$ npm run test- Password hashing on user creation.
- Authentication: not part of the use cases covered. For authentication, in real-scenario, we might want to look into an strategy that works well with NestJS. For instance an auth service/module like Passport + bearer tokens (JWT).
- Authorization: app illustrates a basic authZ logic for update hobbies (must be same user). For restricting access to records/resources, we could exlore something like CASL: https://docs.nestjs.com/security/authorization#integrating-casl
- Logging and configuration.
- Unit tests and e2e tests: app includes basic unit tests for controllers and services. In real scenario, increase coverage to 100%. Also, resolve challenges when writing unit tests for Knex (mocking vs. using real testing db + migrations).