How sindohmes/mes4u works
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, MDM, 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)