# devopsinsiders/reacttodouimonolith architecture

> Architecture diagram of the GitHub repository devopsinsiders/reacttodouimonolith, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/devopsinsiders/reacttodouimonolith
- Repository: https://github.com/devopsinsiders/reacttodouimonolith

## Overview

##### Project type and purpose
- This is a full-stack “Todo App” where the provided repo contains only the frontend: a React single-page application (SPA).
- The frontend is built with Create React App, served as static assets by Nginx on a Frontend VM, and communicates over HTTP to a backend (“/api”) which lives on a separate Backend VM.

##### File structure
- Top-level:
- public/ – static HTML, manifest, robots.txt
- src/ – React source code (App.js, TodoApp.js, theme.js, tests, etc.)
- package.json, package-lock.json – npm dependencies and scripts
- README.md – build, deploy, and proxy instructions
- No backend code here; the frontend performs fetch calls to `API_BASE_URL` defined in src/TodoApp.js.
- Nginx configuration is managed outside this repo, but the README shows how to proxy “/api” to the backend VM’s port 8000.

##### README for additional insights
- Build “npm run build” → produces static files
- Deployment on Nginx: copy build artifacts to `/var/www/html`
- Proxy `/api` from Frontend Nginx to Backend VM at http://<PrivateIP>:8000
- Update `API_BASE_URL` in src/TodoApp.js to http://<FrontendVM Public IP>/api

##### Elements
- Clear labels: “Browser”, “Frontend Nginx”, “React SPA”, “Backend Nginx”, “App Server (port 8000)”, “Database”
↳ Browser → Frontend Nginx → React JS/CSS
↳ React → Frontend Nginx → Backend Nginx → App Server → Database
and back along the same path.

##### Detail is key
- Nginx role separately (static vs. proxy).
- Port numbers (80 for Nginx, 8000 for backend).
- Where `API_BASE_URL` is configured in the code.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Nodes
    Browser["Browser"]:::user

    subgraph "Frontend VM" 
        FN["Frontend Nginx (port 80)"]:::infra
        subgraph "React SPA"
            subgraph "Source Code"
                SRC["src/"]:::frontend
                IDX["src/index.js"]:::frontend
                AAPP["src/App.js"]:::frontend
                TODOS["src/TodoApp.js"]:::frontend
                THEME["src/theme.js"]:::frontend
                CSS["src/App.css"]:::frontend
                SETUP["src/setupTests.js"]:::frontend
                TST["src/App.test.js"]:::frontend
                RWEBV["src/reportWebVitals.js"]:::frontend
            end
            subgraph "Static Assets"
                PUBDIR["public/"]:::frontend
                INHTML["public/index.html"]:::frontend
                MANI["public/manifest.json"]:::frontend
                ROBOT["public/robots.txt"]:::frontend
            end
            PJSON["package.json"]:::frontend
            PLOCK["package-lock.json"]:::frontend
            RMD["README.md"]:::frontend
        end
    end

    subgraph "Backend VM"
        BN["Backend Nginx (port 80)"]:::infra
        App["App Server (port 8000)"]:::infra
        DB["Database"]:::database
    end

    %% Flows
    Browser -->|"HTTP GET /"| FN
    FN -->|"Serves index.html + JS/CSS"| Browser
    Browser -->|"fetch \"/api/...\""| FN
    FN -->|"proxy /api to Back-end"| BN
    BN -->|"forward to port 8000"| App
    App -->|"queries"| DB
    DB -->|"results"| App
    App -->|"JSON response"| BN
    BN -->|"proxied response"| FN
    FN -->|"JSON response"| Browser

    %% Click Events
    click SRC "https://github.com/devopsinsiders/reacttodouimonolith/tree/main/src/"
    click IDX "https://github.com/devopsinsiders/reacttodouimonolith/blob/main/src/index.js"
    click AAPP "https://github.com/devopsinsiders/reacttodouimonolith/blob/main/src/App.js"
    click TODOS "https://github.com/devopsinsiders/reacttodouimonolith/blob/main/src/TodoApp.js"
    click THEME "https://github.com/devopsinsiders/reacttodouimonolith/blob/main/src/theme.js"
    click CSS "https://github.com/devopsinsiders/reacttodouimonolith/blob/main/src/App.css"
    click SETUP "https://github.com/devopsinsiders/reacttodouimonolith/blob/main/src/setupTests.js"
    click TST "https://github.com/devopsinsiders/reacttodouimonolith/blob/main/src/App.test.js"
    click RWEBV "https://github.com/devopsinsiders/reacttodouimonolith/blob/main/src/reportWebVitals.js"
    click PUBDIR "https://github.com/devopsinsiders/reacttodouimonolith/tree/main/public/"
    click INHTML "https://github.com/devopsinsiders/reacttodouimonolith/blob/main/public/index.html"
    click MANI "https://github.com/devopsinsiders/reacttodouimonolith/blob/main/public/manifest.json"
    click ROBOT "https://github.com/devopsinsiders/reacttodouimonolith/blob/main/public/robots.txt"
    click PJSON "https://github.com/devopsinsiders/reacttodouimonolith/blob/main/package.json"
    click PLOCK "https://github.com/devopsinsiders/reacttodouimonolith/blob/main/package-lock.json"
    click RMD "https://github.com/devopsinsiders/reacttodouimonolith/blob/main/README.md"

    %% Styles
    classDef user fill:#a8f0c6,stroke:#333,stroke-width:1px
    classDef infra fill:#a0c4ff,stroke:#333,stroke-width:1px
    classDef frontend fill:#caffbf,stroke:#333,stroke-width:1px
    classDef database fill:#ffd6a5,stroke:#333,stroke-width:1px
```
