# toufiqfarhan0/orvexa architecture

> Architecture diagram of the GitHub repository toufiqfarhan0/orvexa, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/toufiqfarhan0/orvexa
- Repository: https://github.com/toufiqfarhan0/orvexa

## Overview

Orvexa is a PostgreSQL migration safety platform. Its principal workflow takes an operator’s SQL through deterministic analysis, isolated rehearsal, human approval, controlled execution, and post-execution verification. The graph also includes database inspection, MCP access, and the agent/briefing integration described in the README. Sampled excerpts establish several service responsibilities and wiring points; where implementation details were not sampled, the graph preserves documented capabilities without asserting uncertain calls.

Main entry points: [`apps/server/src/routes/migrations.route.ts`](https://github.com/toufiqfarhan0/orvexa/blob/main/apps/server/src/routes/migrations.route.ts) (Migration routes), [`apps/server/src/rehearsal/services/migration-rehearsal-workflow.service.ts`](https://github.com/toufiqfarhan0/orvexa/blob/main/apps/server/src/rehearsal/services/migration-rehearsal-workflow.service.ts) (Rehearsal workflow), [`apps/server/src/repositories/session.repository.interface.ts`](https://github.com/toufiqfarhan0/orvexa/blob/main/apps/server/src/repositories/session.repository.interface.ts) (Session repository), [`apps/server/src/app.ts`](https://github.com/toufiqfarhan0/orvexa/blob/main/apps/server/src/app.ts) (HTTP application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_operator["Operator interface"]
  node_console["Migration console"]
  node_webapi["API client"]
  node_server["HTTP application<br/>[app.ts]"]
  node_routes["Migration routes"]
end

subgraph group_lifecycle["Migration lifecycle"]
  node_analysis["Migration analysis"]
  node_analyzer["Risk analyzer"]
  node_rehearsal["Rehearsal workflow"]
  node_approval["Approval gate"]
  node_execution["Live execution"]
end

subgraph group_safety["Database safety"]
  node_inspection["Postgres inspection"]
  node_rehearsaldb[("Disposable PostgreSQL")]
end

subgraph group_integrations["Agent integrations"]
  node_sandbox["Sandbox adapter"]
  node_mcp["MCP server"]
  node_brief["Gemini release brief"]
end

subgraph group_state["Session state"]
  node_sessions["Session service"]
  node_sessionrepo["Session repository"]
  node_sessionstore[("In-memory sessions")]
end

node_dba(("DBA / agent"))
node_targetdb[("Target PostgreSQL")]
node_trueforge["TrueForge / Daytona"]

node_dba -->|"submits SQL"| node_console
node_console -->|"requests lifecycle"| node_webapi
node_webapi -->|"calls API"| node_server
node_server -->|"mounts API"| node_routes
node_routes -->|"dispatches analysis"| node_analysis
node_analysis -->|"analyzes SQL"| node_analyzer
node_routes -->|"dispatches rehearsal"| node_rehearsal
node_rehearsal -->|"checks capability"| node_sandbox
node_sandbox -->|"dispatches sandbox"| node_trueforge
node_rehearsal -->|"provisions and inspects"| node_rehearsaldb
node_rehearsal -->|"checks target unchanged"| node_inspection
node_inspection -->|"reads catalog"| node_targetdb
node_routes -->|"dispatches approval"| node_approval
node_routes -->|"dispatches execution"| node_execution
node_execution -->|"executes and verifies"| node_targetdb
node_mcp -->|"inspects database"| node_inspection
node_server -->|"mounts MCP"| node_mcp
node_sessions -->|"loads and saves"| node_sessionrepo
node_sessionrepo -->|"implemented by"| node_sessionstore
node_approval -->|"loads and saves"| node_sessionrepo
node_rehearsal -->|"saves evidence"| node_sessionrepo
node_execution -->|"loads and saves"| node_sessionrepo

click node_console "https://github.com/toufiqfarhan0/orvexa/blob/main/apps/web/src/pages/MigrationConsolePage.tsx"
click node_webapi "https://github.com/toufiqfarhan0/orvexa/blob/main/apps/web/src/services/migration-api.service.ts"
click node_server "https://github.com/toufiqfarhan0/orvexa/blob/main/apps/server/src/app.ts"
click node_routes "https://github.com/toufiqfarhan0/orvexa/blob/main/apps/server/src/routes/migrations.route.ts"
click node_analysis "https://github.com/toufiqfarhan0/orvexa/blob/main/apps/server/src/services/migration-analysis.service.ts"
click node_analyzer "https://github.com/toufiqfarhan0/orvexa/blob/main/apps/server/src/analyzer/services/migration-analyzer.service.ts"
click node_rehearsal "https://github.com/toufiqfarhan0/orvexa/blob/main/apps/server/src/rehearsal/services/migration-rehearsal-workflow.service.ts"
click node_approval "https://github.com/toufiqfarhan0/orvexa/blob/main/apps/server/src/approval/services/approval.service.ts"
click node_execution "https://github.com/toufiqfarhan0/orvexa/blob/main/apps/server/src/execution/services/live-migration-execution.service.ts"
click node_sessions "https://github.com/toufiqfarhan0/orvexa/blob/main/apps/server/src/services/migration-session.service.ts"
click node_sessionrepo "https://github.com/toufiqfarhan0/orvexa/blob/main/apps/server/src/repositories/session.repository.interface.ts"
click node_sessionstore "https://github.com/toufiqfarhan0/orvexa/blob/main/apps/server/src/repositories/in-memory-session.repository.ts"
click node_inspection "https://github.com/toufiqfarhan0/orvexa/blob/main/apps/server/src/db/services/postgres-inspection.service.ts"
click node_rehearsaldb "https://github.com/toufiqfarhan0/orvexa/blob/main/apps/server/src/rehearsal/adapters/disposable-postgres.adapter.ts"
click node_sandbox "https://github.com/toufiqfarhan0/orvexa/blob/main/apps/server/src/sandbox/adapters/trueforge-sandbox.adapter.ts"
click node_mcp "https://github.com/toufiqfarhan0/orvexa/blob/main/apps/server/src/mcp/schemasentry-mcp.server.ts"
click node_brief "https://github.com/toufiqfarhan0/orvexa/blob/main/apps/server/src/trueforge/services/gemini-brief.service.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_console,node_webapi,node_server,node_routes toneBlue
class node_analysis,node_analyzer,node_rehearsal,node_approval,node_execution,node_targetdb toneAmber
class node_inspection,node_rehearsaldb toneMint
class node_sandbox,node_mcp,node_brief toneRose
class node_sessions,node_sessionrepo,node_sessionstore,node_dba,node_trueforge toneIndigo
```

## Components

### Operator interface

- [Migration console](https://github.com/toufiqfarhan0/orvexa/blob/main/apps/web/src/pages/MigrationConsolePage.tsx): `apps/web/src/pages/MigrationConsolePage.tsx`
- [API client](https://github.com/toufiqfarhan0/orvexa/blob/main/apps/web/src/services/migration-api.service.ts): `apps/web/src/services/migration-api.service.ts`
- [HTTP application](https://github.com/toufiqfarhan0/orvexa/blob/main/apps/server/src/app.ts): `apps/server/src/app.ts`
- [Migration routes](https://github.com/toufiqfarhan0/orvexa/blob/main/apps/server/src/routes/migrations.route.ts): `apps/server/src/routes/migrations.route.ts`

### Migration lifecycle

- [Migration analysis](https://github.com/toufiqfarhan0/orvexa/blob/main/apps/server/src/services/migration-analysis.service.ts): `apps/server/src/services/migration-analysis.service.ts`
- [Risk analyzer](https://github.com/toufiqfarhan0/orvexa/blob/main/apps/server/src/analyzer/services/migration-analyzer.service.ts): `apps/server/src/analyzer/services/migration-analyzer.service.ts`
- [Rehearsal workflow](https://github.com/toufiqfarhan0/orvexa/blob/main/apps/server/src/rehearsal/services/migration-rehearsal-workflow.service.ts): `apps/server/src/rehearsal/services/migration-rehearsal-workflow.service.ts`
- [Approval gate](https://github.com/toufiqfarhan0/orvexa/blob/main/apps/server/src/approval/services/approval.service.ts): `apps/server/src/approval/services/approval.service.ts`
- [Live execution](https://github.com/toufiqfarhan0/orvexa/blob/main/apps/server/src/execution/services/live-migration-execution.service.ts): `apps/server/src/execution/services/live-migration-execution.service.ts`

### Database safety

- [Postgres inspection](https://github.com/toufiqfarhan0/orvexa/blob/main/apps/server/src/db/services/postgres-inspection.service.ts): `apps/server/src/db/services/postgres-inspection.service.ts`
- [Disposable PostgreSQL](https://github.com/toufiqfarhan0/orvexa/blob/main/apps/server/src/rehearsal/adapters/disposable-postgres.adapter.ts): `apps/server/src/rehearsal/adapters/disposable-postgres.adapter.ts`

### Agent integrations

- [Sandbox adapter](https://github.com/toufiqfarhan0/orvexa/blob/main/apps/server/src/sandbox/adapters/trueforge-sandbox.adapter.ts): `apps/server/src/sandbox/adapters/trueforge-sandbox.adapter.ts`
- [MCP server](https://github.com/toufiqfarhan0/orvexa/blob/main/apps/server/src/mcp/schemasentry-mcp.server.ts): `apps/server/src/mcp/schemasentry-mcp.server.ts`
- [Gemini release brief](https://github.com/toufiqfarhan0/orvexa/blob/main/apps/server/src/trueforge/services/gemini-brief.service.ts): `apps/server/src/trueforge/services/gemini-brief.service.ts`

### Session state

- [Session service](https://github.com/toufiqfarhan0/orvexa/blob/main/apps/server/src/services/migration-session.service.ts): `apps/server/src/services/migration-session.service.ts`
- [Session repository](https://github.com/toufiqfarhan0/orvexa/blob/main/apps/server/src/repositories/session.repository.interface.ts): `apps/server/src/repositories/session.repository.interface.ts`
- [In-memory sessions](https://github.com/toufiqfarhan0/orvexa/blob/main/apps/server/src/repositories/in-memory-session.repository.ts): `apps/server/src/repositories/in-memory-session.repository.ts`

### Other components

- **DBA / agent**
- **Target PostgreSQL**
- **TrueForge / Daytona**

## Connections

- DBA / agent → Migration console: submits SQL
- Migration console → API client: requests lifecycle
- API client → HTTP application: calls API
- HTTP application → Migration routes: mounts API
- Migration routes → Migration analysis: dispatches analysis
- Migration analysis → Risk analyzer: analyzes SQL
- Migration routes → Rehearsal workflow: dispatches rehearsal
- Rehearsal workflow → Sandbox adapter: checks capability
- Sandbox adapter → TrueForge / Daytona: dispatches sandbox
- Rehearsal workflow → Disposable PostgreSQL: provisions and inspects
- Rehearsal workflow → Postgres inspection: checks target unchanged
- Postgres inspection → Target PostgreSQL: reads catalog
- Migration routes → Approval gate: dispatches approval
- Migration routes → Live execution: dispatches execution
- Live execution → Target PostgreSQL: executes and verifies
- MCP server → Postgres inspection: inspects database
- HTTP application → MCP server: mounts MCP
- Session service → Session repository: loads and saves
- Session repository → In-memory sessions: implemented by
- Approval gate → Session repository: loads and saves
- Rehearsal workflow → Session repository: saves evidence
- Live execution → Session repository: loads and saves
