# jnaurot/aiproj architecture

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

- Interactive diagram: https://gitdiagram.com/jnaurot/aiproj
- Repository: https://github.com/jnaurot/aiproj

## Overview

This repository implements a visual data/AI flow builder and a backend runner. The principal workflow is to configure a graph of source, transform, model, tool, or component nodes, submit it for execution, and monitor run events and artifacts. The graph covers the frontend authoring surface, API/runtime entry points, execution and model stages, and component/model management. Some frontend-to-backend connections and unsampled route internals are documented only by the file tree or README, so those links are dashed and marked unverified.

Main entry points: [`backend/app/main.py`](https://github.com/jnaurot/aiproj/blob/main/backend/app/main.py) (FastAPI application), [`backend/app/routes/runs.py`](https://github.com/jnaurot/aiproj/blob/main/backend/app/routes/runs.py) (Run submission), [`backend/app/runner/metadata.py`](https://github.com/jnaurot/aiproj/blob/main/backend/app/runner/metadata.py) (Execution metadata), [`backend/app/executors/llm.py`](https://github.com/jnaurot/aiproj/blob/main/backend/app/executors/llm.py) (LLM execution)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_authoring["Flow authoring"]
  node_canvas["Graph canvas<br/>[FlowCanvas.svelte]"]
  node_graphstore["Graph state<br/>[graphStore.ts]"]
  node_editors["Node editors"]
  node_frontendapi["Frontend API client<br/>[backend.ts]"]
end

subgraph group_api["API and runtime"]
  node_apiroutes["Backend routes"]
  node_application["FastAPI application<br/>[main.py]"]
  node_runroute["Run submission<br/>[runs.py]"]
end

subgraph group_execution["Graph execution"]
  node_runtime["Runtime manager<br/>[runtime.py]"]
  node_runner["Graph runner<br/>[run.py]"]
  node_transform["Transform execution<br/>[transform.py]"]
  node_schemas["Node schemas<br/>[schemas.py]"]
  node_metadata["Execution metadata<br/>[metadata.py]"]
  node_artifacts[("Artifact storage<br/>[artifacts.py]")]
  node_events["Run events<br/>[events.py]"]
  node_materialize["Input materialization<br/>[materialize.py]"]
end

subgraph group_integrations["Models and sources"]
  node_llm["LLM execution<br/>[llm.py]"]
  node_modelproviders["LLM providers<br/>[llm_ollama.py]"]
end

subgraph group_management["Graph and component management"]
  node_graphrevisions[("Graph revisions<br/>[graph_revisions.py]")]
  node_componentroutes["Component management<br/>[components.py]"]
  node_componentcontracts["Component contracts"]
  node_componentrevisions[("Component revisions")]
  node_modelroutes["Model management<br/>[models.py]"]
  node_modelregistry[("Model registry<br/>[model_registry.py]")]
end

node_user(("Flow author"))

node_user -->|"edits graph"| node_canvas
node_canvas -.->|"updates state"| node_graphstore
node_editors -.->|"configures nodes"| node_graphstore
node_frontendapi -.->|"calls API"| node_apiroutes
node_application -->|"initializes"| node_runtime
node_application -->|"registers routes"| node_apiroutes
node_apiroutes -.->|"routes runs"| node_runroute
node_runroute -->|"starts run"| node_runner
node_runroute -->|"uses transforms"| node_transform
node_runroute -.->|"migrates graph"| node_schemas
node_runner -.->|"executes nodes"| node_transform
node_runner -.->|"uses context"| node_metadata
node_metadata -->|"imports store"| node_artifacts
node_metadata -->|"imports bus"| node_events
node_materialize -->|"uses metadata"| node_metadata
node_llm -->|"uses materialization"| node_materialize
node_llm -->|"uses schemas"| node_schemas
node_llm -->|"dispatches providers"| node_modelproviders
node_componentroutes -->|"validates contracts"| node_componentcontracts
node_componentrevisions -->|"uses contracts"| node_componentcontracts
node_application -->|"initializes store"| node_componentrevisions
node_application -->|"initializes store"| node_graphrevisions
node_application -->|"initializes store"| node_modelregistry
node_modelroutes -.->|"uses registry"| node_modelregistry

click node_canvas "https://github.com/jnaurot/aiproj/blob/main/src/lib/flow/FlowCanvas.svelte"
click node_graphstore "https://github.com/jnaurot/aiproj/blob/main/src/lib/flow/store/graphStore.ts"
click node_editors "https://github.com/jnaurot/aiproj/tree/main/src/lib/flow/components/editors"
click node_frontendapi "https://github.com/jnaurot/aiproj/blob/main/src/lib/flow/client/backend.ts"
click node_apiroutes "https://github.com/jnaurot/aiproj/tree/main/backend/app/routes"
click node_application "https://github.com/jnaurot/aiproj/blob/main/backend/app/main.py"
click node_runtime "https://github.com/jnaurot/aiproj/blob/main/backend/app/runtime.py"
click node_runroute "https://github.com/jnaurot/aiproj/blob/main/backend/app/routes/runs.py"
click node_runner "https://github.com/jnaurot/aiproj/blob/main/backend/app/runner/run.py"
click node_transform "https://github.com/jnaurot/aiproj/blob/main/backend/app/runner/nodes/transform.py"
click node_schemas "https://github.com/jnaurot/aiproj/blob/main/backend/app/runner/schemas.py"
click node_metadata "https://github.com/jnaurot/aiproj/blob/main/backend/app/runner/metadata.py"
click node_artifacts "https://github.com/jnaurot/aiproj/blob/main/backend/app/runner/artifacts.py"
click node_events "https://github.com/jnaurot/aiproj/blob/main/backend/app/runner/events.py"
click node_materialize "https://github.com/jnaurot/aiproj/blob/main/backend/app/runner/materialize.py"
click node_llm "https://github.com/jnaurot/aiproj/blob/main/backend/app/executors/llm.py"
click node_modelproviders "https://github.com/jnaurot/aiproj/blob/main/backend/app/executors/llm_ollama.py"
click node_graphrevisions "https://github.com/jnaurot/aiproj/blob/main/backend/app/graph_revisions.py"
click node_componentroutes "https://github.com/jnaurot/aiproj/blob/main/backend/app/routes/components.py"
click node_componentcontracts "https://github.com/jnaurot/aiproj/blob/main/backend/app/component_contracts.py"
click node_componentrevisions "https://github.com/jnaurot/aiproj/blob/main/backend/app/component_revisions.py"
click node_modelroutes "https://github.com/jnaurot/aiproj/blob/main/backend/app/routes/models.py"
click node_modelregistry "https://github.com/jnaurot/aiproj/blob/main/backend/app/model_registry.py"

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_canvas,node_graphstore,node_editors,node_frontendapi toneBlue
class node_apiroutes,node_application,node_runroute toneAmber
class node_runtime,node_runner,node_transform,node_schemas,node_metadata,node_artifacts,node_events,node_materialize toneMint
class node_llm,node_modelproviders toneRose
class node_graphrevisions,node_componentroutes,node_componentcontracts,node_componentrevisions,node_modelroutes,node_modelregistry,node_user toneIndigo
```

## Components

### Flow authoring

- [Graph canvas](https://github.com/jnaurot/aiproj/blob/main/src/lib/flow/FlowCanvas.svelte): `src/lib/flow/FlowCanvas.svelte`
- [Graph state](https://github.com/jnaurot/aiproj/blob/main/src/lib/flow/store/graphStore.ts): `src/lib/flow/store/graphStore.ts`
- [Node editors](https://github.com/jnaurot/aiproj/tree/main/src/lib/flow/components/editors): `src/lib/flow/components/editors`
- [Frontend API client](https://github.com/jnaurot/aiproj/blob/main/src/lib/flow/client/backend.ts): `src/lib/flow/client/backend.ts`

### API and runtime

- [Backend routes](https://github.com/jnaurot/aiproj/tree/main/backend/app/routes): `backend/app/routes`
- [FastAPI application](https://github.com/jnaurot/aiproj/blob/main/backend/app/main.py): `backend/app/main.py`
- [Run submission](https://github.com/jnaurot/aiproj/blob/main/backend/app/routes/runs.py): `backend/app/routes/runs.py`

### Graph execution

- [Runtime manager](https://github.com/jnaurot/aiproj/blob/main/backend/app/runtime.py): `backend/app/runtime.py`
- [Graph runner](https://github.com/jnaurot/aiproj/blob/main/backend/app/runner/run.py): `backend/app/runner/run.py`
- [Transform execution](https://github.com/jnaurot/aiproj/blob/main/backend/app/runner/nodes/transform.py): `backend/app/runner/nodes/transform.py`
- [Node schemas](https://github.com/jnaurot/aiproj/blob/main/backend/app/runner/schemas.py): `backend/app/runner/schemas.py`
- [Execution metadata](https://github.com/jnaurot/aiproj/blob/main/backend/app/runner/metadata.py): `backend/app/runner/metadata.py`
- [Artifact storage](https://github.com/jnaurot/aiproj/blob/main/backend/app/runner/artifacts.py): `backend/app/runner/artifacts.py`
- [Run events](https://github.com/jnaurot/aiproj/blob/main/backend/app/runner/events.py): `backend/app/runner/events.py`
- [Input materialization](https://github.com/jnaurot/aiproj/blob/main/backend/app/runner/materialize.py): `backend/app/runner/materialize.py`

### Models and sources

- [LLM execution](https://github.com/jnaurot/aiproj/blob/main/backend/app/executors/llm.py): `backend/app/executors/llm.py`
- [LLM providers](https://github.com/jnaurot/aiproj/blob/main/backend/app/executors/llm_ollama.py): `backend/app/executors/llm_ollama.py`

### Graph and component management

- [Graph revisions](https://github.com/jnaurot/aiproj/blob/main/backend/app/graph_revisions.py): `backend/app/graph_revisions.py`
- [Component management](https://github.com/jnaurot/aiproj/blob/main/backend/app/routes/components.py): `backend/app/routes/components.py`
- [Component contracts](https://github.com/jnaurot/aiproj/blob/main/backend/app/component_contracts.py): `backend/app/component_contracts.py`
- [Component revisions](https://github.com/jnaurot/aiproj/blob/main/backend/app/component_revisions.py): `backend/app/component_revisions.py`
- [Model management](https://github.com/jnaurot/aiproj/blob/main/backend/app/routes/models.py): `backend/app/routes/models.py`
- [Model registry](https://github.com/jnaurot/aiproj/blob/main/backend/app/model_registry.py): `backend/app/model_registry.py`

### Other components

- **Flow author**

## Connections

- Flow author → Graph canvas: edits graph
- Graph canvas → Graph state: updates state
- Node editors → Graph state: configures nodes
- Frontend API client → Backend routes: calls API (evidence: `README.md`)
- FastAPI application → Runtime manager: initializes (evidence: `backend/app/main.py`)
- FastAPI application → Backend routes: registers routes (evidence: `backend/app/main.py`)
- Backend routes → Run submission: routes runs
- Run submission → Graph runner: starts run (evidence: `backend/app/routes/runs.py`)
- Run submission → Transform execution: uses transforms (evidence: `backend/app/routes/runs.py`)
- Run submission → Node schemas: migrates graph
- Graph runner → Transform execution: executes nodes
- Graph runner → Execution metadata: uses context
- Execution metadata → Artifact storage: imports store (evidence: `backend/app/runner/metadata.py`)
- Execution metadata → Run events: imports bus (evidence: `backend/app/runner/metadata.py`)
- Input materialization → Execution metadata: uses metadata (evidence: `backend/app/runner/materialize.py`)
- LLM execution → Input materialization: uses materialization (evidence: `backend/app/executors/llm.py`)
- LLM execution → Node schemas: uses schemas (evidence: `backend/app/executors/llm.py`)
- LLM execution → LLM providers: dispatches providers (evidence: `backend/app/executors/llm.py`)
- Component management → Component contracts: validates contracts (evidence: `backend/app/routes/components.py`)
- Component revisions → Component contracts: uses contracts (evidence: `backend/app/component_revisions.py`)
- FastAPI application → Component revisions: initializes store (evidence: `backend/app/main.py`)
- FastAPI application → Graph revisions: initializes store (evidence: `backend/app/main.py`)
- FastAPI application → Model registry: initializes store (evidence: `backend/app/main.py`)
- Model management → Model registry: uses registry
