# mihatama/open-mes-project architecture

> Architecture diagram of the GitHub repository mihatama/open-mes-project, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mihatama/open-mes-project
- Repository: https://github.com/mihatama/open-mes-project

## Overview

##### Project Type and Purpose
- This is a full-stack, containerized web application implementing an MES (Manufacturing Execution System).
- Frontend: React (Vite) single-page application with mobile/desktop views.
- Backend: Django + Django-REST Framework, organized into domain-specific apps (base, inventory, machine, master, production, quality, users).
- Infrastructure: Docker Compose orchestration, Nginx reverse proxies, Certbot for TLS, PostgreSQL database, utility scripts for test data.

##### File Structure
Top-level directories and their roles:
- backend/
- compose.yaml: orchestrates backend container
- image/: Dockerfile + Python requirements for Django service
- src/: Django project (“base” settings + multiple apps)
- frontend/
- Dockerfile(.prod): builds React app
- src/: React components, pages, layouts, utils
- index.html, package.json, nginx.conf: client served by Nginx
- db/
- compose.yaml + image/: builds PostgreSQL container
- reverse-proxy/, reverse-proxy_https/, reverse-proxy_prod/
- Dockerfiles + nginx.conf: front door for routing/SSL termination
- certbot/: builds container to obtain/renew TLS certs
- compose.yml(.prod/.https): root Docker Compose for all services
- docs/: architecture, tech-stack, API, developer guides
- script/: Python scripts for generating seed/test data

##### README for Additional Insights
- Confirms tech stack: Ubuntu, Docker, Docker Compose, PostgreSQL, Python 3.11.
- Describes environment setup, .env variables, migrations, superuser creation.
- Points to docs/ for deeper architecture and module descriptions.

##### Detailed but Focused
- How migrations (backend/src/*/migrations) interact with PostgreSQL.
- Path of static file serving: React build → Nginx → client.
- Environment config: .env, compose.yml, and how they tie components together.

## Diagram (Mermaid)

```mermaid
flowchart TD
    Client["Client (Browser/Mobile App)\nReact SPA"]:::user

    subgraph "Entry Layer"
        ProxyHTTP["HTTP Reverse-Proxy\nNginx"]:::proxy
        ProxyHTTPS["HTTPS Reverse-Proxy\nNginx"]:::proxy
        ProxyProd["Production Reverse-Proxy\nNginx"]:::proxy
        Certbot["Certbot (TLS Management)"]:::proxy
    end

    subgraph "Application Services"
        Frontend["Frontend Service\nReact/Vite + Nginx"]:::frontend
        Backend["Backend Service\nDjango/DRF Monolith"]:::backend
        Database["PostgreSQL Database"]:::db
        Scripts["Utility / Background Scripts"]:::util
    end

    Docs["Documentation & Guides"]:::docs

    Client -->|"HTTP/HTTPS"| ProxyHTTP
    Client -->|"HTTPS"| ProxyHTTPS
    ProxyHTTP -->|"Serve Static Assets"| Frontend
    ProxyHTTPS -->|"Serve Static Assets"| Frontend
    Client -->|"SPA Routing"| Frontend
    Frontend -->|"API Calls (HTTP)"| ProxyProd
    ProxyProd -->|"Forward API Calls"| Backend
    Backend -->|"SQL Queries"| Database
    Scripts -->|"Data Injection"| Backend
    Scripts -->|"Data Injection"| Database
    Backend -->|"Obtain/Renew TLS (optional)"| Certbot
    Docs -->|"Reference Guides"| Backend
    Docs -->|"Reference Guides"| Frontend

    click Client "https://github.com/mihatama/open-mes-project/blob/main/frontend/index.html"
    click Frontend "https://github.com/mihatama/open-mes-project/tree/main/frontend/Dockerfile"
    click ProxyHTTP "https://github.com/mihatama/open-mes-project/tree/main/reverse-proxy/Dockerfile"
    click ProxyHTTPS "https://github.com/mihatama/open-mes-project/tree/main/reverse-proxy_https/Dockerfile"
    click ProxyProd "https://github.com/mihatama/open-mes-project/tree/main/reverse-proxy_prod/Dockerfile"
    click Certbot "https://github.com/mihatama/open-mes-project/tree/main/certbot/Dockerfile"
    click Backend "https://github.com/mihatama/open-mes-project/blob/main/backend/src/manage.py"
    click Database "https://github.com/mihatama/open-mes-project/blob/main/db/compose.yaml"
    click Scripts "https://github.com/mihatama/open-mes-project/blob/main/script/create_comprehensive_test_data.py"
    click Docs "https://github.com/mihatama/open-mes-project/tree/main/docs/"

    classDef user fill:#E3F2FD,stroke:#1976D2,color:#0D47A1,stroke-width:2px;
    classDef frontend fill:#FFF3E0,stroke:#FB8C00,color:#E65100,stroke-width:2px;
    classDef proxy fill:#E8F5E9,stroke:#43A047,color:#1B5E20,stroke-width:2px;
    classDef backend fill:#F3E5F5,stroke:#8E24AA,color:#4A148C,stroke-width:2px;
    classDef db fill:#ECEFF1,stroke:#546E7A,color:#263238,stroke-width:2px;
    classDef util fill:#FFFDE7,stroke:#FBC02D,color:#F57F17,stroke-width:2px;
    classDef docs fill:#FBE9E7,stroke:#D84315,color:#BF360C,stroke-width:2px;
```
