DavidProf / boilerplate-nestjs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool



nestjs-boilerplate

An awesome template to start your projects!
Explore the docs »


Table of Contents

About The Project

A boilerplate to start new scalable projects.

Here's why:

  • Your time should be focused on creating something amazing. A project that solves a problem and helps others
  • You shouldn't be doing the same tasks over and over like creating all the structure from scratch
  • You should element DRY principles to the rest of your life 😄

Of course, no one template will serve all projects since your needs may be different. So I'll be adding more in the near future. You may also suggest changes and modify this template.

A list of commonly used resources that I find helpful are listed in the acknowledgements.

Built With

This section list any major frameworks that our boilerplate is using. Leave any add-ons/plugins for the acknowledgements section.

feel free to remove what will not be useful

Getting Started

See here Prerequisites and how to start the project

Prerequisites

We mostly recommend to use yarn to manage and install the packages.

  • nodejs see how to install here

  • yarn

npm install yarn@latest -g

You may use sudo if not installed at first

May you see the official docs for install: docs

  • Mongo Database using docker
docker run -p 27017:27017 --name mongo-database -d mongo

to install without docker see the docs: Mongo Db installation

  • RabbitMq using docker
docker run -d -p 5672:5672 -p 15672:15672 --name rabbitmq-management rabbitmq:3-management

to install without docker see the docs: RabbitMQ installation

Start Dev

  1. Clone .env.sample to .env and fill variables as needed
  2. Run yarn to install NPM packages
yarn install
  1. Run dev script with yarn
yarn start:dev

Start Prod

We recommend to use docker for this.

  1. Clone .env.sample to .env and fill variables as needed
  2. Build the docker image
docker build . -t $APP_NAME
  1. Create/Run the container
docker run -p $PORT:$PORT -d $APP_NAME

Replace $PORT with the app port according to the .env

Deploy

manually

  1. Clone .env.sample to .env and fill variables as needed for the correct environment

  2. Build the docker image

docker build . -t $IMAGE_NAME:$VERSION

Replace $IMAGE_NAME and $VERSION as well (note that the image name maybe be the docker repository name as in the deployment.yml)

  1. Log In your docker cli into ECR (Elastic container registry)
docker login --username {{username}} --password-stdin
  1. Push the image
docker push $IMAGE_NAME:$VERSION
  1. Apply the changes
kubectl apply -f deployment.yml
  1. Confirm that the changes were applied and the pods are up
    • you may use

    kubectl get pods | grep $APP_NAME

try to see the logs, health check or anything to confirm that is everything okay

Usage

Please see the Documentation

Contributing

While working on this project we recommend to:

  • Use Conventional commits
  • Use yarn lint to validate project code style
  • Check if the tests are working and add tests as needed
  • Check if the build with docker is working
  • UPDATE THE DOCS

Acknowledgements

About


Languages

Language:TypeScript 94.6%Language:JavaScript 5.4%