nest-mongo-api-starter
nest-mongo-api-starter copied to clipboard
Full-featured starter for Typescript Node & Mongo Rest API featuring NestJS
nest-mongo-api-starter
Full-featured starter for Typescript Node & Mongo Rest API server featuring NestJS!
Getting started
- Install packages with
yarn install
- Create env file
cp .env.example .env
- Configure mongo db URL (e.g. one pointing to Mongo Atlas)
- Develop app
yarn start:dev
What's Inside
- dotenv environment variables
- MongoDB/mongoose configuration
- Passport authentication
- Validation with class-validator
- Mailer
- Serve-static middleware
- Compression
- Security with helmet
- Logging middleware (Bunyan)
- Swagger documentation
- Access logs with Morgan interceptor
Authorization features with end-to-end tests:
Features:
- user signup
- user activation
- user login
- user relogin
- password reset
- forgotten password
Configuring swagger
This project uses modular swagger configuration. Each feature has it's own swagger document. Follow these steps to add new feature:
- In feature folder create
feature.swagger.ts
file. - Call
setupSwaggerDocument
and export the returned function. - Register feature module in
feature.module.ts
by calling the exported function from step 2. - Access your document at
/docs/:featurePath
.
For a concrete example see the auth feature.
More
This backend will play nicely with awesome react-starter create-react-app project written in Typescript!
License
MIT