# alayalab/meshaxiom architecture

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

- Interactive diagram: https://gitdiagram.com/alayalab/meshaxiom
- Repository: https://github.com/alayalab/meshaxiom

## Overview

MeshAxiom is an image-to-triangle-mesh inference stack with separate material-texturing and image-enhancement capabilities. The main workflow accepts an image and face budget through the CLI, Python API, or web interface; the shared pipeline coordinates preprocessing and isolated geometry workers, then returns validated mesh artifacts. The repository also exposes agent tools and model-loading support. The graph follows explicit imports, calls, and README descriptions; unsampled operation dispatches are shown only as unverified dashed links.

Main entry points: [`src/meshaxiom/pipeline.py`](https://github.com/alayalab/meshaxiom/blob/main/src/meshaxiom/pipeline.py) (Shared Pipeline), [`src/meshaxiom/cli.py`](https://github.com/alayalab/meshaxiom/blob/main/src/meshaxiom/cli.py) (CLI), [`src/meshaxiom/workers/material.py`](https://github.com/alayalab/meshaxiom/blob/main/src/meshaxiom/workers/material.py) (Material Worker), [`src/meshaxiom/server.py`](https://github.com/alayalab/meshaxiom/blob/main/src/meshaxiom/server.py) (Local HTTP Server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User Interfaces"]
  node_cli["CLI<br/>[cli.py]"]
  node_server["Local HTTP Server<br/>[server.py]"]
  node_tools["Agent Tools<br/>[tools.py]"]
  node_webui["Hosted Web UI<br/>[app.py]"]
end

subgraph group_runtime["Shared Runtime"]
  node_pipeline["Shared Pipeline<br/>[pipeline.py]"]
  node_config["Configuration<br/>[config.py]"]
  node_contracts["Request Contracts<br/>[contracts.py]"]
  node_modelhub["Model Hub Loader<br/>[hub.py]"]
end

subgraph group_geometry["Geometry Inference"]
  node_preprocess["Image Preprocessing<br/>[preprocess.py]"]
  node_session["Worker Sessions<br/>[session.py]"]
  node_vertex["Vertex Generation<br/>[vertex.py]"]
  node_topology["Topology Generation<br/>[topology.py]"]
  node_geometry_state["Geometry Model State<br/>[_geometry_state.py]"]
end

subgraph group_media["Material and Enhancement"]
  node_material_worker["Material Worker<br/>[material.py]"]
  node_alignment["Camera Alignment<br/>[alignment.py]"]
  node_mesh_geometry["Mesh I/O and Validation<br/>[geometry.py]"]
  node_pixal["Texture Generation<br/>[pixal.py]"]
  node_superresolution["Image Upscaling<br/>[superresolution.py]"]
  node_super_worker["Enhancement Worker<br/>[superresolution.py]"]
end

node_user(("User or Agent"))

node_user -->|"requests generation"| node_cli
node_user -->|"submits jobs"| node_server
node_user -->|"uploads image"| node_webui
node_cli -->|"invokes operations"| node_pipeline
node_cli -->|"starts server"| node_server
node_cli -->|"runs tool"| node_tools
node_server -->|"runs jobs"| node_pipeline
node_webui -->|"generates mesh"| node_pipeline
node_pipeline -->|"loads settings"| node_config
node_pipeline -->|"prepares image"| node_preprocess
node_pipeline -->|"loads model"| node_modelhub
node_pipeline -->|"manages workers"| node_session
node_pipeline -->|"dispatches stage"| node_vertex
node_pipeline -->|"dispatches stage"| node_topology
node_vertex -->|"loads model state"| node_geometry_state
node_topology -->|"loads model state"| node_geometry_state
node_pipeline -->|"validates artifacts"| node_contracts
node_cli -.->|"textures mesh"| node_pipeline
node_pipeline -.->|"dispatches material"| node_material_worker
node_material_worker -->|"aligns camera"| node_alignment
node_material_worker -->|"loads mesh"| node_mesh_geometry
node_material_worker -->|"generates texture"| node_pixal
node_pixal -->|"uses mesh utilities"| node_mesh_geometry
node_cli -.->|"enhances image"| node_pipeline
node_pipeline -.->|"dispatches enhancement"| node_super_worker
node_super_worker -->|"uses upscaler"| node_superresolution

click node_cli "https://github.com/alayalab/meshaxiom/blob/main/src/meshaxiom/cli.py"
click node_server "https://github.com/alayalab/meshaxiom/blob/main/src/meshaxiom/server.py"
click node_tools "https://github.com/alayalab/meshaxiom/blob/main/src/meshaxiom/tools.py"
click node_webui "https://github.com/alayalab/meshaxiom/blob/main/deploy/huggingface/space/app.py"
click node_pipeline "https://github.com/alayalab/meshaxiom/blob/main/src/meshaxiom/pipeline.py"
click node_config "https://github.com/alayalab/meshaxiom/blob/main/src/meshaxiom/config.py"
click node_contracts "https://github.com/alayalab/meshaxiom/blob/main/src/meshaxiom/contracts.py"
click node_modelhub "https://github.com/alayalab/meshaxiom/blob/main/src/meshaxiom/hub.py"
click node_preprocess "https://github.com/alayalab/meshaxiom/blob/main/src/meshaxiom/preprocess.py"
click node_session "https://github.com/alayalab/meshaxiom/blob/main/src/meshaxiom/session.py"
click node_vertex "https://github.com/alayalab/meshaxiom/blob/main/src/meshaxiom/workers/vertex.py"
click node_topology "https://github.com/alayalab/meshaxiom/blob/main/src/meshaxiom/workers/topology.py"
click node_geometry_state "https://github.com/alayalab/meshaxiom/blob/main/src/meshaxiom/workers/_geometry_state.py"
click node_material_worker "https://github.com/alayalab/meshaxiom/blob/main/src/meshaxiom/workers/material.py"
click node_alignment "https://github.com/alayalab/meshaxiom/blob/main/src/meshaxiom/material_backend/alignment.py"
click node_mesh_geometry "https://github.com/alayalab/meshaxiom/blob/main/src/meshaxiom/material_backend/geometry.py"
click node_pixal "https://github.com/alayalab/meshaxiom/blob/main/src/meshaxiom/material_backend/pixal.py"
click node_superresolution "https://github.com/alayalab/meshaxiom/blob/main/src/meshaxiom/material_backend/superresolution.py"
click node_super_worker "https://github.com/alayalab/meshaxiom/blob/main/src/meshaxiom/workers/superresolution.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_cli,node_server,node_tools,node_webui,node_user toneBlue
class node_pipeline,node_config,node_contracts,node_modelhub toneAmber
class node_preprocess,node_session,node_vertex,node_topology,node_geometry_state toneMint
class node_material_worker,node_alignment,node_mesh_geometry,node_pixal,node_superresolution,node_super_worker toneRose
```

## Components

### User Interfaces

- [CLI](https://github.com/alayalab/meshaxiom/blob/main/src/meshaxiom/cli.py): `src/meshaxiom/cli.py`
- [Local HTTP Server](https://github.com/alayalab/meshaxiom/blob/main/src/meshaxiom/server.py): `src/meshaxiom/server.py`
- [Agent Tools](https://github.com/alayalab/meshaxiom/blob/main/src/meshaxiom/tools.py): `src/meshaxiom/tools.py`
- [Hosted Web UI](https://github.com/alayalab/meshaxiom/blob/main/deploy/huggingface/space/app.py): `deploy/huggingface/space/app.py`

### Shared Runtime

- [Shared Pipeline](https://github.com/alayalab/meshaxiom/blob/main/src/meshaxiom/pipeline.py): `src/meshaxiom/pipeline.py`
- [Configuration](https://github.com/alayalab/meshaxiom/blob/main/src/meshaxiom/config.py): `src/meshaxiom/config.py`
- [Request Contracts](https://github.com/alayalab/meshaxiom/blob/main/src/meshaxiom/contracts.py): `src/meshaxiom/contracts.py`
- [Model Hub Loader](https://github.com/alayalab/meshaxiom/blob/main/src/meshaxiom/hub.py): `src/meshaxiom/hub.py`

### Geometry Inference

- [Image Preprocessing](https://github.com/alayalab/meshaxiom/blob/main/src/meshaxiom/preprocess.py): `src/meshaxiom/preprocess.py`
- [Worker Sessions](https://github.com/alayalab/meshaxiom/blob/main/src/meshaxiom/session.py): `src/meshaxiom/session.py`
- [Vertex Generation](https://github.com/alayalab/meshaxiom/blob/main/src/meshaxiom/workers/vertex.py): `src/meshaxiom/workers/vertex.py`
- [Topology Generation](https://github.com/alayalab/meshaxiom/blob/main/src/meshaxiom/workers/topology.py): `src/meshaxiom/workers/topology.py`
- [Geometry Model State](https://github.com/alayalab/meshaxiom/blob/main/src/meshaxiom/workers/_geometry_state.py): `src/meshaxiom/workers/_geometry_state.py`

### Material and Enhancement

- [Material Worker](https://github.com/alayalab/meshaxiom/blob/main/src/meshaxiom/workers/material.py): `src/meshaxiom/workers/material.py`
- [Camera Alignment](https://github.com/alayalab/meshaxiom/blob/main/src/meshaxiom/material_backend/alignment.py): `src/meshaxiom/material_backend/alignment.py`
- [Mesh I/O and Validation](https://github.com/alayalab/meshaxiom/blob/main/src/meshaxiom/material_backend/geometry.py): `src/meshaxiom/material_backend/geometry.py`
- [Texture Generation](https://github.com/alayalab/meshaxiom/blob/main/src/meshaxiom/material_backend/pixal.py): `src/meshaxiom/material_backend/pixal.py`
- [Image Upscaling](https://github.com/alayalab/meshaxiom/blob/main/src/meshaxiom/material_backend/superresolution.py): `src/meshaxiom/material_backend/superresolution.py`
- [Enhancement Worker](https://github.com/alayalab/meshaxiom/blob/main/src/meshaxiom/workers/superresolution.py): `src/meshaxiom/workers/superresolution.py`

### Other components

- **User or Agent**

## Connections

- User or Agent → CLI: requests generation (evidence: `README.md`)
- User or Agent → Local HTTP Server: submits jobs (evidence: `README.md`)
- User or Agent → Hosted Web UI: uploads image (evidence: `deploy/huggingface/space/app.py`)
- CLI → Shared Pipeline: invokes operations (evidence: `src/meshaxiom/cli.py`)
- CLI → Local HTTP Server: starts server (evidence: `src/meshaxiom/cli.py`)
- CLI → Agent Tools: runs tool (evidence: `src/meshaxiom/cli.py`)
- Local HTTP Server → Shared Pipeline: runs jobs (evidence: `src/meshaxiom/server.py`)
- Hosted Web UI → Shared Pipeline: generates mesh (evidence: `deploy/huggingface/space/app.py`)
- Shared Pipeline → Configuration: loads settings (evidence: `src/meshaxiom/pipeline.py`)
- Shared Pipeline → Image Preprocessing: prepares image (evidence: `src/meshaxiom/pipeline.py`)
- Shared Pipeline → Model Hub Loader: loads model (evidence: `src/meshaxiom/pipeline.py`)
- Shared Pipeline → Worker Sessions: manages workers (evidence: `src/meshaxiom/pipeline.py`)
- Shared Pipeline → Vertex Generation: dispatches stage (evidence: `src/meshaxiom/pipeline.py`)
- Shared Pipeline → Topology Generation: dispatches stage (evidence: `src/meshaxiom/pipeline.py`)
- Vertex Generation → Geometry Model State: loads model state (evidence: `src/meshaxiom/workers/vertex.py`)
- Topology Generation → Geometry Model State: loads model state (evidence: `src/meshaxiom/workers/topology.py`)
- Shared Pipeline → Request Contracts: validates artifacts (evidence: `src/meshaxiom/pipeline.py`)
- CLI → Shared Pipeline: textures mesh (evidence: `src/meshaxiom/cli.py`)
- Shared Pipeline → Material Worker: dispatches material
- Material Worker → Camera Alignment: aligns camera (evidence: `src/meshaxiom/workers/material.py`)
- Material Worker → Mesh I/O and Validation: loads mesh (evidence: `src/meshaxiom/workers/material.py`)
- Material Worker → Texture Generation: generates texture (evidence: `src/meshaxiom/workers/material.py`)
- Texture Generation → Mesh I/O and Validation: uses mesh utilities (evidence: `src/meshaxiom/material_backend/pixal.py`)
- CLI → Shared Pipeline: enhances image (evidence: `src/meshaxiom/cli.py`)
- Shared Pipeline → Enhancement Worker: dispatches enhancement
- Enhancement Worker → Image Upscaling: uses upscaler (evidence: `src/meshaxiom/workers/superresolution.py`)
