A basic MERN stack, there is another version of this in which Nginx is used a as a gateway to the application allowing for faster static file transfers, and more secure communication between the client and API.
This can be restructured into microservices.
This container works differently to my other compose projects.
Only a single point of entry is exposed on port: :8080
. From this nginx acts as a gateway to handle routing to either the client
or the api
Client Routes:
API Routes:
Mongo Express:
To get started, make sure you have Docker installed on your system, and then clone this repository.
Next, navigate in your terminal to the directory you cloned this, and spin up the containers for the web server by running docker-compose up -d --build
.
- react -
:3000
- mongodb -
:27017
- mongo-express -
:8081
- node -
:3000
- nginx -
:8080
Persistent storage is handled by a docker volume, this ensures that when you take down and spin up containers your data is not lost.
Everything in this docker setup is networked to ensure it can only communicate with each other. This makes this project akin to a single service built with a separate client and api.