Coder Social home page Coder Social logo

mmustra / address-book-server Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 176 KB

Server built with NestJS and MongoDB

Home Page: https://mmustra-address-book.herokuapp.com

License: MIT License

TypeScript 91.84% JavaScript 8.16%
nestjs mongoose swagger-documentation passportjs seed

address-book-server's Introduction

Address Book Server

This is server part of Address Book project which allows you to manage contacts. See it in action.

           

Table of Contents

About

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.

Usage

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

Features

  • 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

Technologies

  • NestJS
  • Mongoose
  • PassportJS
  • Swagger
  • Class Validator
  • Class Transformer
  • Faker
  • Helmet

Development

Run npm run start:dev for a dev server. Navigate to http://localhost:3000/api/documentation for swagger documentation.

Requirements

IDE

Visual Studio Code is recommended. Prettier is used as formater for the project.

REST Client

This project was developed with help of Insomnia, but you can use what ever suits you.

Code style

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.

Scripts

Serve

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.

Build

Run npm run build to build the project. The build artifacts will be stored in the dist/ directory.

Running unit tests

Run npm run test to execute the unit tests and npm run test:e2e to execute the end-to-end tests.

License

The MIT License (MIT)
Copyright (c) 2020-present, Marin Muštra

address-book-server's People

Contributors

mmustra avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.