/Node-Flask-MongoDB-React

Containerized Full Stack Setup with MongoDB, Flask, NodeJs+Express (Typescript), and React (Typescript)

Primary LanguageTypeScript

Containerized Full-stack setup with MongoDB, Flask and NodeJs (Typescript), and React (Typescript)

Containerized Setup

1. Prerequisites

install docker and docker-compose

2. Starting‚

run docker-compose build and docker-compose up -d (deamon)

Service specific output (stdout)

  • Flask
    • docker-compose flask --follow
  • Node
    • docker-compose node --follow
  • MongoDB
    • docker-compose mongo --follow

External Volumes

for the flask and node backend, external data can be mounted into the container via the directory data/flask or data/node respspectively.

Inside the containers, this volume can be accessed over /data. The mongo database saves all files in the directory data/db

External APIs

Flask

The flask endpoint can be reached over http://localhost:5000

Node

The node endpoint can be reached over http://localhost:3000

Local Setup

Node (folder ./node)

inside node folder

npm install
npm run serve

Flask (folder ./flask)

will use the configurations specified in .env

pip install -r requirements.txt
flask run

React (folder ./react)

npm install
npm run start

MongoDB

For the current setup, mongoDB must run on port 27027. You can either install and run mongodb locally or connect to a remote server. The default credentials for mongodb are:

MONGO_INITDB_DATABASE: my_initial_db
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: rootpassword