Projects · Mobile
RegulationOS

RegulationOS treats a regulated process as a graph. A step cannot open until the steps it depends on are approved. Submitting the form on a step is what asks for that approval. The core engine and the React Native app through sprint 2.5 are built. The live-readiness phase is still planned.
Solutions
A process that cannot skip ahead
Steps are nodes. Dependencies are edges. Approving a step unlocks only the steps whose prerequisites are all done. A cycle is rejected before it is saved, so a process cannot wait on itself.
The form belongs to the step
Each step has a JSON Schema template and a version. The submission is validated with Ajv. An invalid form is a 400, not a half-saved step. Clinic-psychology templates, petitions and declarations, are seeded as the first set.
Progress, and the long pole
The API returns how much of the process is done and the critical path, the longest dependency chain. A person can see both the percentage and which steps actually gate the end.
Process
01
Define the graph
An admin adds steps and prerequisites. The API checks the graph for a cycle first. A request that would loop is rejected.
02
Open what is unlocked
The phone loads the process. Locked steps stay locked. The dependency map is available as nodes, edges and statuses for a graph view.
03
Submit the form
The step’s template is fetched, filled, and posted. The schema is checked. A valid submit marks the step submitted.
04
Approve, then unlock
On approval the engine computes the newly unlocked steps, writes them, and returns them. Progress and the critical path update with that write.
Technology
The engine is its own package
Graph, Kahn topological sort, a DFS cycle check, transitive dependencies, the unlock engine, the progress calculator and the critical path live in @regulationos/dag-engine. The package has its own tests, including 42 engine tests in the documented run.
Hono, Drizzle, Postgres
The API is Hono, not Express. Drizzle is the ORM. Postgres runs in Docker on 5434 so it does not fight a local server on 5432. Auth is JWT. The decision record is explicit that the app is online-only.
A Turborepo and a React Native app
The repo is a Turborepo. The API and Metro run separately. Form templates are seeded. Phase 0 and the engine are done. The mobile UI is through sprint 2.5. Going live is the phase that is still a plan.
- React Native
- Hono
- Drizzle
- PostgreSQL
- TypeScript
- Turborepo
- Ajv