# candywangx/tiangong-lca-next architecture

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

- Interactive diagram: https://gitdiagram.com/candywangx/tiangong-lca-next
- Repository: https://github.com/candywangx/tiangong-lca-next

## Overview

TianGong is an LCA data-management platform with a web application and a substantial Supabase Edge Functions backend. Its user workflow spans managing datasets and process data, composing life-cycle models, running calculations, and reviewing or packaging results. The graph also represents search, collaboration, and the national-carbon dashboard as distinct capabilities. The README establishes the product’s purpose; routes and filenames support the mapped areas, but most backend wiring was not sampled, so uncertain call relationships are omitted.

Main entry points: [`config/routes.ts`](https://github.com/candywangx/tiangong-lca-next/blob/main/config/routes.ts) (Product routes), [`src/pages/LifeCycleModels/index.tsx`](https://github.com/candywangx/tiangong-lca-next/blob/main/src/pages/LifeCycleModels/index.tsx) (Life-cycle models), [`src/app.tsx`](https://github.com/candywangx/tiangong-lca-next/blob/main/src/app.tsx) (Web application), [`src/pages`](https://github.com/candywangx/tiangong-lca-next/tree/main/src/pages) (Hybrid search pages)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_authoring["LCA Data Authoring"]
  node_process_data["Process data<br/>[index.tsx]"]
  node_flow_data["Flows and properties<br/>[index.tsx]"]
  node_datasets["Dataset lifecycle"]
  node_reviews["Review workflow"]
end

subgraph group_analysis["Calculation and Products"]
  node_models["Life-cycle models<br/>[index.tsx]"]
  node_matrix_calc["Matrix calculation<br/>[workerClient.ts]"]
  node_lca_jobs["LCA jobs<br/>[index.ts]"]
  node_lca_results["LCA results<br/>[index.ts]"]
  node_data_products["Data products"]
  node_tidas["TIDAS packages<br/>[index.ts]"]
end

subgraph group_platform["Platform Services"]
  node_app["Web application<br/>[app.tsx]"]
  node_routes["Product routes<br/>[routes.ts]"]
  node_teams["Teams and access"]
  node_supabase[("Supabase services<br/>[supabase_client.ts]")]
  node_edge_functions["Edge Functions"]
end

subgraph group_discovery["Search and Dashboard"]
  node_search_ui["Hybrid search pages"]
  node_search_api["Hybrid search endpoints<br/>[index.ts]"]
  node_search_handler["Search handler"]
  node_carbon_dashboard["Carbon dashboard<br/>[index.tsx]"]
end

node_user(("Platform user"))

node_user -->|"uses"| node_app
node_app -->|"renders routes"| node_routes
node_routes -->|"routes to"| node_process_data
node_routes -->|"routes to"| node_flow_data
node_routes -->|"routes to"| node_models
node_routes -->|"routes to"| node_carbon_dashboard
node_routes -->|"routes to"| node_search_ui
node_routes -->|"routes to"| node_data_products
node_user -->|"manages datasets"| node_datasets
node_user -->|"reviews data"| node_reviews
node_user -->|"manages membership"| node_teams
node_user -->|"composes models"| node_models
node_models -->|"requests calculation"| node_matrix_calc
node_user -->|"requests analysis"| node_lca_jobs
node_user -->|"manages products"| node_data_products
node_user -->|"imports or exports"| node_tidas
node_search_ui -->|"submits searches"| node_search_api
node_search_api -->|"delegates search"| node_search_handler
node_user -->|"views dashboard"| node_carbon_dashboard
node_edge_functions -->|"uses client"| node_supabase

click node_app "https://github.com/candywangx/tiangong-lca-next/blob/main/src/app.tsx"
click node_routes "https://github.com/candywangx/tiangong-lca-next/blob/main/config/routes.ts"
click node_process_data "https://github.com/candywangx/tiangong-lca-next/blob/main/src/pages/Processes/index.tsx"
click node_flow_data "https://github.com/candywangx/tiangong-lca-next/blob/main/src/pages/Flows/index.tsx"
click node_datasets "https://github.com/candywangx/tiangong-lca-next/tree/main/docker/volumes/functions/_shared/commands/dataset"
click node_reviews "https://github.com/candywangx/tiangong-lca-next/tree/main/docker/volumes/functions/_shared/commands/review"
click node_teams "https://github.com/candywangx/tiangong-lca-next/tree/main/docker/volumes/functions/_shared/commands/membership"
click node_models "https://github.com/candywangx/tiangong-lca-next/blob/main/src/pages/LifeCycleModels/index.tsx"
click node_matrix_calc "https://github.com/candywangx/tiangong-lca-next/blob/main/src/services/lifeCycleModels/matrixCalculation/workerClient.ts"
click node_lca_jobs "https://github.com/candywangx/tiangong-lca-next/blob/main/docker/volumes/functions/lca_jobs/index.ts"
click node_lca_results "https://github.com/candywangx/tiangong-lca-next/blob/main/docker/volumes/functions/lca_results/index.ts"
click node_data_products "https://github.com/candywangx/tiangong-lca-next/tree/main/docker/volumes/functions/_shared/commands/data_product"
click node_tidas "https://github.com/candywangx/tiangong-lca-next/blob/main/docker/volumes/functions/export_tidas_package/index.ts"
click node_search_ui "https://github.com/candywangx/tiangong-lca-next/tree/main/src/pages"
click node_search_api "https://github.com/candywangx/tiangong-lca-next/blob/main/docker/volumes/functions/flow_hybrid_search/index.ts"
click node_search_handler "https://github.com/candywangx/tiangong-lca-next/blob/main/docker/volumes/functions/_shared/hybrid_search_handler.ts"
click node_carbon_dashboard "https://github.com/candywangx/tiangong-lca-next/blob/main/src/pages/NationalCarbonDashboard/index.tsx"
click node_supabase "https://github.com/candywangx/tiangong-lca-next/blob/main/docker/volumes/functions/_shared/supabase_client.ts"
click node_edge_functions "https://github.com/candywangx/tiangong-lca-next/tree/main/docker/volumes/functions"

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_process_data,node_flow_data,node_datasets,node_reviews,node_user toneBlue
class node_models,node_matrix_calc,node_lca_jobs,node_lca_results,node_data_products,node_tidas toneAmber
class node_app,node_routes,node_teams,node_supabase,node_edge_functions toneMint
class node_search_ui,node_search_api,node_search_handler,node_carbon_dashboard toneRose
```

## Components

### LCA Data Authoring

- [Process data](https://github.com/candywangx/tiangong-lca-next/blob/main/src/pages/Processes/index.tsx): `src/pages/Processes/index.tsx`
- [Flows and properties](https://github.com/candywangx/tiangong-lca-next/blob/main/src/pages/Flows/index.tsx): `src/pages/Flows/index.tsx`
- [Dataset lifecycle](https://github.com/candywangx/tiangong-lca-next/tree/main/docker/volumes/functions/_shared/commands/dataset): `docker/volumes/functions/_shared/commands/dataset`
- [Review workflow](https://github.com/candywangx/tiangong-lca-next/tree/main/docker/volumes/functions/_shared/commands/review): `docker/volumes/functions/_shared/commands/review`

### Calculation and Products

- [Life-cycle models](https://github.com/candywangx/tiangong-lca-next/blob/main/src/pages/LifeCycleModels/index.tsx): `src/pages/LifeCycleModels/index.tsx`
- [Matrix calculation](https://github.com/candywangx/tiangong-lca-next/blob/main/src/services/lifeCycleModels/matrixCalculation/workerClient.ts): `src/services/lifeCycleModels/matrixCalculation/workerClient.ts`
- [LCA jobs](https://github.com/candywangx/tiangong-lca-next/blob/main/docker/volumes/functions/lca_jobs/index.ts): `docker/volumes/functions/lca_jobs/index.ts`
- [LCA results](https://github.com/candywangx/tiangong-lca-next/blob/main/docker/volumes/functions/lca_results/index.ts): `docker/volumes/functions/lca_results/index.ts`
- [Data products](https://github.com/candywangx/tiangong-lca-next/tree/main/docker/volumes/functions/_shared/commands/data_product): `docker/volumes/functions/_shared/commands/data_product`
- [TIDAS packages](https://github.com/candywangx/tiangong-lca-next/blob/main/docker/volumes/functions/export_tidas_package/index.ts): `docker/volumes/functions/export_tidas_package/index.ts`

### Platform Services

- [Web application](https://github.com/candywangx/tiangong-lca-next/blob/main/src/app.tsx): `src/app.tsx`
- [Product routes](https://github.com/candywangx/tiangong-lca-next/blob/main/config/routes.ts): `config/routes.ts`
- [Teams and access](https://github.com/candywangx/tiangong-lca-next/tree/main/docker/volumes/functions/_shared/commands/membership): `docker/volumes/functions/_shared/commands/membership`
- [Supabase services](https://github.com/candywangx/tiangong-lca-next/blob/main/docker/volumes/functions/_shared/supabase_client.ts): `docker/volumes/functions/_shared/supabase_client.ts`
- [Edge Functions](https://github.com/candywangx/tiangong-lca-next/tree/main/docker/volumes/functions): `docker/volumes/functions`

### Search and Dashboard

- [Hybrid search pages](https://github.com/candywangx/tiangong-lca-next/tree/main/src/pages): `src/pages`
- [Hybrid search endpoints](https://github.com/candywangx/tiangong-lca-next/blob/main/docker/volumes/functions/flow_hybrid_search/index.ts): `docker/volumes/functions/flow_hybrid_search/index.ts`
- [Search handler](https://github.com/candywangx/tiangong-lca-next/blob/main/docker/volumes/functions/_shared/hybrid_search_handler.ts): `docker/volumes/functions/_shared/hybrid_search_handler.ts`
- [Carbon dashboard](https://github.com/candywangx/tiangong-lca-next/blob/main/src/pages/NationalCarbonDashboard/index.tsx): `src/pages/NationalCarbonDashboard/index.tsx`

### Other components

- **Platform user**

## Connections

- Platform user → Web application: uses
- Web application → Product routes: renders routes
- Product routes → Process data: routes to
- Product routes → Flows and properties: routes to
- Product routes → Life-cycle models: routes to
- Product routes → Carbon dashboard: routes to
- Product routes → Hybrid search pages: routes to
- Product routes → Data products: routes to
- Platform user → Dataset lifecycle: manages datasets
- Platform user → Review workflow: reviews data
- Platform user → Teams and access: manages membership
- Platform user → Life-cycle models: composes models
- Life-cycle models → Matrix calculation: requests calculation
- Platform user → LCA jobs: requests analysis
- Platform user → Data products: manages products
- Platform user → TIDAS packages: imports or exports
- Hybrid search pages → Hybrid search endpoints: submits searches
- Hybrid search endpoints → Search handler: delegates search
- Platform user → Carbon dashboard: views dashboard
- Edge Functions → Supabase services: uses client
