# mohammedanasnathani/modelsmith architecture

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

- Interactive diagram: https://gitdiagram.com/mohammedanasnathani/modelsmith
- Repository: https://github.com/mohammedanasnathani/modelsmith

## Overview

ModelSmith is a self-hosted model analysis, optimization, and deployment platform. Users authenticate, upload models into projects, receive architecture and latency analysis, set goals and compare ranked plans, then execute a plan and inspect benchmarks, encrypted artifacts, and reports. The FastAPI application wires API routers to a background job runner; the frontend also provides workspace, search, settings, and administration surfaces. The README documents additional reporting, sharing, and admin capabilities beyond the sampled implementation excerpts; those are represented at the documented subsystem level where exact routing is not evidenced.

Main entry points: [`backend/app/main.py`](https://github.com/mohammedanasnathani/modelsmith/blob/main/backend/app/main.py) (FastAPI application), [`backend/app/models_router.py`](https://github.com/mohammedanasnathani/modelsmith/blob/main/backend/app/models_router.py) (Model API), [`backend/app/database.py`](https://github.com/mohammedanasnathani/modelsmith/blob/main/backend/app/database.py) (SQLite workspace data), [`backend/app/runner.py`](https://github.com/mohammedanasnathani/modelsmith/blob/main/backend/app/runner.py) (Job runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Workspace interface"]
  node_frontend["Workspace app<br/>[app.js]"]
  node_landing["Product landing<br/>[landing.js]"]
  node_charts["SVG charts<br/>[charts.js]"]
end

subgraph group_api["API and identity"]
  node_api_main["FastAPI application<br/>[main.py]"]
  node_auth["Authentication<br/>[auth.py]"]
  node_projects["Project workflows<br/>[projects.py]"]
  node_models["Model API<br/>[models_router.py]"]
  node_admin["Admin API<br/>[admin.py]"]
end

subgraph group_intelligence["Model intelligence"]
  node_analysis["Model profiling<br/>[analysis.py]"]
  node_planner["Plan generation<br/>[planner.py]"]
end

subgraph group_execution["Jobs and results"]
  node_executor["Optimization execution<br/>[executor.py]"]
  node_runner["Job runner<br/>[runner.py]"]
  node_jobs["Job queue<br/>[jobs.py]"]
  node_reports["Reports and sharing<br/>[reports.py]"]
end

subgraph group_state["Persistence and security"]
  node_db[("SQLite workspace data<br/>[database.py]")]
  node_security["Token and encryption<br/>[security.py]"]
  node_uploads[("Encrypted model files")]
  node_artifacts[("Encrypted run artifacts")]
end

node_user(("Workspace user"))
node_hook["User webhook"]

node_user -->|"uses"| node_frontend
node_frontend -->|"API requests"| node_api_main
node_user -->|"views"| node_landing
node_landing -->|"renders charts"| node_charts
node_frontend -->|"renders charts"| node_charts
node_api_main -->|"mounts router"| node_auth
node_api_main -->|"mounts router"| node_projects
node_api_main -->|"mounts router"| node_models
node_api_main -->|"mounts router"| node_runner
node_api_main -->|"mounts router"| node_admin
node_api_main -->|"starts runner"| node_jobs
node_auth -->|"reads and writes"| node_db
node_auth -->|"validates tokens"| node_security
node_auth -.->|"dispatches events"| node_hook
node_projects -->|"reads and writes"| node_db
node_projects -->|"stores uploads"| node_uploads
node_projects -->|"encrypts files"| node_security
node_models -->|"reads and writes"| node_db
node_models -->|"profiles model"| node_analysis
node_models -->|"generates plans"| node_planner
node_models -->|"queues work"| node_jobs
node_models -->|"reads artifacts"| node_artifacts
node_runner -->|"processes jobs"| node_jobs
node_runner -->|"executes plans"| node_executor
node_runner -->|"analyzes models"| node_analysis
node_runner -->|"updates job state"| node_db
node_executor -->|"loads model"| node_uploads
node_executor -->|"writes artifacts"| node_artifacts
node_executor -->|"encrypts artifacts"| node_security
node_admin -->|"reads and writes"| node_db
node_reports -->|"reads results"| node_db
node_reports -->|"includes run data"| node_artifacts

click node_frontend "https://github.com/mohammedanasnathani/modelsmith/blob/main/frontend/app.js"
click node_landing "https://github.com/mohammedanasnathani/modelsmith/blob/main/frontend/landing.js"
click node_charts "https://github.com/mohammedanasnathani/modelsmith/blob/main/frontend/charts.js"
click node_api_main "https://github.com/mohammedanasnathani/modelsmith/blob/main/backend/app/main.py"
click node_auth "https://github.com/mohammedanasnathani/modelsmith/blob/main/backend/app/auth.py"
click node_projects "https://github.com/mohammedanasnathani/modelsmith/blob/main/backend/app/projects.py"
click node_models "https://github.com/mohammedanasnathani/modelsmith/blob/main/backend/app/models_router.py"
click node_admin "https://github.com/mohammedanasnathani/modelsmith/blob/main/backend/app/admin.py"
click node_analysis "https://github.com/mohammedanasnathani/modelsmith/blob/main/backend/app/analysis.py"
click node_planner "https://github.com/mohammedanasnathani/modelsmith/blob/main/backend/app/planner.py"
click node_executor "https://github.com/mohammedanasnathani/modelsmith/blob/main/backend/app/executor.py"
click node_runner "https://github.com/mohammedanasnathani/modelsmith/blob/main/backend/app/runner.py"
click node_jobs "https://github.com/mohammedanasnathani/modelsmith/blob/main/backend/app/jobs.py"
click node_reports "https://github.com/mohammedanasnathani/modelsmith/blob/main/backend/app/reports.py"
click node_db "https://github.com/mohammedanasnathani/modelsmith/blob/main/backend/app/database.py"
click node_security "https://github.com/mohammedanasnathani/modelsmith/blob/main/backend/app/security.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_frontend,node_landing,node_charts,node_user,node_hook toneBlue
class node_api_main,node_auth,node_projects,node_models,node_admin toneAmber
class node_analysis,node_planner toneMint
class node_executor,node_runner,node_jobs,node_reports toneRose
class node_db,node_security,node_uploads,node_artifacts toneIndigo
```

## Components

### Workspace interface

- [Workspace app](https://github.com/mohammedanasnathani/modelsmith/blob/main/frontend/app.js): `frontend/app.js`
- [Product landing](https://github.com/mohammedanasnathani/modelsmith/blob/main/frontend/landing.js): `frontend/landing.js`
- [SVG charts](https://github.com/mohammedanasnathani/modelsmith/blob/main/frontend/charts.js): `frontend/charts.js`

### API and identity

- [FastAPI application](https://github.com/mohammedanasnathani/modelsmith/blob/main/backend/app/main.py): `backend/app/main.py`
- [Authentication](https://github.com/mohammedanasnathani/modelsmith/blob/main/backend/app/auth.py): `backend/app/auth.py`
- [Project workflows](https://github.com/mohammedanasnathani/modelsmith/blob/main/backend/app/projects.py): `backend/app/projects.py`
- [Model API](https://github.com/mohammedanasnathani/modelsmith/blob/main/backend/app/models_router.py): `backend/app/models_router.py`
- [Admin API](https://github.com/mohammedanasnathani/modelsmith/blob/main/backend/app/admin.py): `backend/app/admin.py`

### Model intelligence

- [Model profiling](https://github.com/mohammedanasnathani/modelsmith/blob/main/backend/app/analysis.py): `backend/app/analysis.py`
- [Plan generation](https://github.com/mohammedanasnathani/modelsmith/blob/main/backend/app/planner.py): `backend/app/planner.py`

### Jobs and results

- [Optimization execution](https://github.com/mohammedanasnathani/modelsmith/blob/main/backend/app/executor.py): `backend/app/executor.py`
- [Job runner](https://github.com/mohammedanasnathani/modelsmith/blob/main/backend/app/runner.py): `backend/app/runner.py`
- [Job queue](https://github.com/mohammedanasnathani/modelsmith/blob/main/backend/app/jobs.py): `backend/app/jobs.py`
- [Reports and sharing](https://github.com/mohammedanasnathani/modelsmith/blob/main/backend/app/reports.py): `backend/app/reports.py`

### Persistence and security

- [SQLite workspace data](https://github.com/mohammedanasnathani/modelsmith/blob/main/backend/app/database.py): `backend/app/database.py`
- [Token and encryption](https://github.com/mohammedanasnathani/modelsmith/blob/main/backend/app/security.py): `backend/app/security.py`
- **Encrypted model files**
- **Encrypted run artifacts**

### Other components

- **Workspace user**
- **User webhook**

## Connections

- Workspace user → Workspace app: uses
- Workspace app → FastAPI application: API requests
- Workspace user → Product landing: views
- Product landing → SVG charts: renders charts
- Workspace app → SVG charts: renders charts
- FastAPI application → Authentication: mounts router
- FastAPI application → Project workflows: mounts router
- FastAPI application → Model API: mounts router
- FastAPI application → Job runner: mounts router
- FastAPI application → Admin API: mounts router
- FastAPI application → Job queue: starts runner
- Authentication → SQLite workspace data: reads and writes
- Authentication → Token and encryption: validates tokens
- Authentication → User webhook: dispatches events
- Project workflows → SQLite workspace data: reads and writes
- Project workflows → Encrypted model files: stores uploads
- Project workflows → Token and encryption: encrypts files
- Model API → SQLite workspace data: reads and writes
- Model API → Model profiling: profiles model
- Model API → Plan generation: generates plans
- Model API → Job queue: queues work
- Model API → Encrypted run artifacts: reads artifacts
- Job runner → Job queue: processes jobs
- Job runner → Optimization execution: executes plans
- Job runner → Model profiling: analyzes models
- Job runner → SQLite workspace data: updates job state
- Optimization execution → Encrypted model files: loads model
- Optimization execution → Encrypted run artifacts: writes artifacts
- Optimization execution → Token and encryption: encrypts artifacts
- Admin API → SQLite workspace data: reads and writes
- Reports and sharing → SQLite workspace data: reads results
- Reports and sharing → Encrypted run artifacts: includes run data
