avatar

Piyush Himmatsinghka

DevOps Engineer

MERN Dockerized Application

1. Overview

This project is a full-stack MERN (MongoDB, Express, React, Node.js) application. The project uses Docker and Docker Compose to run the entire stack in separate containers: one for the frontend (React), one for the backend (Node.js and Express), and one for the database (MongoDB).

2. Project Highlights

  • MongoDB: Database to store records.
  • Express: Web server to serve the backend.
  • React: Frontend built to interact with the backend and display the data.
  • Node.js: Runtime for executing JavaScript on the server side.
  • Docker: Containerize the entire application.
  • Docker Compose: To orchestrate and run the multi-container application.
  • Nginx: Web server for serving the React frontend.

3. Project Structure


    .
    ├── client                  # Frontend React application
    ├── server                  # Backend Node.js and Express application
    ├── mongo-init.js           # MongoDB initialization script
    └── docker-compose.yml      # Docker Compose configuration
    

4. Docker Compose Overview

The application consists of three services:

  • server: The backend Express application running on Node.js.
  • client: The frontend React application served by Nginx.
  • mongo: The MongoDB database to store application data.

5. Environment Variables

  • ATLAS_URI: MongoDB connection string used in the backend.
  • PORT: The port the backend will run on.
  • REACT_APP_YOUR_HOSTNAME: The backend API URL used in the frontend.

Technology

Access the application:

  • The frontend will be available at http://localhost:80.
  • The backend API will be available at http://localhost:5000.