You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/01-project/ARCHITECTURE.md
+173-6Lines changed: 173 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -49,6 +49,20 @@ graph TB
49
49
SQLGEN[Connector Generator]
50
50
end
51
51
52
+
subgraph "Backend Layer (mdl/backend/)"
53
+
BACKEND[FullBackend interface]
54
+
MPRBACK[MPR Backend impl]
55
+
MOCKBACK[Mock Backend]
56
+
PAGEMUT[PageMutator]
57
+
WFMUT[WorkflowMutator]
58
+
FACTORY[BackendFactory]
59
+
end
60
+
61
+
subgraph "Shared Types (mdl/types/)"
62
+
TYPES[Domain types]
63
+
BSONUTIL[bsonutil/]
64
+
end
65
+
52
66
subgraph "Storage Layer"
53
67
READER[MPR Reader]
54
68
WRITER[MPR Writer]
@@ -76,11 +90,17 @@ graph TB
76
90
PARSER --> AST
77
91
AST --> VISITOR
78
92
VISITOR --> AST
79
-
EXEC --> SDK
93
+
EXEC --> BACKEND
80
94
EXEC --> SQLPKG
81
95
EXEC --> CATALOG
82
96
EXEC --> LINTER
83
97
98
+
BACKEND --> PAGEMUT
99
+
BACKEND --> WFMUT
100
+
MPRBACK --> BACKEND
101
+
MOCKBACK --> BACKEND
102
+
FACTORY --> MPRBACK
103
+
84
104
SDK --> DM
85
105
SDK --> MF
86
106
SDK --> PG
@@ -89,6 +109,11 @@ graph TB
89
109
SDK --> READER
90
110
SDK --> WRITER
91
111
112
+
MPRBACK --> READER
113
+
MPRBACK --> WRITER
114
+
MPRBACK --> TYPES
115
+
MPRBACK --> BSONUTIL
116
+
92
117
SQLPKG --> SQLCONN
93
118
SQLPKG --> SQLQUERY
94
119
SQLPKG --> SQLIMPORT
@@ -120,6 +145,11 @@ graph LR
120
145
CATALOGPKG[catalog/]
121
146
LINTERPKG[linter/]
122
147
REPLPKG[repl/]
148
+
BACKENDPKG[backend/]
149
+
BACKENDMPR[backend/mpr/]
150
+
BACKENDMOCK[backend/mock/]
151
+
TYPESPKG[types/]
152
+
BSONUTILPKG[bsonutil/]
123
153
end
124
154
125
155
subgraph "api/"
@@ -236,7 +266,12 @@ sequenceDiagram
236
266
|`mdl/grammar`| ANTLR4 lexer/parser (generated from MDLLexer.g4 + MDLParser.g4) |
237
267
|`mdl/ast`| AST node types for MDL statements |
238
268
|`mdl/visitor`| ANTLR listener that builds AST from parse tree |
239
-
|`mdl/executor`| Executes AST nodes against the SDK (~45k lines across 40+ files); handles domain model, microflows, pages, security, navigation, SQL, imports, OData, and more |
- Expression-type properties require non-empty values (template may have placeholders)
721
756
- See [PAGE_BSON_SERIALIZATION.md](../03-development/PAGE_BSON_SERIALIZATION.md) for detailed serialization rules
722
757
723
-
### 6. Catalog System
758
+
### 6. Pluggable Widget Engine
759
+
760
+
The **PluggableWidgetEngine** is a data-driven system that replaces hardcoded widget builders with a registry of `.def.json` widget definition files. It handles CREATE, INSERT, and ALTER operations for all pluggable (React client-side) widgets.
When a widget is written to an MPR, `AugmentTemplate` reconciles the embedded template against the project's installed `.mpk` version — adding missing properties and removing stale ones, including **nested ObjectType properties** (e.g., DataGrid2 column sub-properties). This prevents the CE0463 "widget definition changed" error when the project's widget version differs from the embedded template.
The SQLite-based catalog (`mdl/catalog/`) enables cross-reference queries and code search:
726
839
@@ -740,7 +853,7 @@ flowchart LR
740
853
741
854
Builders populate tables for modules, entities, microflows, pages, permissions, references, and source code.
742
855
743
-
### 7. Credential Isolation for External SQL
856
+
### 8. Credential Isolation for External SQL
744
857
745
858
External database credentials are managed through environment variables or YAML config, never stored in MDL scripts:
746
859
@@ -751,11 +864,11 @@ DSN resolution order:
751
864
3. Inline connection string (development only)
752
865
```
753
866
754
-
### 8. Pure Go / No CGO
867
+
### 9. Pure Go / No CGO
755
868
756
869
The project uses `modernc.org/sqlite` (a pure Go SQLite implementation) to eliminate the CGO dependency. This simplifies cross-compilation and deployment — no C compiler is required.
757
870
758
-
### 9. Multi-Version Support
871
+
### 10. Multi-Version Support
759
872
760
873
Mendix projects vary along three versioning axes: **platform version** (9.x–11.x), **widget version** (each project bundles specific `.mpk` widget packages), and **extension documents** (Mendix 11+ custom document types). The BSON document structure changes across all three.
**Planned: Schema Registry** (`sdk/schema/`): A runtime registry loaded from reflection data that provides type metadata (storage names, defaults, reference kinds, list encodings) per Mendix version. This will complement the hand-coded parsers/writers by handling field completeness, validation, and version migration. See [Multi-Version Support](../11-proposals/MULTI_VERSION_SUPPORT.md) for the full architecture and implementation status.
The mutator owns the document's lifecycle; the executor only describes *what* to change.
943
+
944
+
**Shared types (`mdl/types/`):**
945
+
946
+
Types used by both `mdl/` and `sdk/mpr` live in `mdl/types/`. The `sdk/mpr` package re-exports them as type aliases (`type JavaAction = types.JavaAction`) for backward compatibility. New shared types go in `mdl/types/`, not in `sdk/mpr/reader_types.go`.
947
+
781
948
## Future Architecture Considerations
782
949
783
950
1.**48 of 52 Metamodel Domains**: Workflows, REST services, and many other domains are not yet implemented
0 commit comments