# framesphere/frametrain-app architecture

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

- Interactive diagram: https://gitdiagram.com/framesphere/frametrain-app
- Repository: https://github.com/framesphere/frametrain-app

## Overview

FrameTrain is a local-first desktop application for preparing datasets, training and evaluating AI models, then managing and exporting the results. The main path is user interaction in the React app, through Tauri commands and Rust managers, to Python training or inference and back to persisted run/model state. Major parallel capabilities include the visual Synapse builder, dataset Studio, testing, model versioning, and hosting. Edges below are limited to relationships stated in the README or visible in the supplied excerpts and source index; several subsystem details are unsampled.

Main entry points: [`src-tauri/src/training_manager.rs`](https://github.com/framesphere/frametrain-app/blob/main/src-tauri/src/training_manager.rs) (Training manager), [`src/App.tsx`](https://github.com/framesphere/frametrain-app/blob/main/src/App.tsx) (React app), [`src-tauri/python/train_engine/train_engine.py`](https://github.com/framesphere/frametrain-app/blob/main/src-tauri/python/train_engine/train_engine.py) (Python train engine), [`src/components/synapse/SynapseBuilder.tsx`](https://github.com/framesphere/frametrain-app/blob/main/src/components/synapse/SynapseBuilder.tsx) (Synapse canvas)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Desktop app"]
  node_frontend["React app<br/>[App.tsx]"]
  node_training_ui["Training UI<br/>[TrainingPanel.tsx]"]
  node_training_state["Training state"]
  node_rust_backend["Tauri backend<br/>[main.rs]"]
end

subgraph group_data["Data and Studio"]
  node_datasets_ui["Dataset management UI"]
  node_dataset_manager["Dataset manager<br/>[dataset_manager.rs]"]
  node_database[("Metadata database<br/>[database.rs]")]
  node_studio_ui["Dataset Studio UI<br/>[StudioPanel.tsx]"]
  node_studio_backend["Studio services<br/>[studio_manager.rs]"]
end

subgraph group_train["Train and evaluate"]
  node_training_manager["Training manager"]
  node_train_engine["Python train engine<br/>[train_engine.py]"]
  node_train_plugins["Training plugins"]
  node_test_plugins["Evaluation plugins"]
  node_analysis["Run analysis"]
end

subgraph group_models["Models and hosting"]
  node_models_ui["Model manager UI<br/>[ModelManager.tsx]"]
  node_model_manager["Model manager<br/>[model_manager.rs]"]
  node_versions_ui["Model versioning UI<br/>[VersionManager.tsx]"]
  node_hosting_ui["Hosting UI<br/>[HostingPanel.tsx]"]
  node_hosting_backend["Hosting services<br/>[hosting_api.rs]"]
end

subgraph group_synapse["Synapse builder"]
  node_synapse_ui["Synapse canvas<br/>[SynapseBuilder.tsx]"]
  node_synapse_service["Synapse service<br/>[service.py]"]
  node_synapse_graph["Graph and code nodes<br/>[graph.py]"]
  node_canvas_loader["Canvas loader<br/>[loader.py]"]
end

node_user(("User"))
node_ollama["Ollama"]

node_user -->|"uses"| node_frontend
node_frontend -->|"shows"| node_training_ui
node_training_ui -.->|"starts training"| node_training_manager
node_training_manager -->|"runs"| node_train_engine
node_train_engine -->|"loads plugin"| node_train_plugins
node_train_engine -.->|"uses evaluation"| node_test_plugins
node_training_manager -->|"uses datasets"| node_dataset_manager
node_training_manager -->|"records runs"| node_database
node_training_manager -->|"requests analysis"| node_analysis
node_training_manager -.->|"updates progress"| node_training_state
node_user -->|"manages data"| node_datasets_ui
node_datasets_ui -.->|"invokes commands"| node_dataset_manager
node_dataset_manager -->|"stores metadata"| node_database
node_user -->|"creates datasets"| node_studio_ui
node_studio_ui -.->|"invokes commands"| node_studio_backend
node_user -->|"imports models"| node_models_ui
node_models_ui -->|"invokes commands"| node_model_manager
node_model_manager -->|"checks model records"| node_database
node_user -->|"compares versions"| node_versions_ui
node_user -->|"runs models"| node_hosting_ui
node_hosting_ui -.->|"requests hosting"| node_hosting_backend
node_hosting_backend -.->|"integrates"| node_ollama
node_user -->|"builds network"| node_synapse_ui
node_synapse_ui -.->|"invokes service"| node_synapse_service
node_synapse_service -->|"checks and exports"| node_synapse_graph
node_synapse_service -->|"loads canvas"| node_canvas_loader
node_synapse_ui -.->|"trains canvas model"| node_training_manager
node_frontend -->|"invokes commands"| node_rust_backend

click node_frontend "https://github.com/framesphere/frametrain-app/blob/main/src/App.tsx"
click node_training_ui "https://github.com/framesphere/frametrain-app/blob/main/src/components/TrainingPanel.tsx"
click node_training_state "https://github.com/framesphere/frametrain-app/blob/main/src/contexts/TrainingContext.tsx"
click node_datasets_ui "https://github.com/framesphere/frametrain-app/blob/main/src/components/DatasetFileManager.tsx"
click node_dataset_manager "https://github.com/framesphere/frametrain-app/blob/main/src-tauri/src/dataset_manager.rs"
click node_database "https://github.com/framesphere/frametrain-app/blob/main/src-tauri/src/database.rs"
click node_studio_ui "https://github.com/framesphere/frametrain-app/blob/main/src/components/studio/StudioPanel.tsx"
click node_studio_backend "https://github.com/framesphere/frametrain-app/blob/main/src-tauri/src/studio_manager.rs"
click node_training_manager "https://github.com/framesphere/frametrain-app/blob/main/src-tauri/src/training_manager.rs"
click node_train_engine "https://github.com/framesphere/frametrain-app/blob/main/src-tauri/python/train_engine/train_engine.py"
click node_train_plugins "https://github.com/framesphere/frametrain-app/tree/main/src-tauri/python/train_engine/plugins"
click node_test_plugins "https://github.com/framesphere/frametrain-app/tree/main/src-tauri/python/test_engine/plugins"
click node_analysis "https://github.com/framesphere/frametrain-app/blob/main/src-tauri/src/analysis_manager.rs"
click node_models_ui "https://github.com/framesphere/frametrain-app/blob/main/src/components/ModelManager.tsx"
click node_model_manager "https://github.com/framesphere/frametrain-app/blob/main/src-tauri/src/model_manager.rs"
click node_versions_ui "https://github.com/framesphere/frametrain-app/blob/main/src/components/VersionManager.tsx"
click node_hosting_ui "https://github.com/framesphere/frametrain-app/blob/main/src/components/hosting/HostingPanel.tsx"
click node_hosting_backend "https://github.com/framesphere/frametrain-app/blob/main/src-tauri/src/hosting_api.rs"
click node_synapse_ui "https://github.com/framesphere/frametrain-app/blob/main/src/components/synapse/SynapseBuilder.tsx"
click node_synapse_service "https://github.com/framesphere/frametrain-app/blob/main/src-tauri/python/synapse/service.py"
click node_synapse_graph "https://github.com/framesphere/frametrain-app/blob/main/src-tauri/python/synapse/graph.py"
click node_canvas_loader "https://github.com/framesphere/frametrain-app/blob/main/src-tauri/python/train_engine/plugins/canvas/loader.py"
click node_rust_backend "https://github.com/framesphere/frametrain-app/blob/main/src-tauri/src/main.rs"

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_frontend,node_training_ui,node_training_state,node_rust_backend,node_user toneBlue
class node_datasets_ui,node_dataset_manager,node_database,node_studio_ui,node_studio_backend toneAmber
class node_training_manager,node_train_engine,node_train_plugins,node_test_plugins,node_analysis toneMint
class node_models_ui,node_model_manager,node_versions_ui,node_hosting_ui,node_hosting_backend toneRose
class node_synapse_ui,node_synapse_service,node_synapse_graph,node_canvas_loader,node_ollama toneIndigo
```

## Components

### Desktop app

- [React app](https://github.com/framesphere/frametrain-app/blob/main/src/App.tsx): `src/App.tsx`
- [Training UI](https://github.com/framesphere/frametrain-app/blob/main/src/components/TrainingPanel.tsx): `src/components/TrainingPanel.tsx`
- [Training state](https://github.com/framesphere/frametrain-app/blob/main/src/contexts/TrainingContext.tsx): `src/contexts/TrainingContext.tsx`
- [Tauri backend](https://github.com/framesphere/frametrain-app/blob/main/src-tauri/src/main.rs): `src-tauri/src/main.rs`

### Data and Studio

- [Dataset management UI](https://github.com/framesphere/frametrain-app/blob/main/src/components/DatasetFileManager.tsx): `src/components/DatasetFileManager.tsx`
- [Dataset manager](https://github.com/framesphere/frametrain-app/blob/main/src-tauri/src/dataset_manager.rs): `src-tauri/src/dataset_manager.rs`
- [Metadata database](https://github.com/framesphere/frametrain-app/blob/main/src-tauri/src/database.rs): `src-tauri/src/database.rs`
- [Dataset Studio UI](https://github.com/framesphere/frametrain-app/blob/main/src/components/studio/StudioPanel.tsx): `src/components/studio/StudioPanel.tsx`
- [Studio services](https://github.com/framesphere/frametrain-app/blob/main/src-tauri/src/studio_manager.rs): `src-tauri/src/studio_manager.rs`

### Train and evaluate

- [Training manager](https://github.com/framesphere/frametrain-app/blob/main/src-tauri/src/training_manager.rs): `src-tauri/src/training_manager.rs`
- [Python train engine](https://github.com/framesphere/frametrain-app/blob/main/src-tauri/python/train_engine/train_engine.py): `src-tauri/python/train_engine/train_engine.py`
- [Training plugins](https://github.com/framesphere/frametrain-app/tree/main/src-tauri/python/train_engine/plugins): `src-tauri/python/train_engine/plugins`
- [Evaluation plugins](https://github.com/framesphere/frametrain-app/tree/main/src-tauri/python/test_engine/plugins): `src-tauri/python/test_engine/plugins`
- [Run analysis](https://github.com/framesphere/frametrain-app/blob/main/src-tauri/src/analysis_manager.rs): `src-tauri/src/analysis_manager.rs`

### Models and hosting

- [Model manager UI](https://github.com/framesphere/frametrain-app/blob/main/src/components/ModelManager.tsx): `src/components/ModelManager.tsx`
- [Model manager](https://github.com/framesphere/frametrain-app/blob/main/src-tauri/src/model_manager.rs): `src-tauri/src/model_manager.rs`
- [Model versioning UI](https://github.com/framesphere/frametrain-app/blob/main/src/components/VersionManager.tsx): `src/components/VersionManager.tsx`
- [Hosting UI](https://github.com/framesphere/frametrain-app/blob/main/src/components/hosting/HostingPanel.tsx): `src/components/hosting/HostingPanel.tsx`
- [Hosting services](https://github.com/framesphere/frametrain-app/blob/main/src-tauri/src/hosting_api.rs): `src-tauri/src/hosting_api.rs`

### Synapse builder

- [Synapse canvas](https://github.com/framesphere/frametrain-app/blob/main/src/components/synapse/SynapseBuilder.tsx): `src/components/synapse/SynapseBuilder.tsx`
- [Synapse service](https://github.com/framesphere/frametrain-app/blob/main/src-tauri/python/synapse/service.py): `src-tauri/python/synapse/service.py`
- [Graph and code nodes](https://github.com/framesphere/frametrain-app/blob/main/src-tauri/python/synapse/graph.py): `src-tauri/python/synapse/graph.py`
- [Canvas loader](https://github.com/framesphere/frametrain-app/blob/main/src-tauri/python/train_engine/plugins/canvas/loader.py): `src-tauri/python/train_engine/plugins/canvas/loader.py`

### Other components

- **User**
- **Ollama**

## Connections

- User → React app: uses
- React app → Training UI: shows (evidence: `src/App.tsx`)
- Training UI → Training manager: starts training
- Training manager → Python train engine: runs (evidence: `src-tauri/src/training_manager.rs`)
- Python train engine → Training plugins: loads plugin (evidence: `src-tauri/python/train_engine/train_engine.py`)
- Python train engine → Evaluation plugins: uses evaluation
- Training manager → Dataset manager: uses datasets (evidence: `src-tauri/src/training_manager.rs`)
- Training manager → Metadata database: records runs (evidence: `src-tauri/src/training_manager.rs`)
- Training manager → Run analysis: requests analysis (evidence: `src-tauri/src/training_manager.rs`)
- Training manager → Training state: updates progress
- User → Dataset management UI: manages data
- Dataset management UI → Dataset manager: invokes commands
- Dataset manager → Metadata database: stores metadata (evidence: `src-tauri/src/dataset_manager.rs`)
- User → Dataset Studio UI: creates datasets
- Dataset Studio UI → Studio services: invokes commands
- User → Model manager UI: imports models
- Model manager UI → Model manager: invokes commands (evidence: `src/components/ModelManager.tsx`)
- Model manager → Metadata database: checks model records (evidence: `src-tauri/src/model_manager.rs`)
- User → Model versioning UI: compares versions
- User → Hosting UI: runs models
- Hosting UI → Hosting services: requests hosting
- Hosting services → Ollama: integrates
- User → Synapse canvas: builds network
- Synapse canvas → Synapse service: invokes service
- Synapse service → Graph and code nodes: checks and exports (evidence: `src-tauri/python/synapse/service.py`)
- Synapse service → Canvas loader: loads canvas (evidence: `src-tauri/python/synapse/service.py`)
- Synapse canvas → Training manager: trains canvas model
- React app → Tauri backend: invokes commands (evidence: `src/App.tsx`)
