A multi-container Docker-compose app with a React frontend, a Node/Express/mongoDB (the MERN stack).
Currently deployed to a Digital Ocean droplet running Ubuntu 16.04.
- Installation Instructions
- Three-tier Architecture
- Dev Decisions
- Frontend
- Backend
- Potential Improvements
Prerequisites:
- DockerCE
- docker-compose
- A free-tier Open Exchange Rates API Key (https://openexchangerates.org/)
- A free-tier Polygon.io API Key (https://polygon.io)
Clone and Run
git clone git@github.com:njwest/MERN-Docker-ExRates.git [NewAppDir]
cd [NewAppDir]
- Add your Polygon and Open Exchange Rate secrets to the relevant fields in
docker-compose.yaml
docker-compose build
docker-compose up
This app was developed with three-tier architecture, as in Frontend<->API Server<->Database.
I opted to use Axios rather than the native fetch() method for API calls in this project, as Axios does not require the json()
method in order to transfer JSON data, and fetch() does not return errors on 400 - Bad Request
responses.
I used Docker for this project because Docker containers provide easily configurable, independent Node versions per each container. Docker also provides great logging capabilities by default.
I opted to use docker-compose to build this app as it creates network relationships between different Docker containers. Docker-compose also provides common environment variables across containers (with V3 specified in docker-compose.yaml).
I deployed this demo to a Digital Ocean droplet because said droplets are inexpensive VPSs with static IPs with root access.
To my mind, Digital Ocean VPSs are ideal for demoing, as building the same demo on a network of AWS or GCP services would cost more time and money for features this demo will not need.
For an overview of the React frontend, visit the Frontend Readme
For an overview of the Node with mongoDB backend, visit the Backend Readme
- Reduxify the frontend Converter component to add currency names and rates to a shared Redux store, to reduce the need for API calls on component load.
- Save frontend state to client Local Storage so the app works offline.
- Implement NGINX reverse proxy for web server/HTTP management.
- Add SSL certification for HTTPS.
- Add real-time chart to the Socket.IO client component.
- Implement better logic to API/backup comparison of Currency Names object for the Converter.