reference deployerintegratorsecurity-reviewer

OpenGov Tech Stack

Status: living reference (engineer-facing).

OpenGov is a modular monolith: one FastAPI app, one shared PostgreSQL, strict module ownership — designed to be split into independent services later. It runs as a self-hosted Docker-Compose stack, one isolated instance per country.

This page is the index. Depth lives in two places: the full architecture in docs/specs/2026-04-04-opengov-mvp-architecture.md, and how a deployment boots and routes in docs/reference/deployment-architecture.md.


The stack at a glance

LayerChoiceNotes
BackendPython 3.15 + FastAPIAsync throughout
ORM / DBSQLAlchemy 2.x async on PostgreSQL 18asyncpg + psycopg; Alembic migrations in migrations/
Background jobsProcrastinateRun with python3 -m opengov.worker
ValidationPydantic v2Request/response models
FrontendReact 19 + TypeScript + Vite + Tailwind CSS 4One SPA per tool; shared design system in frontend/shared/ (OGDS)
AuthKeycloak OIDC (dev/test), standards-based OIDC (production)
Testingpytest (backend), Vitest (frontends)pytest-xdist for parallel runs
Lint / formatruff (Python), ESLint (TS)
DeploymentDocker Compose, single host per countryManaged via Coolify in production

The four tools

Four tools share the one backend; each is its own SPA and its own module.

ToolModule (backend)SPA (frontend)Role
SmartRulessrc/opengov/smartrules/frontend/editor/Agency staff author registration procedures as structured rules and publish them as open-standard APIs
eApprovalsrc/opengov/eapproval/frontend/approval/Verification runtime — claim-based review, configurable DAG, role-driven assignment
SmartLinksrc/opengov/smartlink/frontend/smartlink-admin/External database verification — query third-party registries, audit every lookup
eRnext—frontend/portal/Applicant portal — discover, apply, track (consumes the published APIs)

Module ownership

Table ownership is strict: each module owns its tables and never touches another module’s tables directly. Cross-module access goes through each module’s service.py interface — except worldmodel, whose write path is worldmodel/runtime.py.

Table prefixOwner
smartrules_*SmartRules
eapproval_*eApproval
smartlink_*SmartLink
payment_*payments
wm_*worldmodel (compiled register output)
vault_*vault
notification_*platform/notifications
platform_*platform (owned by platform, read by all)
published_versionsSmartRules writes, others read (the seam)

Enforced by scripts/ci/table_access_guard.py (make table-access-check).


Deeper reading

  • Full architecture — docs/specs/2026-04-04-opengov-mvp-architecture.md (topology, scope, constraints).
  • Deployment — docs/reference/deployment-architecture.md (containers, self-boot, routing, onboarding).
  • Module interactions — docs/runbooks/module-interactions.md (the cross-module rules and exact service APIs).
  • Concept ground truth — docs/reference/SmartRules-Overview-v4.md.