-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
229 lines (223 loc) · 13.9 KB
/
Copy pathindex.html
File metadata and controls
229 lines (223 loc) · 13.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Multi-Tenant Platform · Architecture Guide</title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Fraunces:opsz,wght@9..144,500;9..144,600&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism-tomorrow.min.css" />
<link rel="stylesheet" href="assets/styles.css" />
</head>
<body>
<div class="layout">
<aside class="sidebar">
<a href="index.html" class="brand">
<span class="brand-mark">MTP</span>
<span class="brand-text">Multi-Tenant Platform</span>
</a>
<nav>
<div class="nav-group">
<h4>Foundations</h4>
<ul>
<li><a href="index.html" class="active"><span class="nav-num">00</span>Overview</a></li>
<li><a href="docs/01-findings.html"><span class="nav-num">01</span>Findings</a></li>
<li><a href="docs/02-architecture.html"><span class="nav-num">02</span>Architecture</a></li>
<li><a href="docs/10-tenancy-model.html"><span class="nav-num">10</span>Tenancy Model</a></li>
</ul>
</div>
<div class="nav-group">
<h4>Validation</h4>
<ul>
<li><a href="docs/03-code-sketch.html"><span class="nav-num">03</span>Code Sketch</a></li>
<li><a href="docs/04-ui-rule-config.html"><span class="nav-num">04</span>UI Rule Config</a></li>
<li><a href="docs/05-result-pattern.html"><span class="nav-num">05</span>Result Pattern</a></li>
<li><a href="docs/06-reconciliation.html"><span class="nav-num">06</span>Reconciliation</a></li>
</ul>
</div>
<div class="nav-group">
<h4>Tenant Surface</h4>
<ul>
<li><a href="docs/07-ui-schema.html"><span class="nav-num">07</span>UI Schema</a></li>
<li><a href="docs/08-i18n-l10n.html"><span class="nav-num">08</span>i18n / l10n</a></li>
<li><a href="docs/09-extension-fields.html"><span class="nav-num">09</span>Extension Fields</a></li>
</ul>
</div>
<div class="nav-group">
<h4>Frontend</h4>
<ul>
<li><a href="mockups/classic.html"><span class="nav-num">UI1</span>AppShell — Classic</a></li>
<li><a href="mockups/zoho.html"><span class="nav-num">UI2</span>AppShell — 2-Stage</a></li>
<li><a href="mockups/exam-setup.html"><span class="nav-num">UI3</span>AppShell — Exam Setup</a></li>
<li><a href="mockups/ux-showcase-1.html"><span class="nav-num">UI4</span>AppShell — UX Showcase</a></li>
<li><a href="mockups/ux-showcase-2.html"><span class="nav-num">UI5</span>AppShell — UX Showcase 2</a></li>
<li><a href="mockups/ux-showcase-3.html"><span class="nav-num">UI6</span>AppShell — UX Showcase 3</a></li>
<li><a href="mockups/ux-showcase-4.html"><span class="nav-num">UI8</span>AppShell — UX Showcase 4</a></li>
<li><a href="mockups/ux-catalog.html"><span class="nav-num">UI7</span>UX Pattern Catalog</a></li>
<li><a href="mockups/notes.html"><span class="nav-num">UIN</span>AppShell Notes</a></li>
</ul>
</div>
<div class="nav-group">
<h4>Frontend — HR Module</h4>
<ul>
<li><a href="mockups/hr-attendance.html"><span class="nav-num">HR1</span>HR — Attendance</a></li>
<li><a href="mockups/hr-leave.html"><span class="nav-num">HR2</span>HR — Leave</a></li>
<li><a href="mockups/hr-salary-generation.html"><span class="nav-num">HR3</span>HR — Salary Generation</a></li>
<li><a href="mockups/hr-training.html"><span class="nav-num">HR4</span>HR — Training</a></li>
<li><a href="mockups/hr-approval-flow.html"><span class="nav-num">HR5</span>HR — Approval Flow</a></li>
<li><a href="mockups/hr-payslip-employee.html"><span class="nav-num">HR6</span>HR — Pay Slip (Employee)</a></li>
<li><a href="mockups/hr-salary-structure-designer.html"><span class="nav-num">HR7</span>HR — Salary Structure Designer</a></li>
<li><a href="mockups/hr-ff-settlement.html"><span class="nav-num">HR8</span>HR — F&F Settlement</a></li>
<li><a href="mockups/hr-tenant-config.html"><span class="nav-num">HR9</span>HR — Tenant Config Editor</a></li>
</ul>
</div>
<div class="nav-group">
<h4>Frontend — Staff Module</h4>
<ul>
<li><a href="mockups/staff-360.html"><span class="nav-num">SF1</span>Staff — 360 View</a></li>
</ul>
</div>
<div class="nav-group">
<h4>Decisions</h4>
<ul>
<li><a href="adr/0001-hybrid-validation-strategy.html"><span class="nav-num">ADR-1</span>Hybrid Validation</a></li>
<li><a href="adr/0002-database-per-client.html"><span class="nav-num">ADR-2</span>DB-per-Client</a></li>
<li><a href="adr/0003-frontend-stack.html"><span class="nav-num">ADR-3</span>Frontend Stack</a></li>
<li><a href="adr/0004-authorization-permission-model.html"><span class="nav-num">ADR-4</span>Authz & Permissions</a></li>
<li><a href="adr/0005-repo-topology.html"><span class="nav-num">ADR-5</span>Repo Topology</a></li>
<li><a href="adr/0006-no-module-federation.html"><span class="nav-num">ADR-6</span>No Module Federation</a></li>
<li><a href="adr/0007-ui-stack-radix-cssmodules.html"><span class="nav-num">ADR-7</span>UI Stack — Radix</a></li>
<li><a href="adr/0008-mtp-web-folder-structure.html"><span class="nav-num">ADR-8</span>mtp-web Folder Structure</a></li>
<li><a href="adr/0009-hr-payroll-three-aggregates.html"><span class="nav-num">ADR-9</span>HR-Payroll — 3 Aggregates, 1 Module</a></li>
</ul>
</div>
<div class="nav-group">
<h4>GNUMS — Conventions</h4>
<ul>
<li><a href="gnums/module-catalog.html"><span class="nav-num">MOD</span>Module Catalog</a></li>
<li><a href="gnums/all-modules-inventory.html"><span class="nav-num">REF</span>Procedure Inventory</a></li>
<li><a href="gnums/org-hierarchy.html"><span class="nav-num">ORG</span>Org Hierarchy</a></li>
<li><a href="gnums/hierarchy-comparison.html"><span class="nav-num">CMP</span>Hierarchy Comparison</a></li>
</ul>
</div>
<div class="nav-group">
<h4>GNUMS — Modules</h4>
<ul>
<li><a href="gnums/methodology.html"><span class="nav-num">HOW</span>Study Methodology</a></li>
<li><a href="gnums/accounting/scope.html"><span class="nav-num">ACC</span>Accounting — Scope</a></li>
<li><a href="gnums/staff/scope.html"><span class="nav-num">STF</span>Staff — Scope</a></li>
<li><a href="gnums/hr-payroll/scope.html"><span class="nav-num">HRP</span>HR-Payroll — Scope</a></li>
<li><a href="gnums/exam/scope.html"><span class="nav-num">EXM</span>Exam — Scope</a></li>
<li><a href="gnums/exam/strategy.html"><span class="nav-num">PLAY</span>Exam — Strategy</a></li>
<li><a href="gnums/student/scope.html"><span class="nav-num">STU</span>Student — Scope</a></li>
<li><a href="gnums/student/strategy.html"><span class="nav-num">SPL</span>Student — Strategy</a></li>
<li><a href="gnums/student/cluster-01-core-identity.html"><span class="nav-num">SC1</span>Student / Core Identity</a></li>
<li><a href="gnums/student/cluster-02-subordinate-entities.html"><span class="nav-num">SC2</span>Student / Subordinate Entities</a></li>
<li><a href="gnums/student/cluster-03-master-config.html"><span class="nav-num">SC3</span>Student / Master & Config</a></li>
<li><a href="gnums/student/cluster-04-certificate-workflow.html"><span class="nav-num">SC4</span>Student / Certificate Workflow</a></li>
<li><a href="gnums/student/cluster-05-bvm-activities.html"><span class="nav-num">SC5</span>Student / NCC NSS Yoga</a></li>
<li><a href="gnums/student/cluster-06-mentoring.html"><span class="nav-num">SC6</span>Student / Mentoring</a></li>
</ul>
</div>
</nav>
</aside>
<main>
<span class="eyebrow">Architecture Guide</span>
<h1>Building a configurable multi-tenant platform</h1>
<p class="lede">
Architecture for an enterprise app where every tenant can have a different validation flow,
different UI fields and labels, different languages, and different custom fields — without
forking the codebase. Plain ASP.NET Core service layer + React. No CQRS, no MediatR, no
Minimal APIs.
</p>
<div class="hero-grid">
<a class="hero-card" href="docs/01-findings.html">
<div class="num">01 · ANALYSIS</div>
<h3>Findings</h3>
<p>Where FluentValidation alone fits, where it breaks, and why a hybrid wins.</p>
</a>
<a class="hero-card" href="docs/02-architecture.html">
<div class="num">02 · DESIGN</div>
<h3>Architecture</h3>
<p>Pipeline diagram, components, storage model, resolution order, caching.</p>
</a>
<a class="hero-card" href="docs/03-code-sketch.html">
<div class="num">03 · CODE</div>
<h3>Code Sketch</h3>
<p>End-to-end C#: controller, validator, strategy, resolver, rule evaluator.</p>
</a>
<a class="hero-card" href="docs/04-ui-rule-config.html">
<div class="num">04 · CONFIG</div>
<h3>UI Rule Config</h3>
<p>Admin-authored rules, operator set, dry-run, guardrails, migration plan.</p>
</a>
<a class="hero-card" href="docs/05-result-pattern.html">
<div class="num">05 · PATTERN</div>
<h3>Result Pattern</h3>
<p>Three issue kinds — Advisory, Confirmable, Blocking. Acknowledgement protocol. HTTP mapping.</p>
</a>
<a class="hero-card" href="docs/06-reconciliation.html">
<div class="num">06 · BRIDGE</div>
<h3>Reconciliation</h3>
<p>How the pattern lands in the existing ErrorOr + ValidationProblemDetails + ApiController house style.</p>
</a>
<a class="hero-card" href="docs/07-ui-schema.html">
<div class="num">07 · UI</div>
<h3>UI Schema</h3>
<p>Per-tenant fields, labels, ordering. Server-driven metadata, stable FieldKey, narrow shape.</p>
</a>
<a class="hero-card" href="docs/08-i18n-l10n.html">
<div class="num">08 · GLOBAL</div>
<h3>i18n / l10n</h3>
<p>Locale-ready architecture from day one. i18next + IStringLocalizer + phased plan.</p>
</a>
<a class="hero-card" href="docs/09-extension-fields.html">
<div class="num">09 · EXTEND</div>
<h3>Extension Fields</h3>
<p>Client-defined custom fields via <code>jsonb</code>. Constrained types, promotion path to core.</p>
</a>
<a class="hero-card" href="docs/10-tenancy-model.html">
<div class="num">10 · ISOLATION</div>
<h3>Tenancy Model</h3>
<p>Database-per-client. JWT/header resolves connection string per request. Subdomain per client.</p>
</a>
</div>
<h2>TL;DR</h2>
<ul>
<li><strong>Tenancy</strong> — database-per-client; JWT/header resolves connection string per request; one API + one frontend deployment; subdomain per client.</li>
<li><strong>Validation</strong> — FluentValidation (shape) + Strategy (client flow) + JSON rule engine (UI-authored rules). Domain invariants stay in domain.</li>
<li><strong>Results</strong> — three issue kinds: Advisory, Confirmable, Blocking. Confirmable issues blocked until acknowledged. Maps to <code>ErrorOr<T></code> + <code>ValidationProblemDetails</code> house style.</li>
<li><strong>UI Schema</strong> — per-client fields, labels, order, grouping driven by server metadata. Stable <code>FieldKey</code>; React is a dumb renderer.</li>
<li><strong>i18n / l10n / G11n</strong> — i18next on React, <code>IStringLocalizer</code> on server, locale chain: user → client default → Accept-Language → app default. RTL ready.</li>
<li><strong>Extension Fields</strong> — client-defined scalar fields in a <code>jsonb</code> column. Constrained types. Promotion path to core.</li>
<li><strong>Flow Versioning</strong> — single rollout unit owns rules + UI schema + extension fields + strategy class. Rollback = repoint binding. Lives inside each client DB.</li>
</ul>
<h2>One organizing idea: flow versions</h2>
<p>
Every dimension of tenant variation — validation rules, field labels, custom fields,
workflow strategy, message translations — rides on the same
<strong><code>FEATURE_FLOW_VERSION</code></strong> row. Forking a version copies all of them.
Repointing a tenant's binding to a new version is the deployment unit. One audit trail. One
rollback story. One concept.
</p>
<div class="callout">
<strong>Stack:</strong> ASP.NET Core Web API (.NET 10) + React 19 + TypeScript + MUI + Zod +
React Hook Form + React Query + Zustand + Vite. PostgreSQL 17+ with <code>ltree</code>;
<strong>PascalCase</strong> identifiers, double-quoted. EF Core (Npgsql) + Dapper. ErrorOr
+ FluentValidation + i18next. Architecture style: traditional layered / service-oriented
(controllers call services via DI). <strong>DB-per-client tenancy.</strong>
<strong>No CQRS. No MediatR. No Minimal APIs.</strong>
</div>
<div class="doc-footer">
<a href="docs/01-findings.html" class="next">
<span class="label">Next</span>
<span class="title">01 · Findings →</span>
</a>
</div>
</main>
</div>
<script src="https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.min.js"></script>
<script>mermaid.initialize({ startOnLoad: true, theme: 'default' });</script>
</body>
</html>