# terrastackai/geospatial-studio-core architecture

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

- Interactive diagram: https://gitdiagram.com/terrastackai/geospatial-studio-core
- Repository: https://github.com/terrastackai/geospatial-studio-core

## Overview

GEOStudio Core is a FastAPI platform for geospatial model inference, dataset onboarding, fine-tuning, and related studio services. The principal workflow enters through the API, validates and records an inference request, invokes an inference pipeline, and exposes task/results; other major branches manage datasets, training jobs, authentication, and groups. The graph combines README capability descriptions with router registrations and SOURCE INDEX references. Unsampled API implementations and runtime wiring are represented conservatively; dashed links indicate documented but unverified integration.

Main entry points: [`gfmstudio/main.py`](https://github.com/terrastackai/geospatial-studio-core/blob/main/gfmstudio/main.py) (FastAPI application), [`gfmstudio/inference/v2/services.py`](https://github.com/terrastackai/geospatial-studio-core/blob/main/gfmstudio/inference/v2/services.py) (Inference services), [`gfmstudio/fine_tuning/api.py`](https://github.com/terrastackai/geospatial-studio-core/blob/main/gfmstudio/fine_tuning/api.py) (Fine-tuning APIs), [`gfmstudio/fine_tuning/utils/tune_handlers.py`](https://github.com/terrastackai/geospatial-studio-core/blob/main/gfmstudio/fine_tuning/utils/tune_handlers.py) (Training orchestration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and access"]
  node_app["FastAPI application<br/>[main.py]"]
  node_auth["Authentication<br/>[routes.py]"]
  node_groups["Groups and artifacts<br/>[api.py]"]
  node_amo["Model onboarding<br/>[api.py]"]
end

subgraph group_infer["Inference"]
  node_inferapi["Inference endpoints<br/>[api.py]"]
  node_inferflow["Inference services<br/>[services.py]"]
  node_inferredges["Inference services core<br/>[services.py]"]
  node_pipeline["Pipeline gateway"]
  node_planner["Inference planner"]
  node_runner["Inference runner<br/>[run-inference.py]"]
  node_advisor["Data advisor<br/>[data_advisor.py]"]
end

subgraph group_train["Data and training"]
  node_ftapi["Fine-tuning APIs<br/>[api.py]"]
  node_dataset["Dataset handlers"]
  node_tuning["Training orchestration<br/>[tune_handlers.py]"]
  node_kube["Kubernetes jobs<br/>[kubernetes.py]"]
  node_objects["Object storage<br/>[object_storage.py]"]
end

subgraph group_platform["Async and persistence"]
  node_worker["Celery worker<br/>[celery_worker.py]"]
  node_crud["Metadata CRUD<br/>[crud.py]"]
  node_postgres[("PostgreSQL")]
  node_redis[("Redis<br/>[redis_client.py]")]
  node_cos[("Cloud object storage<br/>[cos_client.py]")]
end

node_user(("Studio user"))

node_user -->|"submits requests"| node_app
node_app -->|"registers routes"| node_auth
node_app -->|"registers routes"| node_groups
node_app -->|"registers routes"| node_amo
node_app -->|"registers routes"| node_inferapi
node_app -->|"registers routes"| node_ftapi
node_inferapi -->|"delegates inference"| node_inferflow
node_inferflow -->|"checks data"| node_advisor
node_inferflow -->|"submits job"| node_pipeline
node_pipeline -.->|"invokes pipeline"| node_planner
node_planner -.->|"dispatches inference"| node_runner
node_inferflow -->|"uses inference services"| node_inferredges
node_ftapi -.->|"delegates training"| node_tuning
node_ftapi -.->|"manages datasets"| node_dataset
node_tuning -->|"deploys jobs"| node_kube
node_dataset -->|"reads files"| node_objects
node_tuning -.->|"queues tasks"| node_worker
node_worker -->|"runs job tasks"| node_kube
node_worker -->|"runs inference tasks"| node_inferflow
node_crud -.->|"reads and writes"| node_postgres
node_amo -->|"manages task records"| node_crud
node_objects -.->|"stores artifacts"| node_cos
node_app -->|"initializes connection"| node_redis

click node_app "https://github.com/terrastackai/geospatial-studio-core/blob/main/gfmstudio/main.py"
click node_auth "https://github.com/terrastackai/geospatial-studio-core/blob/main/gfmstudio/auth/routes.py"
click node_groups "https://github.com/terrastackai/geospatial-studio-core/blob/main/gfmstudio/groups/api.py"
click node_amo "https://github.com/terrastackai/geospatial-studio-core/blob/main/gfmstudio/amo/api.py"
click node_inferapi "https://github.com/terrastackai/geospatial-studio-core/blob/main/gfmstudio/inference/v2/api.py"
click node_inferflow "https://github.com/terrastackai/geospatial-studio-core/blob/main/gfmstudio/inference/v2/services.py"
click node_inferredges "https://github.com/terrastackai/geospatial-studio-core/blob/main/gfmstudio/inference/services.py"
click node_pipeline "https://github.com/terrastackai/geospatial-studio-core/blob/main/gfmstudio/inference/integration_adaptors/gateway_pipelines.py"
click node_planner "https://github.com/terrastackai/geospatial-studio-core/blob/main/pipelines/components/inference-planner/inference_planner.py"
click node_runner "https://github.com/terrastackai/geospatial-studio-core/blob/main/pipelines/components/run-inference/run-inference.py"
click node_advisor "https://github.com/terrastackai/geospatial-studio-core/blob/main/gfmstudio/data_advisor/data_advisor.py"
click node_ftapi "https://github.com/terrastackai/geospatial-studio-core/blob/main/gfmstudio/fine_tuning/api.py"
click node_dataset "https://github.com/terrastackai/geospatial-studio-core/blob/main/gfmstudio/fine_tuning/utils/dataset_handlers.py"
click node_tuning "https://github.com/terrastackai/geospatial-studio-core/blob/main/gfmstudio/fine_tuning/utils/tune_handlers.py"
click node_kube "https://github.com/terrastackai/geospatial-studio-core/blob/main/gfmstudio/fine_tuning/core/kubernetes.py"
click node_objects "https://github.com/terrastackai/geospatial-studio-core/blob/main/gfmstudio/fine_tuning/core/object_storage.py"
click node_worker "https://github.com/terrastackai/geospatial-studio-core/blob/main/gfmstudio/celery_worker.py"
click node_crud "https://github.com/terrastackai/geospatial-studio-core/blob/main/gfmstudio/common/api/crud.py"
click node_redis "https://github.com/terrastackai/geospatial-studio-core/blob/main/gfmstudio/redis_client.py"
click node_cos "https://github.com/terrastackai/geospatial-studio-core/blob/main/gfmstudio/cos_client.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_app,node_auth,node_groups,node_amo,node_user toneBlue
class node_inferapi,node_inferflow,node_inferredges,node_pipeline,node_planner,node_runner,node_advisor toneAmber
class node_ftapi,node_dataset,node_tuning,node_kube,node_objects toneMint
class node_worker,node_crud,node_postgres,node_redis,node_cos toneRose
```

## Components

### API and access

- [FastAPI application](https://github.com/terrastackai/geospatial-studio-core/blob/main/gfmstudio/main.py): `gfmstudio/main.py`
- [Authentication](https://github.com/terrastackai/geospatial-studio-core/blob/main/gfmstudio/auth/routes.py): `gfmstudio/auth/routes.py`
- [Groups and artifacts](https://github.com/terrastackai/geospatial-studio-core/blob/main/gfmstudio/groups/api.py): `gfmstudio/groups/api.py`
- [Model onboarding](https://github.com/terrastackai/geospatial-studio-core/blob/main/gfmstudio/amo/api.py): `gfmstudio/amo/api.py`

### Inference

- [Inference endpoints](https://github.com/terrastackai/geospatial-studio-core/blob/main/gfmstudio/inference/v2/api.py): `gfmstudio/inference/v2/api.py`
- [Inference services](https://github.com/terrastackai/geospatial-studio-core/blob/main/gfmstudio/inference/v2/services.py): `gfmstudio/inference/v2/services.py`
- [Inference services core](https://github.com/terrastackai/geospatial-studio-core/blob/main/gfmstudio/inference/services.py): `gfmstudio/inference/services.py`
- [Pipeline gateway](https://github.com/terrastackai/geospatial-studio-core/blob/main/gfmstudio/inference/integration_adaptors/gateway_pipelines.py): `gfmstudio/inference/integration_adaptors/gateway_pipelines.py`
- [Inference planner](https://github.com/terrastackai/geospatial-studio-core/blob/main/pipelines/components/inference-planner/inference_planner.py): `pipelines/components/inference-planner/inference_planner.py`
- [Inference runner](https://github.com/terrastackai/geospatial-studio-core/blob/main/pipelines/components/run-inference/run-inference.py): `pipelines/components/run-inference/run-inference.py`
- [Data advisor](https://github.com/terrastackai/geospatial-studio-core/blob/main/gfmstudio/data_advisor/data_advisor.py): `gfmstudio/data_advisor/data_advisor.py`

### Data and training

- [Fine-tuning APIs](https://github.com/terrastackai/geospatial-studio-core/blob/main/gfmstudio/fine_tuning/api.py): `gfmstudio/fine_tuning/api.py`
- [Dataset handlers](https://github.com/terrastackai/geospatial-studio-core/blob/main/gfmstudio/fine_tuning/utils/dataset_handlers.py): `gfmstudio/fine_tuning/utils/dataset_handlers.py`
- [Training orchestration](https://github.com/terrastackai/geospatial-studio-core/blob/main/gfmstudio/fine_tuning/utils/tune_handlers.py): `gfmstudio/fine_tuning/utils/tune_handlers.py`
- [Kubernetes jobs](https://github.com/terrastackai/geospatial-studio-core/blob/main/gfmstudio/fine_tuning/core/kubernetes.py): `gfmstudio/fine_tuning/core/kubernetes.py`
- [Object storage](https://github.com/terrastackai/geospatial-studio-core/blob/main/gfmstudio/fine_tuning/core/object_storage.py): `gfmstudio/fine_tuning/core/object_storage.py`

### Async and persistence

- [Celery worker](https://github.com/terrastackai/geospatial-studio-core/blob/main/gfmstudio/celery_worker.py): `gfmstudio/celery_worker.py`
- [Metadata CRUD](https://github.com/terrastackai/geospatial-studio-core/blob/main/gfmstudio/common/api/crud.py): `gfmstudio/common/api/crud.py`
- **PostgreSQL**
- [Redis](https://github.com/terrastackai/geospatial-studio-core/blob/main/gfmstudio/redis_client.py): `gfmstudio/redis_client.py`
- [Cloud object storage](https://github.com/terrastackai/geospatial-studio-core/blob/main/gfmstudio/cos_client.py): `gfmstudio/cos_client.py`

### Other components

- **Studio user**

## Connections

- Studio user → FastAPI application: submits requests (evidence: `README.md`)
- FastAPI application → Authentication: registers routes (evidence: `gfmstudio/main.py`)
- FastAPI application → Groups and artifacts: registers routes (evidence: `gfmstudio/main.py`)
- FastAPI application → Model onboarding: registers routes (evidence: `gfmstudio/main.py`)
- FastAPI application → Inference endpoints: registers routes (evidence: `gfmstudio/main.py`)
- FastAPI application → Fine-tuning APIs: registers routes (evidence: `gfmstudio/main.py`)
- Inference endpoints → Inference services: delegates inference (evidence: `gfmstudio/inference/v2/services.py`)
- Inference services → Data advisor: checks data (evidence: `gfmstudio/inference/v2/services.py`)
- Inference services → Pipeline gateway: submits job (evidence: `gfmstudio/inference/v2/services.py`)
- Pipeline gateway → Inference planner: invokes pipeline
- Inference planner → Inference runner: dispatches inference
- Inference services → Inference services core: uses inference services (evidence: `gfmstudio/inference/v2/services.py`)
- Fine-tuning APIs → Training orchestration: delegates training
- Fine-tuning APIs → Dataset handlers: manages datasets
- Training orchestration → Kubernetes jobs: deploys jobs (evidence: `gfmstudio/fine_tuning/utils/tune_handlers.py`)
- Dataset handlers → Object storage: reads files (evidence: `gfmstudio/fine_tuning/utils/dataset_handlers.py`)
- Training orchestration → Celery worker: queues tasks (evidence: `gfmstudio/fine_tuning/utils/tune_handlers.py`)
- Celery worker → Kubernetes jobs: runs job tasks (evidence: `gfmstudio/celery_worker.py`)
- Celery worker → Inference services: runs inference tasks (evidence: `gfmstudio/celery_worker.py`)
- Metadata CRUD → PostgreSQL: reads and writes
- Model onboarding → Metadata CRUD: manages task records
- Object storage → Cloud object storage: stores artifacts
- FastAPI application → Redis: initializes connection (evidence: `gfmstudio/main.py`)
