Skip to content
This repository has been archived by the owner on Apr 14, 2022. It is now read-only.

mugifly/angular-nest-on-docker

Repository files navigation

angular-nest-on-docker

Dockerized simple web app template with Angular v11 + NestJS + OpenAPI Generator.

Deployable on Heroku and other Docker base servers. HMR enabled. CI enabled with GitHub Actions.

CI on Docker

DEPRECATED

This repository is deprecated. Instead, I have created a new version that works with or without Docker.

-> https://github.com/mugifly/angular-nest


Key Elements

  • Angular v11 -- for Frontend app.
  • NestJS v7 -- for Backend app.
  • OpenAPI Generator CLI -- for to generate an API Client (between Angular and NestJS).
  • Docker -- for Development & Production environment.
  • Docker Compose -- for Development environment.
  • Lerna -- for make a Monorepo structure that to have Frontend and Backend in a single repository.
  • Karma + Jasmine -- for Unit testing of Frontend (with Puppeteer + Headless Chromium)
  • Jest -- for Unit testing of Backend
  • GitHub Actions -- for CI

Quick Start

Deploy on Heroku using Docker

This app supports deploying as a production environment to Heroku (with Heroku Button) or other Docker based server. Also, you don't have to do the build process locally or CI

Deploy

Develop on your local

Before you start, you should install the following software:

  • Node.js

  • Visual Studio Code

  • Docker

  • Docker Compose

Then execute as the following in your terminal:

$ git clone git@github.com:mugifly/angular-nest-on-docker.git
$ cd angular-nest-on-docker/

$ npm install

$ sudo docker-compose up -d
$ sudo docker-compose up --build app

After that, open the web browser and navigate to http://localhost:4200/.

Also, when you edit the frontend source-code, HMR applies it to your browser immediately.


Testing

Unit test for Frontend

On local (with your Chrome browser):

Requirements: Google Chrome and dependencies of Puppeteer

$ npm run test:client

On docker (with headless Chromium browser in the container):

$ sudo docker-compose up -d
$ sudo docker-compose exec app npm run test:client

Unit test for Backend

On local:

$ npm run test:server -- -- -- --watchAll

On docker:

$ sudo docker-compose up -d
$ sudo docker-compose exec app npm run test:server -- -- -- --watchAll

(NOTE: -- passes the following arguments to npm of root -> lerna -> npm of server)

E2E test

#TODO


License and Author

This project is released under the CC0 1.0 Universal license, by Masanori Ohgita (mugifly).

Therefore, a copyright notice is NOT required. Feel free to use or copy it to your project :)

NOTE: However, some sample codes and documents (e.g. packages/**/README.md) that generated by Angular CLI or Nest CLI may be based on their respective licenses.