Skip to content

Start coding and reduce the boilerplate with this collection of modules and utils.

License

Notifications You must be signed in to change notification settings

ruslanguns/nestjs-starter

Repository files navigation

NestJs Starter

badge

This aplication server is made with NestJS and provides a scaffold with a kit of tools and utils to reduce the boilerplate when you are starting a new backend project.

Roadmap

  • IN PROGRESS!
  • Clean architecture
  • Interceptors for logging and formating the output message DataOutput interface
  • Filters for error logging handling
  • Tested collection of utils
  • Security - Helmet
  • Security - Cors
  • Security - Rate limit
  • Performance - Compress
  • Performance - Caching
  • Package @nestjs-modules/mailer for Mail integration
  • Package @nestjs/config integration with some extra tricks
  • Package @nestjs-modules/mailer integration
  • Package @nestjs/scheduler integration for scheduled tasks
  • Package @nestjs/typeorm integration
  • Package @nestjs/bull integration for queues
  • Package @ogma/logger integration for awesome logger
  • Model / Entities Abstractions
  • Authentication with Passport Local Strategy
  • Authentication with Passport JWT Strategy
  • Authentication with Passport Google Strategy
  • Authentication with Passport Facebook Strategy
  • Authentication with Passport Twitter Strategy
  • Authentication with Passport Github Strategy
  • Files feature API Enpoint
  • Files metadata API Enpoint Plus
  • User feature API Enpoint
  • Docs User feature API Enpoint
  • User information/metadata/addresses/phones API Enpoint
  • Docs User information/metadata/addresses/phones API Enpoint
  • Unit / Integration Testings - In progress
  • E2E Testings
  • Cypress Integration for e2e testings
  • OTP -One Time Password
  • Deploy with zeit now - In progress
  • Deploy with Docker - See here instructions

Requirements

  • Node installed in a machine
  • Postgres Server Database (I will provide a Docker ready to use setup for deployment in the early future) follow these instructions to setup DB with Docker.OPTIONAL

Installation

$ yarn install

Environment

Under the environment folder you will find the samples for your env files.

To use .env.development environments export NODE_ENV=development variable in your operating system, or use the cross-env which is installed in the dev dependencies of this project. To use it just run the following command before your development process:

$ npx cross_env NODE-ENV=production ... # that will point to your .env.production env file

Running the app

# development
$ yarn start

# watch mode
$ yarn start:dev

# production mode
$ yarn start:prod

Test

# unit tests
$ yarn test

# e2e tests
$ yarn test:e2e

# test coverage
$ yarn test:cov

Instruction to use Docker for Database

Build image in background and run with logs:

docker-compose -f database.yml up

Build image in background and run in the first time:

docker-compose -f database.yml up -d

To stop container:

docker-compose -f database.yml stop

To start container:

docker-compose -f database.yml stop

To remove and prune/clean:

docker-compose -f database.yml stop
docker-compose -f database.yml rm # followed by "y"
docker-compose -f database.yml down
docker-compose -f database.yml down --volumes

Deploy with docker instructions

If run for the first time you need to run the quick script for building the image and running for the first time:

yarn deploy:docker:build

Then to stop you need to run:

yarn deploy:docker:stop

To start an already builded & stoped image:

yarn deploy:docker:start

To debug:

yarn deploy:docker:debug

If you make changes in the code then you need to rebuild the image, make sure you have stoped its containers first and then run:

yarn deploy:docker:rebuild

Then you should recreate the containers in order to get the latest image changes.

yarn deploy:docker:recreate

And that's it!

To remove and prune/clean:

docker-compose -f deploy.yml stop
docker-compose -f deploy.yml rm # followed by "y"
docker-compose -f deploy.yml down
docker-compose -f deploy.yml down --volumes

Contact information

License

This application is MIT licensed.

About

Start coding and reduce the boilerplate with this collection of modules and utils.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages