How zmrid/imes-factory works
1. This is a split full-stack MES/MOM system with two top-level apps: a .NET backend under iMES.Net and a Vue 3 frontend under iMES.Vue3. The backend exposes a large REST API surface plus SignalR hubs; the frontend is a dynamic admin/business UI built around generated pages and reusable table/form components.
2. The backend is organized as a modular monolith by business domain. Major domain assemblies are System, Calendar, Custom, Warehouse, Tools, Quality, Equip, Report, and Builder. Each module repeats the same layered pattern: Controllers in iMES.WebApi, Services and Repositories in a domain project, and entity/mapping types in iMES.Entity.
3. The core architecture uses a repository/service pattern on top of EF Core and some Dapper support. iMES.Core contains the shared abstractions, base classes, DB and tenancy helpers, caching, middleware, logging, Quartz integration, Kafka integration, workflow, validation, and security utilities. Domain-specific repositories/services depend on these base abstractions rather than each other.
4. Data access is split between EF Core and Dapper. EF Core contexts live in iMES.Core/EFDbContext and map to the entity models in iMES.Entity/DomainModels with explicit mapping configuration classes. Dapper is available for lower-level SQL access and custom query handling, which is relevant for reporting and optimized reads.
5. The database boundary is explicit and vendor-aware. SQL scripts are provided for both MySQL and SQL Server under DB/MySQL and DB/SQLServer, and the appsettings configuration selects the database type. This means the same domain model is intended to run against different relational backends.
6. The business data model is broad but consistent: system/auth tables, workflow/form tables, calendar/shift planning, inventory/warehouse documents, quality inspection records, equipment maintenance assets, tools circulation, and reporting views. Many “View_” entities indicate read-only reporting projections backed by database views.
7. Controllers in iMES.WebApi are almost entirely thin endpoints grouped by module. They map API requests to the corresponding service layer, and there are “Partial” controller/service/repository patterns throughout the repo. That pattern is a key architectural boundary: generated base code lives alongside handwritten extension code without overwriting custom logic.
8. The Builder module is the code-generation subsystem. It inspects table metadata through sys-table information services and produces backend/frontend artifacts from templates stored in iMES.WebApi/Template. This generator is the core of the framework’s “rapid development” story and explains the repeated file structure across modules.
9. Cross-cutting runtime services are centralized in iMES.Core. Notable concerns include JWT/auth filters, permission filters, exception and request middleware, caching via memory or Redis, Quartz scheduled jobs, Kafka producers/consumers, workflow approval helpers, and utility functions for file, PDF, Excel, mail, encryption, and verification codes.
10. Authentication and authorization are enforced at the framework level rather than in individual modules. The repo includes JWT-based authorization, action permission filters, role/user context objects, and menu/permission entities. This supports a menu-driven admin UI and module-level permission checks.
11. Real-time and background integration points are present but secondary to the CRUD backbone. SignalR is used for the home page message hub and likely push notifications, while Quartz handles scheduled tasks and logging of job execution. Kafka classes exist for async message handling, and there is a dedicated MqDataHandle controller in the web API.
12. The frontend mirrors the backend’s modular structure. In src/extension, each backend entity/module has a corresponding generated API binding, page definition, and often custom Vue extensions. Views, components, and route tables are organized by module, with shared generic components for grids, forms, uploads, workflow, redirects, and dashboards.
13. The frontend is designed for dynamic configuration, not hardcoded screens. Table/grid/form metadata, permission-driven menus, and reusable “ViewGrid” and “MesForm” components make the UI behave like a configurable admin framework. This matches the backend’s code generation and metadata-driven model.
14. Static assets and generated artifacts are stored inside the backend web root as well as the frontend app. The backend’s wwwroot/Upload/Tables contains generated code, exports, templates, and uploaded files tied to table names, which indicates the system persists generated artifacts and attachments alongside runtime files.
15. A useful diagram boundary is: browser UI → Vue app state/router/components → REST/SignalR endpoints in WebApi → module services → repositories/EF/Dapper → relational database, with shared Core services providing auth, caching, jobs, messaging, and utility functions across the entire backend.
Main entry points: iMES.WebApi Web API · iMES.Core Core · iMES.Entity Entity · extension UI Extensions
Components 18
iMES.Net
ASP.NET modular monolith backend and shared framework code.
- Web API · Thin REST controllers, SignalR hubs, and templates for generated artifacts.
iMES.Net/iMES.WebApi - Core · Cross-cutting abstractions: base repo/service types, auth, caching, middleware, jobs, Kafka, workflow, validation, utilities, and EF/Dapper helpers.
iMES.Net/iMES.Core - Entity · Shared entity classes and EF mapping configurations for all business domains.
iMES.Net/iMES.Entity - System · Users, roles, menus, permissions, dictionaries, workflow metadata, forms, logs, and Quartz options.
iMES.Net/iMES.System - Custom · Factory-specific master data such as products, workshops, processes, notices, and rules.
iMES.Net/iMES.Custom - Calendar · Holiday, team, plan, and shift planning services.
iMES.Net/iMES.Calendar - Warehouse · Warehouse bills and stock balance/reporting views.
iMES.Net/iMES.Warehouse - Quality · Incoming, process, and outgoing inspection records plus test items and templates.
iMES.Net/iMES.Quality - Equip · Device catalogs, assets, spot maintenance plans, and work orders.
iMES.Net/iMES.Equip - Tools · Tool types, tool inventory, receiving, and return flows.
iMES.Net/iMES.Tools - Report · Read-only reporting views and summary outputs, likely optimized with Dapper.
iMES.Net/iMES.Report - Builder · Metadata-driven generator that emits backend and frontend artifacts from templates.
iMES.Net/iMES.Builder - Generated Files · Uploaded files, exported code, templates, and table-scoped artifacts stored under the web root.
iMES.Net/iMES.WebApi/wwwroot/Upload/Tables
iMES.Vue3
Vue 3 admin UI and generated module pages.
- Vue App · Vue 3 application shell, router, store, and bootstrap entrypoint.
iMES.Vue3/src - UI Core · Reusable grid, form, upload, workflow, redirect, and menu components.
iMES.Vue3/src/components/basic - UI Extensions · Module-specific API bindings, page configs, and custom Vue extensions mirrored from backend domains.
iMES.Vue3/src/extension - Views · Renderable screens for system, business modules, dashboards, login, and generated CRUD pages.
iMES.Vue3/src/views
DB
Vendor-specific SQL scripts and schema assets.
- SQL Scripts · MySQL and SQL Server schema/data scripts for the same domain model.
DB
Connections 20
- Web API → Core: uses · Controllers and host pipeline depend on shared framework services and abstractions.
- Web API → Entity: maps · API layer passes entity and DTO models through controllers and generated endpoints.
- Web API → System: hosts · System controllers expose admin/auth/workflow APIs.
- Web API → Custom: hosts · Custom domain controllers expose process and master-data APIs.
- Web API → Calendar: hosts · Calendar controllers expose planning APIs.
- Web API → Warehouse: hosts · Warehouse controllers expose stock and bill APIs.
- Web API → Quality: hosts · Quality controllers expose inspection APIs.
- Web API → Equip: hosts · Equipment controllers expose maintenance APIs.
- Web API → Tools: hosts · Tools controllers expose circulation APIs.
- Web API → Report: hosts · Report controllers expose projection endpoints.
- Builder → Web API: generates · Generator writes backend controllers, repositories, services, and templates.
- Builder → UI Extensions: generates · Generator emits frontend extension metadata and page artifacts.
- Entity → SQL Scripts: mirrors · Entity model is intended to fit vendor-specific relational schemas.
- Core → SQL Scripts: configures · DB helpers and configuration select database type and connections.
- Core → Entity: bases on · Shared base entity and mapping infrastructure support domain models.
- Vue App → UI Core: composes · Application shell renders reusable UI primitives.
- Vue App → UI Extensions: loads · Routes and page definitions are assembled from generated extensions.
- UI Extensions → Views: feeds · Module extensions connect metadata to concrete pages.
- Views → Web API: calls · Pages invoke REST endpoints and SignalR-facing features.
- Web API → Generated Files: stores · Generated outputs, exports, and upload artifacts live in the web root.