Skip to content

jonnyfux/REST-Docker-Template

Repository files navigation

REST Docker Template

Since I just started with REST development, I found it quite challenging to get a development environment up and running. After many unexpected errors, I came up with this setup, which includes a Frontend, Backend, and Database.

This setup is mainly intended for development, but with some changes, it can be used for development as well (see below). It features hot reloading for the Angular Frontend (= if you make changes the Web-App will be reloaded automatically) and the backend (in this case you have to manually reload the page). All the different components (Frontend, Backend, Database) are set up through Docker-Compose which makes it easy and fast to start developing. It also ensures that this is usable in any developing environment. The components are connected through an Nginx-Server which is used as a 'Reverse Proxy' here (read more: https://www.nginx.com/resources/glossary/reverse-proxy-server/).

I hope this setup will help some people to get started with their own Web-App. Since I’m still learning, I’m glad for any feedback or improvements through Issues! If this template helped you I would appreciate a star ;)

Technologies

Frontend

Backend

Database

Network

Containerization & Orchastration

How to get started (Development)

Prerequisite

Starting the app

  • Run cd backend && npm i. Then navigate back to the root folder. (Necessary for hot reloading of the backend, because of the usage of Docker Volumes)
  • Run docker-compose build
  • Run docker-compose up or docker-compose up -d (https://docs.docker.com/compose/reference/up/)
  • In a separate terminal (or the same if you ran docker-compose up -d)
  • Run cd frontend && npm i && npm run startDev

After everything started without errors you should see the app under 'http://localhost:4200/'. Note this setup is intended for developing purposes only!

Changes for Deployment