# havishvardhan04-creator/alter-x-3 architecture

> Architecture diagram of the GitHub repository havishvardhan04-creator/alter-x-3, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/havishvardhan04-creator/alter-x-3
- Repository: https://github.com/havishvardhan04-creator/alter-x-3

## Overview

#### 1. Purpose and topology
ALTERX is a multi-tenant autonomous-execution platform with Workflow Mode and Project Mode. It combines a TypeScript/NestJS platform plane, TypeScript Engine services, Python/FastAPI intelligence services, a React/Vite web client, and shared contract-first APIs. The Platform BFF is intended as the sole Platform-facing caller of Engine/ADS.
- `apps/platform-api/src/main.ts`
- `apps/orchestration-service/src/main.ts`
- `apps/platform-web/src/main.tsx`

#### 2. Public entry points and control plane
`platform-web` is the browser UI for workflows, projects, runs, knowledge, connections, billing, marketplace, and administration. It calls `platform-api`, which owns identity, tenancy/RBAC, persisted platform concerns, API aggregation, and Engine-facing facades. The API also streams run state to clients.
- `apps/platform-web/src/app/router.tsx`
- `apps/platform-api/src/app.module.ts`
- `apps/platform-api/src/engine/engine-client.ts`

#### 3. Workflow/project lifecycle: orchestration as system of record
`orchestration-service` is the Engine’s durable lifecycle core: it stores workflows, versioned DAGs, triggers, conversations, runs, node executions, artifacts, approvals, verification results, recovery actions, and dispatch queue records. It compiles workflow/architecture inputs into executable DAGs, launches runs, records execution and stream events, and handles trigger/webhook ingress.
- `apps/orchestration-service/src/compiler/graph-compiler.service.ts`
- `apps/orchestration-service/src/runs/run-launcher.service.ts`
- `apps/orchestration-service/db/schema/runs.ts`

#### 4. Planning and capability binding
`intelligence-service` converts problem/project intent into plans, resolves capabilities, synthesizes architectures, and binds selected implementations subject to policy. Its planner is an LLM-mediated manager/worker subsystem; it calls ADS, model gateway, and policy/binding-related services through explicit clients. The orchestration compiler is the boundary that turns these results into operational DAGs.
- `apps/intelligence-service/src/planner/kernel.py`
- `apps/intelligence-service/src/architecture_synthesizer/service.py`
- `apps/intelligence-service/src/selection_binding/engine.py`

#### 5. Execution, gateways, and durable workers
Compiled runs are dispatched through the orchestration durable queue and executed via Temporal-based workers. Node handlers route LLM work through `model-gateway`, external-tool work through `tool-gateway`, and code execution through `sandbox-service`; these are intended provider/isolation boundaries rather than direct vendor access. Provisioning supports project build/deployment flow.
- `apps/orchestration-service/src/runs/durable-run-queue.service.ts`
- `apps/orchestration-service/src/registry/nodeexec.service.ts`
- `packages/adapters/src/temporal/workflows/executor-workflow.ts`

#### 6. Knowledge, memory, verification, and recovery
ADS Core ingests connector/upload content, normalizes/chunks/embeds it, applies document/source permissions, and serves retrieval over HTTP/gRPC. Memory stores learned policy and detects drift. Verification scores quality gates; orchestration records results and selects/dispatches recovery actions. Eval service executes golden-set, red-team, chaos, and promotion-gate evaluation against the wider Engine.
- `apps/ads-core/src/ingestion/pipeline.py`
- `apps/memory-service/src/policy_store/service.py`
- `apps/verification-service/src/verification/engine.py`
- `apps/eval-service/src/execution/orchestrator.py`

