Gov Services Builder

Cairo Governorate · Digital Services Platform · Internal Proposal

Ship a new government service without shipping new code.

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.

Milestones shipped
8 / 8
Engine tests
93
Live applications
3
Shared form renderer
1

Where this starts

One service, one project — every time.

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

Four JSON documents replace four hardcoded decisions.

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.

FormSchema

Which fields exist, their type, Arabic/English labels, dropdown options, file limits.

ValidationRules

Required/length rules, Egyptian ID and phone presets, cross-field dependencies.

PricingRules

Free, flat, or per-option. Legal Grievance charges 102.6 EGP at Preparatory stage.

WorkflowConfig

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:

  1. 1Admin drafts & publishes
  2. 2Citizen submits against that version
  3. 3Employee reviews on the dashboard
  4. 4Citizen tracks status, pays if due
  5. 5Service changes — old requests don't

Data, in practice

Legal Grievance, as JSON — start to finish.

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.

Cross-field logic, no code

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:

Old requests don't move

The service published today includes a field Sara's form never had — added after her submission.

Published now
Sara's snapshot · 10 Jul
— field doesn't exist here —

Her request still renders exactly as the form she filled in. Nothing breaks when the service improves.

Why it's worth doing

What this buys you

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.

Old requests are unbreakable

Every publish is a dated snapshot, not an overwrite. A request always renders under the exact version it was submitted against.

One renderer, three places

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.

Bilingual from the first field

Every label, option, and button is an {ar, en} pair inside the schema itself — not a translation pass bolted on afterward.

One dashboard, every service

Legal Grievance and every service after it land in the same employee queue, with the same filters and the same review screen.

Proven infrastructure, not rebuilt

Auth/RBAC, race-safe request numbering, file storage, payment integration, and the payment-masking privacy pattern are reused as-is.

Rules an admin screen can express

Cross-field dependencies, per-option pricing, comment-required actions — authored as data, by an admin, not a developer.

Checked against the original

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

What this doesn't do — yet, or on purpose

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.

By design

One deployment per governorate

No shared multi-tenant database, no row-level GovernorateId filtering. Each governorate runs its own copy — the exact complexity that sank the earlier proposal.

By design

Named presets, not free-typed regex

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.

Not built

Formula-based pricing

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.

Not built

Publish-approval workflow

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.

Not built

Drag-and-drop form design

Fields are reordered with up/down controls in a table, not dragged — the underlying JSON is identical either way.

Not built

SMS / email on status change

The notification infrastructure carries over from the existing system but isn't wired into this workflow engine yet.

Not built

Excel export, assign-to-employee, nested AND/OR rules

None of these exist in the current hand-coded Legal Grievance either — carried forward as future work, not a regression.

If this moves forward

What's next, in order

The "not built" items from above, reordered by what actually matters next — plus what's staying off this list on purpose.

Next

Publish-approval workflow

Draft → Published → Archived already exists; adding a "pending a second admin's sign-off" state needs no schema change — a natural first governance addition.

Next

SMS / email on status change

The notification infrastructure already exists in the current system. This is wiring it to WorkflowConfig transitions, not building it from scratch.

Later

Formula-based pricing

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.

Later

Drag-and-drop form design

Cosmetic — the underlying JSON is identical to today's up/down reordering. Worth it once non-technical admins are authoring services daily.

Later

Excel export, assign-to-employee, nested AND/OR rules

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

What's actually been run, end to end

8 / 8planned milestones shipped
93automated engine tests
3real applications — citizen, admin, dashboard
2real bugs found in testing, and fixed

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

Before and after this platform

Hand-coded, todayConfigured, on this platform
Adding a new serviceNew project — entity, controller, validators, migration, deployFill in a wizard, click Publish
Changing a fee or a labelCode change, rebuild, redeployEdit the draft, republish — no redeploy
An old request after an editOnly as safe as that particular code change happened to beAlways renders under its original snapshot
Employee dashboardBuilt per service, if it's built at allOne dashboard, every service, automatically
Bilingual labelsHand-translated, string by stringAn {ar, en} pair on every field from day one
Confidence it still worksManual QA, per serviceThe same 93 automated tests, every service

Likely questions

Before you ask

What if a future service needs something the builder can't express?

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.

Who actually authors a new service — do we still need a developer?

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.

Is this production-safe, or a fragile demo?

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.

Does this touch or migrate the live Legal Grievance system?

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.

Wasn't something like this already turned down?

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.

Can this be rolled back if it doesn't work out?

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

The next service shouldn't need a developer in the room.

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.