This is server part of Address Book project which allows you to manage contacts. See it in action.
TLDR: Address Book DEMO | Address Book Api
Server that connects to MonogoDB exposing guarded api. Models are set using middlewares and hooks directly from Mongoose. Migrations and seed will prepare DB for intital state as well for future changes. Entire project has global config for easy control and documentation is provided by Swagger. Aside of that there are extra features like file logging and static file serve depending on need. For more info about frontend, check out client part built with Angular 8 and Ant Design UI.
Using your favorite REST client test the api or check out the swagger documentation.
Roles | User Actions | Contact Actions |
---|---|---|
Admin | CRUD any / RU* own |
CRUD any / CRUD own |
Moderator | R any* / RU* own |
RU any* / CRUD own |
User | - any / RU* own |
- any / CRUDown |
any* - except Admin
U* - except protected users
- Mongoose pre/post hooks, pagination, fuzzy-search, aggregations, validations
- Authenticate, Access control, and custom guards
- Global exception filter, standardized error message format
- Migrations and seed data
- Static file server
- Swagger documentation
- DTO validators
- Global config
- File logger
- NestJS
- Mongoose
- PassportJS
- Swagger
- Class Validator
- Class Transformer
- Faker
- Helmet
Run npm run start:dev
for a dev server. Navigate to http://localhost:3000/api/documentation
for swagger documentation.
- Node v10.16.3, Npm v6.9.0, (you can use nvm or nvm-windows)
- Nest Cli v6.14.0
Visual Studio Code is recommended. Prettier is used as formater for the project.
This project was developed with help of Insomnia, but you can use what ever suits you.
Be sure to follow current folder structure and code style in the project. Use Typescript to create better code environment with your contributions. Before adding new packages to project be sure to first check package.json
for possible duplicates.
For generating new nest components use nest generate
.
Example: nest generate controller controller-name
To get more help on the Nest CLI check out the Nest CLI README.
Run npm run start
to serve the project. Use npm run start:dev
for watch mode and npm run start:prod
for a production mode.
Run npm run build
to build the project. The build artifacts will be stored in the dist/
directory.
Run npm run test
to execute the unit tests and npm run test:e2e
to execute the end-to-end tests.
The MIT License (MIT)
Copyright (c) 2020-present, Marin Muštra