# sindohmes/mes4u architecture

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

- Interactive diagram: https://gitdiagram.com/sindohmes/mes4u
- Repository: https://github.com/sindohmes/mes4u

## Overview

##### Project Type and Purpose
- mes4u is a full-stack, monolithic web application implementing a Manufacturing Execution System (MES).
- Frontend: a Vue.js SPA (based on vue-element-admin and Element UI).
- Backend: Spring Boot 2.2.6 application using MyBatis + JPA, packaging the built SPA into its static resources.
- Database: PostgreSQL 9.6.18.
- Auth: JWT-based security filtering all API calls.

##### File-Structure Analysis
- Top level:
- frontend/ → Vue.js code (components, views, router, store, API wrappers).
- src/main/java/com/sindoh/sdmes/ → Spring Boot code organized by layer:
– controller/*ApiController.java (REST endpoints)
– service/*.java (business logic)
– repository/*Repository.java (Spring Data / MyBatis)
– mapper/*.xml (MyBatis SQL mappings)
– model/*.java (domain / DTO objects)
– security/* (JWT filter, user details, config)
– specification/*.java (query specs)
- src/main/resources/static → built frontend assets (CSS/JS chunks, index.html).
- src/main/resources/application.properties → DB and JWT configuration.
- Build & deployment: Maven produces a standalone WAR/JAR, serving the SPA from Spring Boot’s embedded server.

##### Key Architectural Insights from README
- Single deployable unit combining frontend + backend.
- RESTful API endpoints for modules: MDM, Operation, Production, System, Auth.
- Uses PostgreSQL as a single relational data store.
- JWT issuance on login; stateless authentication for API calls.

##### Main Components
A. Frontend (Vue SPA)
- UI Layer: Element-UI components and pages (login, dashboard, MD​M, operation, production, system).
- API Client Module: axios wrappers in /src/api/*.js.
- State Management: Vuex store.
- Router: Vue-router for navigation.
B. Backend (Spring Boot)
- API Gateway: Spring MVC controllers map URLs to services.
- Security Layer: JWT filter → AuthTokenFilter → UserDetailsServiceImpl.
- Service Layer: AuthService, MdmService, OperationService, ProductionService, SystemService.
- Data Access:
- Repositories (Spring Data / MyBatis)
- Mapper XML (SQL queries)
- Entities/Models and View DTOs.
- Swagger UI: auto-generated API docs under /swagger-ui.
C. Database
- PostgreSQL schemas and tables.
- Sequence of calls: Service → Repository → PostgreSQL.
D. External/Infrastructure
- (Optional) CI/CD: Travis config in frontend/.travis.yml.
- (Optional) Container or VM hosting: e.g., Tomcat or Spring Boot embedded server.
- Optional Monitoring: Spring Boot Actuator endpoints.

##### Relationships & Data Flows
- Frontend → HTTP(S) → REST Controllers (login → /api/auth/signin → returns JWT)
- Frontend attaches JWT in Authorization header → Controllers
- Controllers → Services → Repositories / MyBatis Mappers → PostgreSQL
- Controllers → JSON responses → Frontend UI components
- Static file serving: Spring Boot serves index.html + JS/CSS bundles on /.
- Swagger UI endpoint available as /swagger-ui.html for API exploration.

##### Architectural Patterns & Principles
- Layered MVC in backend (Controller → Service → Repository).
- Repository pattern via Spring Data + MyBatis.
- Specification pattern for dynamic queries.
- Stateless JWT authentication for scalability.
- Monorepo packaging SPA into backend’s static resources.
- Vuex for centralized state management on client side.

##### Checklist
- Notes on protocols (HTTPS, Webpack served files)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Layer
    subgraph "Client Layer"
        direction TB
        User["User"] 
        Browser["Browser"] 
        StaticFiles["Static Resources\n(index.html, JS/CSS)"]:::infra
        UI["Vue SPA\n(Element-UI)"]:::frontend
        Router["Vue Router"]:::frontend
        Store["Vuex Store"]:::frontend
        APIClient["API Client\n(axios wrappers)"]:::frontend
        User --> Browser
        Browser -->|"GET /"| StaticFiles
        StaticFiles --> UI
        UI --> Router
        Router --> Store
        Store --> APIClient
    end

    %% API Layer
    subgraph "API Layer"
        direction TB
        JWTFilter["AuthTokenFilter\n(JWT Filter)"]:::security
        WebSec["WebSecurityConfig"]:::security
        UserDetails["UserDetailsServiceImpl"]:::security
        Controllers["Api Controllers\n(*ApiController)"]:::backend
        APIClient -->|"HTTP/JSON"| JWTFilter
        JWTFilter --> Controllers
        Controllers --> WebSec
        WebSec --> UserDetails
    end

    %% Business Layer
    subgraph "Business Layer"
        direction TB
        AuthService["AuthService"]:::backend
        MdmService["MdmService"]:::backend
        OperationService["OperationService"]:::backend
        ProductionService["ProductionService"]:::backend
        SystemService["SystemService"]:::backend
        Controllers --> AuthService
        Controllers --> MdmService
        Controllers --> OperationService
        Controllers --> ProductionService
        Controllers --> SystemService
    end

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        Repos["Repositories\n(*Repository)"]:::backend
        MyBatisInt["MyBatis Mappers\n(Java interfaces)"]:::backend
        MyBatisXML["MyBatis XML Mappings"]:::backend
        Models["Domain Models/DTOs"]:::backend
        Specs["Specifications"]:::backend
        AuthService --> Repos
        MdmService --> Repos
        OperationService --> Repos
        ProductionService --> Repos
        SystemService --> Repos
        Repos --> MyBatisInt
        MyBatisInt --> MyBatisXML
        Repos --> Models
        Repos --> Specs
    end

    %% Database
    PostgreSQL["PostgreSQL\n(9.6.18)"]:::db
    MyBatisXML --> PostgreSQL
    Specs --> PostgreSQL
    Models --> PostgreSQL

    %% Infra Layer
    subgraph "Infra Layer"
        direction TB
        Swagger["Swagger UI"]:::infra
        AppConfig["application.properties"]:::infra
        Swagger --> Controllers
        Browser -->|"GET /swagger-ui.html"| Swagger
        Travis[".travis.yml"]:::infra
        Maven["pom.xml,\nmvnw"]:::infra
    end

    %% Click Events
    click UI "https://github.com/sindohmes/mes4u/tree/master/frontend/src/components"
    click Router "https://github.com/sindohmes/mes4u/blob/master/frontend/src/router/index.js"
    click Store "https://github.com/sindohmes/mes4u/blob/master/frontend/src/store/index.js"
    click APIClient "https://github.com/sindohmes/mes4u/tree/master/frontend/src/api/"
    click StaticFiles "https://github.com/sindohmes/mes4u/blob/master/src/main/resources/static/index.html"
    click Controllers "https://github.com/sindohmes/mes4u/tree/master/src/main/java/com/sindoh/sdmes/controller/"
    click WebSec "https://github.com/sindohmes/mes4u/blob/master/src/main/java/com/sindoh/sdmes/security/WebSecurityConfig.java"
    click JWTFilter "https://github.com/sindohmes/mes4u/blob/master/src/main/java/com/sindoh/sdmes/security/jwt/AuthTokenFilter.java"
    click UserDetails "https://github.com/sindohmes/mes4u/blob/master/src/main/java/com/sindoh/sdmes/security/service/UserDetailsServiceImpl.java"
    click AuthService "https://github.com/sindohmes/mes4u/blob/master/src/main/java/com/sindoh/sdmes/service/AuthService.java"
    click MdmService "https://github.com/sindohmes/mes4u/blob/master/src/main/java/com/sindoh/sdmes/service/MdmService.java"
    click OperationService "https://github.com/sindohmes/mes4u/blob/master/src/main/java/com/sindoh/sdmes/service/OperationService.java"
    click ProductionService "https://github.com/sindohmes/mes4u/blob/master/src/main/java/com/sindoh/sdmes/service/ProductionService.java"
    click SystemService "https://github.com/sindohmes/mes4u/blob/master/src/main/java/com/sindoh/sdmes/service/SystemService.java"
    click Repos "https://github.com/sindohmes/mes4u/tree/master/src/main/java/com/sindoh/sdmes/repository/"
    click MyBatisInt "https://github.com/sindohmes/mes4u/tree/master/src/main/java/com/sindoh/sdmes/mapper/"
    click MyBatisXML "https://github.com/sindohmes/mes4u/tree/master/src/main/resources/com/sindoh/sdmes/mapper/"
    click Models "https://github.com/sindohmes/mes4u/tree/master/src/main/java/com/sindoh/sdmes/model/"
    click Specs "https://github.com/sindohmes/mes4u/tree/master/src/main/java/com/sindoh/sdmes/specification/"
    click Swagger "https://github.com/sindohmes/mes4u/blob/master/src/main/java/com/sindoh/sdmes/swagger/SwaggerConfig.java"
    click AppConfig "https://github.com/sindohmes/mes4u/blob/master/src/main/resources/application.properties"
    click Travis "https://github.com/sindohmes/mes4u/blob/master/frontend/.travis.yml"
    click Maven "https://github.com/sindohmes/mes4u/blob/master/pom.xml"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0366D6,stroke-width:1px
    classDef backend fill:#DFFFD0,stroke:#228B22,stroke-width:1px
    classDef security fill:none,stroke:#FF8800,stroke-dasharray:5 5,stroke-width:2px
    classDef db fill:#FFF0B3,stroke:#DAA520,stroke-width:1px,shape:cylinder
    classDef infra fill:#FFE4E1,stroke:#CD5C5C,stroke-width:1px
```
