Skip to content

A dockerized stack with Angular, NestJS, Redis & Postgres ready for DEV & PROD

License

Notifications You must be signed in to change notification settings

felixgeissler/angular-nestjs-boilerplate-stack

Repository files navigation

Angular Logo Nest Logo Docker Logo

Angular & NestJS API Boilerplate

A dockerized stack, ready for development / deployment

GitHub License GitHub repo size GitHub issues Discord

Setup for Development

  1. Create a .env copy from .env.example (adjust e.g. ports)
cp .env.dev.example .env
  1. Startup containers via docker-compose:
docker-compose up -d

Deployment

This docker setup is configured to use with an reverse proxy server in order to deploy & expose multiple docker setups from a single machine.

  1. Checkout/pull latest version of the project
  2. Create a .env copy from .env.example
cp .env.prod.example .env
  1. Edit variables in .env file (e.g. ports / secrets)
vi .env
  1. Startup containers via docker-compose:
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d

Development notes

Tooling

Tunnel to docker service shell:

docker-compose exec SERVICE_NAME_HERE /bin/sh

Additional CLI shortcuts a listed in the maidfile.md or via (Maid required):

maid help

Execute Maid tasks like:

maid TASKNAME

NPM Dependencies

Installing npm dependencies via npm install won't mount the localy installed modules into the docker context, since the anonymous volumes aren’t removed until their parent container is removed.

To overcome this issue simply run:

docker-compose up --build -V

The --build parameter will make sure the npm install is run (during the build process), and the -V argument will remove any anonymous volumes and create them again.

Debugging with VS Code

On the left-hand side of VS Code, open the Debug & Run Panel and create a launch.json file. For proper NestJS backend debugging, replace the content of the config with the following:

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "attach",
      "name": "Debug: app-name",
      "remoteRoot": "/usr/src/app",
      "localRoot": "${workspaceFolder}/backend",
      "protocol": "inspector",
      "port": 9229,
      "restart": true,
      "address": "0.0.0.0",
      "skipFiles": ["<node_internals>/**"]
    }
  ]
 }

About

A dockerized stack with Angular, NestJS, Redis & Postgres ready for DEV & PROD

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published