A new service in one sitting
Fields, validation, pricing, and workflow are authored in the same wizard used to reproduce Legal Grievance — no new project, no migration, no deploy.
Cairo Governorate · Digital Services Platform · Internal Proposal
Legal Grievance (تظلم قانوني) exists today as a fully hand-built project — its own entity, controller, validators, and migration. This platform proves the same service, and the next one after it, can be authored as configuration instead: a form, a set of rules, a workflow, stored as JSON, versioned, and rendered live — with zero of that hand-coding repeated.
Where this starts
Legal Grievance works well. But it is one service, built the way every service is built today: a dedicated entity, a dedicated controller, its own FluentValidation rules, its own migration. A second service — a certificate request, a permit renewal, an enrollment form — means repeating that whole exercise. New code, new review, new deploy, one more place for a bug to hide.
A broader fix for this was proposed before and turned down as “too complicated” — a shared multi-tenant database, row-level isolation, a new hosting model to reason about. This proposal keeps the part worth keeping — configuration instead of code — and drops the part that made it complicated. No tenancy model. No new database strategy. One deployment per governorate, exactly like today.
The mechanism
Every service — Legal Grievance included — is now one row with four JSON columns. Change any of them and the platform behaves differently. Change none of the C# behind it.
Which fields exist, their type, Arabic/English labels, dropdown options, file limits.
Required/length rules, Egyptian ID and phone presets, cross-field dependencies.
Free, flat, or per-option. Legal Grievance charges 102.6 EGP at Preparatory stage.
Statuses, who can move a request between them, which actions demand a comment.
And publishing always moves through the same shape — never overwritten in place, always a new, dated snapshot:
Data, in practice
Everything below is real: the schema this service publishes today, and the actual data behind request 012026000001, submitted by Sara Youssef on 10 July 2026.
Three fields of fifteen — every other field in the service follows the same shape.
The exact same FormSchema, drawn by the exact same component the admin previews with and the employee reviews with later. The Stage and Grade fields below are live — change the stage.
DynamicData for request 012026000001 — notice what's missing.
Applicant name, National ID, and phone number aren't in here. They're promoted to real relational columns — ApplicantName, ApplicantNationalId, PhoneNumber — so National-ID tracking, the duplicate-submission guard, and search all run as ordinary SQL, not JSON_VALUE() gymnastics. Every other field stays free-form JSON.
Try the Stage/Grade fields above — choosing a stage changes which grades are even offered. That isn't a dropdown someone wired by hand. It's one rule:
The service published today includes a field Sara's form never had — added after her submission.
Her request still renders exactly as the form she filled in. Nothing breaks when the service improves.
Why it's worth doing
Fields, validation, pricing, and workflow are authored in the same wizard used to reproduce Legal Grievance — no new project, no migration, no deploy.
Every publish is a dated snapshot, not an overwrite. A request always renders under the exact version it was submitted against.
The same form-rendering component draws the citizen's form, the admin's live preview, and the employee's read-only review. Fix it once, everywhere improves.
Every label, option, and button is an {ar, en} pair inside the schema itself — not a translation pass bolted on afterward.
Legal Grievance and every service after it land in the same employee queue, with the same filters and the same review screen.
Auth/RBAC, race-safe request numbering, file storage, payment integration, and the payment-masking privacy pattern are reused as-is.
Cross-field dependencies, per-option pricing, comment-required actions — authored as data, by an admin, not a developer.
Identical payloads run against the old hand-coded Legal Grievance and the new configured one produced the same accept/reject, fee, and status results.
Being straight about it
Some of the list below is simply not built yet. Some of it is a deliberate trade-off made specifically to keep this out of "too complicated" territory again.
No shared multi-tenant database, no row-level GovernorateId filtering. Each governorate runs its own copy — the exact complexity that sank the earlier proposal.
Validation formats come from a fixed catalog — Egyptian National ID, Egyptian phone, and so on. An admin can't type an arbitrary pattern; it keeps the safety story simple and rules out ReDoS entirely.
The JSON envelope reserves a formula pricing model; the interpreter isn't written. Free, flat, and per-option pricing all work today — Legal Grievance uses per-option.
Draft → Published → Archived exists today; a "pending a second admin's sign-off" state doesn't yet, though the schema already has room for it.
Fields are reordered with up/down controls in a table, not dragged — the underlying JSON is identical either way.
The notification infrastructure carries over from the existing system but isn't wired into this workflow engine yet.
None of these exist in the current hand-coded Legal Grievance either — carried forward as future work, not a regression.
If this moves forward
The "not built" items from above, reordered by what actually matters next — plus what's staying off this list on purpose.
Draft → Published → Archived already exists; adding a "pending a second admin's sign-off" state needs no schema change — a natural first governance addition.
The notification infrastructure already exists in the current system. This is wiring it to WorkflowConfig transitions, not building it from scratch.
The JSON envelope already reserves this model. Worth building once a real service needs pricing more complex than flat or per-option — none does yet.
Cosmetic — the underlying JSON is identical to today's up/down reordering. Worth it once non-technical admins are authoring services daily.
None of these exist in the current hand-coded Legal Grievance either — add them if and when a service actually needs them.
Not on this roadmap, on purpose: multi-governorate tenancy and free-typed validation regex. Both are the deliberate trade-offs from the limitations above, not gaps waiting to be filled.
Not just a mockup
The full loop has been rehearsed live, repeatedly: author a brand-new service in the browser, publish it, have a citizen submit it with a file attached, have an employee review and approve it on the real dashboard, watch the citizen track it and see the verdict masked behind a payment step, pay, and watch the true result reveal itself. Then edit the service and republish it, and re-open the original request to confirm it still renders exactly as it did the day it was submitted.
Side by side
| Hand-coded, today | Configured, on this platform | |
|---|---|---|
| Adding a new service | New project — entity, controller, validators, migration, deploy | Fill in a wizard, click Publish |
| Changing a fee or a label | Code change, rebuild, redeploy | Edit the draft, republish — no redeploy |
| An old request after an edit | Only as safe as that particular code change happened to be | Always renders under its original snapshot |
| Employee dashboard | Built per service, if it's built at all | One dashboard, every service, automatically |
| Bilingual labels | Hand-translated, string by string | An {ar, en} pair on every field from day one |
| Confidence it still works | Manual QA, per service | The same 93 automated tests, every service |
Likely questions
The four JSON blobs already cover everything Legal Grievance needs — checked by running identical payloads against the old and new implementations. If a genuinely new rule type shows up, it's one new rule-handler class registered into the existing engine, not a new service project. And nothing here removes the option to hand-code a true one-off; it just removes the need to, for everything that looks like the services already proven.
Authoring needs no code: fields, validation, pricing, and workflow are filled in through the same wizard used to reproduce Legal Grievance. It does need judgment about what the service should ask for, so a short review step for the first few services is a reasonable guardrail — not because the tool needs a developer, but because any new government form deserves a second set of eyes.
93 automated tests cover every rule, pricing model, and workflow transition. Every accept/reject/fee/status decision was checked against the original hand-coded Legal Grievance and matched it. Auth, RBAC, file storage, payment integration, and request numbering are reused from the existing proven system, not rebuilt from scratch.
No. The production Legal Grievance service keeps running exactly as it is. This platform is a parallel proof built to reproduce its behavior faithfully — a migration decision, if any, comes later and separately.
Yes — the earlier proposal added a shared multi-tenant database and row-level isolation across governorates. This version deliberately drops that: one deployment per governorate, exactly like today. What's kept is the one idea that was never actually the objection — configuration instead of code.
Yes, trivially — nothing about it touches or removes the existing hand-coded system. It runs alongside it. Walking away means simply not building the next service on it.
Where this leaves us
Legal Grievance already proves parity with the hand-coded original it replaces. The platform underneath it is what's on the table here — built, tested, and ready to carry the next service, and the one after that.