React / NodeJS / Mongo

Sample Repo

The repo for a sample nodejs / mongo / react app can be found here: https://github.com/getreploy/nodejs-mongo-sample

Sample file

setup:
commands:
- cp seed.js /docker-entrypoint-initdb.d/
services:
frontend:
runtime: reactjs
port: 3000
path: frontend
build:
- yarn install
- yarn build
serve:
- npx serve build/ -l 3000 -s
backend:
runtime: nodejs
port: 5000
path: backend
build:
- npm install
serve:
- node app.js
mongo:
image: mongo
port: 27017
do-not-expose: true

The reploy.yml file for this environment can also be found here:

https://github.com/getreploy/nodejs-mongo-sample/blob/master/reploy.yml

Service Description

In the above file, we have three services, each of which describe a "process" or "container". A little bit about each service:

  • The frontend service is a react app, built with the create-react-app template. It uses our curated reactjs runtime and uses the typical build commands packaged with yarn.

  • The backend service is a nodejs application, which uses our nodejs runtime and uses npm for building the app.

  • Lastly, the mongo service uses the public mongo image and reads in the seed.js file provided during the setup routine so that the other services have access to staging data.