# sinoyuhanxiao/mes-maintenance-frontend architecture

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

- Interactive diagram: https://gitdiagram.com/sinoyuhanxiao/mes-maintenance-frontend
- Repository: https://github.com/sinoyuhanxiao/mes-maintenance-frontend

## Overview

##### Project type and purpose
- This is a single‐page application (SPA) built with Vue 3 and Vite, intended as an administrative dashboard or enterprise UI.
- It integrates with a PostgREST backend (PostgreSQL over a REST interface) and MinIO for file storage. It uses Element Plus for components, Pinia for state management, Vue Router for navigation, and a variety of charting and mapping libraries.

##### File structure
- Top-level:
- config/ – build and plugin configuration for Vite
- public/ – static assets and index.html template
- mock/ – CommonJS mock data for local development
- src/ – the heart of the SPA
– api/ – wrappers around HTTP calls to PostgREST and MinIO
– components/, layout/, views/ – Vue components (global, layout, and page views)
– router/ – route definitions and dynamic module splitting
– store/ – Pinia modules for global state
– plugins/, directive/, utils/ – application‐wide utilities and directives
- postgrest.yml – configuration for the PostgREST server
- vite.config.js – Vite build and dev server configuration

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Browser and User
    User["User"]:::external
    Browser["Browser / User Agent"]:::external

    User -->|"interacts with"| Browser
    Browser -->|"loads SPA"| SPA

    %% Front-end SPA
    subgraph "Front-end SPA (Vue3 + Vite)" 
        direction TB
        ViteDev["Vite Development Server"]:::frontend
        MockServer["Dev-time Mock Server"]:::dev
        MainJS["SPA Entry (src/main.js)"]:::frontend
        Router["Routing Modules"]:::frontend
        Store["State Management (Pinia)"]:::frontend
        Components["Global Components"]:::frontend
        Layout["Layout Components"]:::frontend
        Views["Page Views"]:::frontend
        APIWrappers["API Wrappers"]:::frontend
        Plugins["Plugins & Directives"]:::frontend
        Utils["Utilities"]:::frontend
        Icons["Icon System"]:::frontend
        Locale["Internationalization"]:::frontend
        Styles["Global Styles & Tailwind"]:::frontend
        ViteConfig["Vite Config (vite.config.js)"]:::frontend
        EnvConfigs["Environment Configs (.env*)"]:::frontend

        MainJS --> Router
        MainJS --> Store
        MainJS --> Components
        MainJS --> Layout
        MainJS --> Views
        MainJS --> APIWrappers
        MainJS --> Plugins
        MainJS --> Utils
        MainJS --> Icons
        MainJS --> Locale
        MainJS --> Styles

        ViteDev --> MainJS
        ViteDev --> ViteConfig
        ViteDev --> EnvConfigs
        ViteDev --> MockServer

        click MainJS "https://github.com/sinoyuhanxiao/mes-maintenance-frontend/blob/main/src/main.js"
        click ViteConfig "https://github.com/sinoyuhanxiao/mes-maintenance-frontend/blob/main/vite.config.js"
        click EnvConfigs "https://github.com/sinoyuhanxiao/mes-maintenance-frontend/blob/main/.env"
        click EnvConfigs "https://github.com/sinoyuhanxiao/mes-maintenance-frontend/blob/main/.env.development"
        click EnvConfigs "https://github.com/sinoyuhanxiao/mes-maintenance-frontend/blob/main/.env.production"
        click EnvConfigs "https://github.com/sinoyuhanxiao/mes-maintenance-frontend/blob/main/.env.staging"
        click MockServer "https://github.com/sinoyuhanxiao/mes-maintenance-frontend/tree/main/mock/"
        click APIWrappers "https://github.com/sinoyuhanxiao/mes-maintenance-frontend/blob/main/src/api/PostgREST.js"
        click APIWrappers "https://github.com/sinoyuhanxiao/mes-maintenance-frontend/blob/main/src/api/minio.js"
        click Components "https://github.com/sinoyuhanxiao/mes-maintenance-frontend/tree/main/src/components/"
        click Layout "https://github.com/sinoyuhanxiao/mes-maintenance-frontend/tree/main/src/layout/"
        click Views "https://github.com/sinoyuhanxiao/mes-maintenance-frontend/tree/main/src/views/"
        click Router "https://github.com/sinoyuhanxiao/mes-maintenance-frontend/blob/main/src/router/index.js"
        click Store "https://github.com/sinoyuhanxiao/mes-maintenance-frontend/blob/main/src/store/index.js"
        click Plugins "https://github.com/sinoyuhanxiao/mes-maintenance-frontend/tree/main/src/plugins/"
        click Utils "https://github.com/sinoyuhanxiao/mes-maintenance-frontend/tree/main/src/utils/"
        click Icons "https://github.com/sinoyuhanxiao/mes-maintenance-frontend/tree/main/src/icons/"
        click Locale "https://github.com/sinoyuhanxiao/mes-maintenance-frontend/tree/main/src/locale/"
        click Styles "https://github.com/sinoyuhanxiao/mes-maintenance-frontend/tree/main/src/styles/"
    end

    %% Build & Deployment
    subgraph "Build & Deployment" 
        direction TB
        Dist["Build Output (dist/)"]:::static
        CDN["CDN / Static File Server"]:::static
        ViteDev -->|"build"| Dist
        Dist -->|"deployed to"| CDN
    end

    %% Backend Services
    subgraph "Backend Services" 
        direction TB
        PostgREST["API Gateway: PostgREST"]:::backend
        click PostgREST "https://github.com/sinoyuhanxiao/mes-maintenance-frontend/blob/main/postgrest.yml"
        MinIO["Object Storage: MinIO"]:::backend
    end

    %% Data Stores
    subgraph "Data Stores" 
        direction TB
        PostgreSQL[(PostgreSQL)]:::datastore
        MinIOBay[(MinIO Buckets)]:::datastore
    end

    %% Interactions
    SPA -->|"REST API calls\n(GET/POST/PUT/DELETE)"| PostgREST
    SPA -->|"uploadObject()/downloadObject()"| MinIO
    PostgREST -->|"SQL Queries"| PostgreSQL
    MinIO -->|"stores objects"| MinIOBay

    CDN --> Browser

    %% Legend
    subgraph Legend
        direction TB
        A["Front-end Component"]:::frontend
        B["Backend Service"]:::backend
        C["Development Only"]:::dev
        D["Data Store"]:::datastore
        E["Static / CDN"]:::static
    end

    %% Styles
    classDef frontend fill:#e0f7e9,stroke:#34a853,color:#000
    classDef backend fill:#e8f0fe,stroke:#1a73e8,color:#000
    classDef dev fill:#f1f3f4,stroke:#9aa0a6,color:#000
    classDef datastore fill:#fff4e5,stroke:#fbbc04,color:#000
    classDef static fill:#fce8b2,stroke:#f9ab00,color:#000
    classDef external stroke:#000,stroke-width:1px,color:#000
```