#### 7. Contracts, persistence, and infrastructure boundaries
`packages/contracts` contains the canonical OpenAPI, schemas, and protobuf contracts consumed across TypeScript and generated Python gRPC clients. Services maintain separate PostgreSQL schemas/migrations (Drizzle for TS, Alembic for Python). AWS Terraform provisions multi-account environment infrastructure; adapters encapsulate AWS, LLM, payment, identity, sandbox, browser, storage, observability, and Temporal integrations. Local development includes Compose, LocalStack, Grafana, and Tempo.
- `packages/contracts/proto/alter/compiler/v1/compiler.proto`
- `packages/adapters/src/index.ts`
- `infrastructure/terraform/main.tf`

Main entry points: [`apps/orchestration-service/src/main.ts`](https://github.com/havishvardhan04-creator/alter-x-3/blob/main/apps/orchestration-service/src/main.ts) (Orchestration Service), [`apps/intelligence-service/src/planner/kernel.py`](https://github.com/havishvardhan04-creator/alter-x-3/blob/main/apps/intelligence-service/src/planner/kernel.py) (Intelligence Service), [`apps/platform-api/src/app.module.ts`](https://github.com/havishvardhan04-creator/alter-x-3/blob/main/apps/platform-api/src/app.module.ts) (Platform API), [`packages/contracts/proto/alter/compiler/v1/compiler.proto`](https://github.com/havishvardhan04-creator/alter-x-3/blob/main/packages/contracts/proto/alter/compiler/v1/compiler.proto) (Contracts)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client"]
  node_web["Platform Web<br/>React/Vite client<br/>[router.tsx]"]
end

subgraph group_platform["Platform Plane"]
  node_platform_api["Platform API<br/>NestJS BFF<br/>[app.module.ts]"]
  node_engine_client["Engine Facade<br/>Engine client<br/>[engine-client.ts]"]
end

subgraph group_engine["Execution Engine"]
  node_orchestration["Orchestration Service<br/>durable lifecycle core<br/>[main.ts]"]
  node_compiler["Graph Compiler<br/>DAG compiler"]
  node_run_launcher["Run Launcher<br/>run lifecycle"]
  node_durable_queue["Durable Run Queue<br/>dispatch queue"]
  node_temporal_workers["Temporal Workers<br/>execution workers"]
  node_node_execution["Node Execution Registry<br/>node router"]
  node_execution_gateways{{"Execution Gateways<br/>provider boundaries<br/>[index.ts]"}}
  node_orchestration_db[("Orchestration Store<br/>PostgreSQL schema<br/>[runs.ts]")]
end

subgraph group_intelligence["Intelligence &amp; Quality"]
  node_intelligence["Intelligence Service<br/>FastAPI planning service<br/>[kernel.py]"]
  node_architecture_synth["Architecture Synthesizer<br/>architecture planning<br/>[service.py]"]
  node_selection_binding["Selection &amp; Binding<br/>capability binding<br/>[engine.py]"]
  node_verification["Verification Service<br/>quality gates<br/>[engine.py]"]
  node_eval["Eval Service<br/>evaluation runner<br/>[orchestrator.py]"]
end

subgraph group_knowledge["Knowledge Services"]
  node_ads["ADS Core<br/>knowledge retrieval<br/>[pipeline.py]"]
  node_memory["Memory Service<br/>policy memory<br/>[service.py]"]
end

subgraph group_foundation["Shared Foundation"]
  node_contracts["Contracts<br/>OpenAPI, schemas &amp; protobuf<br/>[compiler.proto]"]
  node_infrastructure{{"AWS Infrastructure<br/>Terraform<br/>[main.tf]"}}
end

node_web -->|"platform API"| node_platform_api
node_platform_api -->|"engine/ADS facade"| node_engine_client
node_engine_client -->|"workflow and run requests"| node_orchestration
node_engine_client -->|"knowledge requests"| node_ads
node_orchestration -->|"compile inputs"| node_compiler
node_compiler -->|"planning and architecture"| node_intelligence
node_intelligence -->|"synthesize"| node_architecture_synth
node_intelligence -->|"bind capabilities"| node_selection_binding
node_intelligence -->|"retrieve context"| node_ads
node_intelligence -->|"policy and drift"| node_memory
node_compiler -->|"executable DAG"| node_run_launcher
node_run_launcher -->|"dispatch"| node_durable_queue
node_durable_queue -->|"durable work"| node_temporal_workers
node_temporal_workers -->|"execute nodes"| node_node_execution
node_node_execution -->|"LLM, tools, sandbox, provisioning"| node_execution_gateways
node_orchestration -->|"verification requests"| node_verification
node_verification -->|"results and recovery signals"| node_orchestration
node_eval -->|"evaluate engine"| node_orchestration
node_orchestration -->|"persist lifecycle"| node_orchestration_db
node_platform_api -->|"run-state stream"| node_web
node_contracts -.->|"API contracts"| node_platform_api
node_contracts -.->|"service contracts"| node_orchestration
node_contracts -.->|"generated contracts"| node_intelligence
node_infrastructure -.->|"provisions"| node_platform_api
node_infrastructure -.->|"provisions"| node_orchestration

click node_web "https://github.com/havishvardhan04-creator/alter-x-3/blob/main/apps/platform-web/src/app/router.tsx"
click node_platform_api "https://github.com/havishvardhan04-creator/alter-x-3/blob/main/apps/platform-api/src/app.module.ts"
click node_engine_client "https://github.com/havishvardhan04-creator/alter-x-3/blob/main/apps/platform-api/src/engine/engine-client.ts"
click node_orchestration "https://github.com/havishvardhan04-creator/alter-x-3/blob/main/apps/orchestration-service/src/main.ts"
click node_compiler "https://github.com/havishvardhan04-creator/alter-x-3/blob/main/apps/orchestration-service/src/compiler/graph-compiler.service.ts"
click node_run_launcher "https://github.com/havishvardhan04-creator/alter-x-3/blob/main/apps/orchestration-service/src/runs/run-launcher.service.ts"
click node_durable_queue "https://github.com/havishvardhan04-creator/alter-x-3/blob/main/apps/orchestration-service/src/runs/durable-run-queue.service.ts"
click node_temporal_workers "https://github.com/havishvardhan04-creator/alter-x-3/blob/main/packages/adapters/src/temporal/workflows/executor-workflow.ts"
click node_node_execution "https://github.com/havishvardhan04-creator/alter-x-3/blob/main/apps/orchestration-service/src/registry/nodeexec.service.ts"
click node_intelligence "https://github.com/havishvardhan04-creator/alter-x-3/blob/main/apps/intelligence-service/src/planner/kernel.py"
click node_architecture_synth "https://github.com/havishvardhan04-creator/alter-x-3/blob/main/apps/intelligence-service/src/architecture_synthesizer/service.py"
click node_selection_binding "https://github.com/havishvardhan04-creator/alter-x-3/blob/main/apps/intelligence-service/src/selection_binding/engine.py"
click node_ads "https://github.com/havishvardhan04-creator/alter-x-3/blob/main/apps/ads-core/src/ingestion/pipeline.py"
click node_memory "https://github.com/havishvardhan04-creator/alter-x-3/blob/main/apps/memory-service/src/policy_store/service.py"
click node_verification "https://github.com/havishvardhan04-creator/alter-x-3/blob/main/apps/verification-service/src/verification/engine.py"
click node_eval "https://github.com/havishvardhan04-creator/alter-x-3/blob/main/apps/eval-service/src/execution/orchestrator.py"
click node_execution_gateways "https://github.com/havishvardhan04-creator/alter-x-3/blob/main/packages/adapters/src/index.ts"
click node_orchestration_db "https://github.com/havishvardhan04-creator/alter-x-3/blob/main/apps/orchestration-service/db/schema/runs.ts"
click node_contracts "https://github.com/havishvardhan04-creator/alter-x-3/blob/main/packages/contracts/proto/alter/compiler/v1/compiler.proto"
click node_infrastructure "https://github.com/havishvardhan04-creator/alter-x-3/blob/main/infrastructure/terraform/main.tf"

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_web toneBlue
class node_platform_api,node_engine_client toneAmber
class node_orchestration,node_compiler,node_run_launcher,node_durable_queue,node_temporal_workers,node_node_execution,node_execution_gateways,node_orchestration_db toneMint
class node_intelligence,node_architecture_synth,node_selection_binding,node_verification,node_eval toneRose
class node_ads,node_memory toneIndigo
class node_contracts,node_infrastructure toneTeal
```

## Components

### Client

- [Platform Web](https://github.com/havishvardhan04-creator/alter-x-3/blob/main/apps/platform-web/src/app/router.tsx): React/Vite client · Browser UI for platform workflows, projects, and administration. · `apps/platform-web/src/app/router.tsx`

### Platform Plane

- [Platform API](https://github.com/havishvardhan04-creator/alter-x-3/blob/main/apps/platform-api/src/app.module.ts): NestJS BFF · Owns identity, tenancy, RBAC, persisted platform concerns, and API aggregation. · `apps/platform-api/src/app.module.ts`
- [Engine Facade](https://github.com/havishvardhan04-creator/alter-x-3/blob/main/apps/platform-api/src/engine/engine-client.ts): Engine client · Sole Platform-facing boundary for Engine and ADS calls. · `apps/platform-api/src/engine/engine-client.ts`

### Execution Engine

- [Orchestration Service](https://github.com/havishvardhan04-creator/alter-x-3/blob/main/apps/orchestration-service/src/main.ts): durable lifecycle core · System of record for workflows, DAG versions, runs, executions, approvals, and recovery. · `apps/orchestration-service/src/main.ts`
- [Graph Compiler](https://github.com/havishvardhan04-creator/alter-x-3/blob/main/apps/orchestration-service/src/compiler/graph-compiler.service.ts): DAG compiler · Turns workflow and architecture inputs into executable DAGs. · `apps/orchestration-service/src/compiler/graph-compiler.service.ts`
- [Run Launcher](https://github.com/havishvardhan04-creator/alter-x-3/blob/main/apps/orchestration-service/src/runs/run-launcher.service.ts): run lifecycle · Launches runs and records execution and stream events. · `apps/orchestration-service/src/runs/run-launcher.service.ts`
- [Durable Run Queue](https://github.com/havishvardhan04-creator/alter-x-3/blob/main/apps/orchestration-service/src/runs/durable-run-queue.service.ts): dispatch queue · `apps/orchestration-service/src/runs/durable-run-queue.service.ts`
- [Temporal Workers](https://github.com/havishvardhan04-creator/alter-x-3/blob/main/packages/adapters/src/temporal/workflows/executor-workflow.ts): execution workers · Execute dispatched DAG nodes durably. · `packages/adapters/src/temporal/workflows/executor-workflow.ts`
- [Node Execution Registry](https://github.com/havishvardhan04-creator/alter-x-3/blob/main/apps/orchestration-service/src/registry/nodeexec.service.ts): node router · Routes node work to isolated execution boundaries. · `apps/orchestration-service/src/registry/nodeexec.service.ts`
- [Execution Gateways](https://github.com/havishvardhan04-creator/alter-x-3/blob/main/packages/adapters/src/index.ts): provider boundaries · Model, tool, sandbox, and provisioning adapters isolate external execution. · `packages/adapters/src/index.ts`
- [Orchestration Store](https://github.com/havishvardhan04-creator/alter-x-3/blob/main/apps/orchestration-service/db/schema/runs.ts): PostgreSQL schema · Persists runs and execution lifecycle records. · `apps/orchestration-service/db/schema/runs.ts`

### Intelligence & Quality

- [Intelligence Service](https://github.com/havishvardhan04-creator/alter-x-3/blob/main/apps/intelligence-service/src/planner/kernel.py): FastAPI planning service · Plans projects, synthesizes architectures, and binds capabilities under policy. · `apps/intelligence-service/src/planner/kernel.py`
- [Architecture Synthesizer](https://github.com/havishvardhan04-creator/alter-x-3/blob/main/apps/intelligence-service/src/architecture_synthesizer/service.py): architecture planning · `apps/intelligence-service/src/architecture_synthesizer/service.py`
- [Selection & Binding](https://github.com/havishvardhan04-creator/alter-x-3/blob/main/apps/intelligence-service/src/selection_binding/engine.py): capability binding · `apps/intelligence-service/src/selection_binding/engine.py`
- [Verification Service](https://github.com/havishvardhan04-creator/alter-x-3/blob/main/apps/verification-service/src/verification/engine.py): quality gates · Scores verification results used for recovery decisions. · `apps/verification-service/src/verification/engine.py`
- [Eval Service](https://github.com/havishvardhan04-creator/alter-x-3/blob/main/apps/eval-service/src/execution/orchestrator.py): evaluation runner · Runs golden-set, red-team, chaos, and promotion-gate evaluations. · `apps/eval-service/src/execution/orchestrator.py`

### Knowledge Services

- [ADS Core](https://github.com/havishvardhan04-creator/alter-x-3/blob/main/apps/ads-core/src/ingestion/pipeline.py): knowledge retrieval · Ingests sources, enforces permissions, and serves retrieval over HTTP/gRPC. · `apps/ads-core/src/ingestion/pipeline.py`
- [Memory Service](https://github.com/havishvardhan04-creator/alter-x-3/blob/main/apps/memory-service/src/policy_store/service.py): policy memory · Stores learned policy and detects drift. · `apps/memory-service/src/policy_store/service.py`

### Shared Foundation

- [Contracts](https://github.com/havishvardhan04-creator/alter-x-3/blob/main/packages/contracts/proto/alter/compiler/v1/compiler.proto): OpenAPI, schemas & protobuf · Canonical cross-runtime API contracts and generated clients. · `packages/contracts/proto/alter/compiler/v1/compiler.proto`
- [AWS Infrastructure](https://github.com/havishvardhan04-creator/alter-x-3/blob/main/infrastructure/terraform/main.tf): Terraform · Provisions multi-account environment infrastructure. · `infrastructure/terraform/main.tf`

## Connections

- Platform Web → Platform API: platform API
- Platform API → Engine Facade: engine/ADS facade
- Engine Facade → Orchestration Service: workflow and run requests
- Engine Facade → ADS Core: knowledge requests
- Orchestration Service → Graph Compiler: compile inputs
- Graph Compiler → Intelligence Service: planning and architecture
- Intelligence Service → Architecture Synthesizer: synthesize
- Intelligence Service → Selection & Binding: bind capabilities
- Intelligence Service → ADS Core: retrieve context
- Intelligence Service → Memory Service: policy and drift
- Graph Compiler → Run Launcher: executable DAG
- Run Launcher → Durable Run Queue: dispatch
- Durable Run Queue → Temporal Workers: durable work
- Temporal Workers → Node Execution Registry: execute nodes
- Node Execution Registry → Execution Gateways: LLM, tools, sandbox, provisioning
- Orchestration Service → Verification Service: verification requests
- Verification Service → Orchestration Service: results and recovery signals
- Eval Service → Orchestration Service: evaluate engine
- Orchestration Service → Orchestration Store: persist lifecycle
- Platform API → Platform Web: run-state stream
- Contracts → Platform API: API contracts
- Contracts → Orchestration Service: service contracts
- Contracts → Intelligence Service: generated contracts
- AWS Infrastructure → Platform API: provisions
- AWS Infrastructure → Orchestration Service: provisions
