# farhanlabibahan/flamme architecture

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

- Interactive diagram: https://gitdiagram.com/farhanlabibahan/flamme
- Repository: https://github.com/farhanlabibahan/flamme

## Overview

Flamme is a source-linked NASA microgravity-combustion evidence platform. Users describe or configure experimental conditions, then explore matched evidence, investigation comparisons, rankings and coverage gaps; the interactive lab also combines an explicitly illustrative flame response with separate FLEX and CFI-G model results. Shared scenario/search state and deterministic ranking/parsing form the internal application layer. Evidence is limited to the README and sampled/indexed files; some page and data wiring is documented but not directly excerpted.

Main entry points: [`src/context/FlammeContext.jsx`](https://github.com/farhanlabibahan/flamme/blob/main/src/context/FlammeContext.jsx) (Shared scenario state), [`src/pages/LabPage.jsx`](https://github.com/farhanlabibahan/flamme/blob/main/src/pages/LabPage.jsx) (Lab condition controls), [`src/ranking.js`](https://github.com/farhanlabibahan/flamme/blob/main/src/ranking.js) (Evidence ranker), [`src/pages/AskPage.jsx`](https://github.com/farhanlabibahan/flamme/blob/main/src/pages/AskPage.jsx) (Ask interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application and state"]
  node_router["Page router<br/>[main.jsx]"]
  node_shell["Workspace shell<br/>[Shell.jsx]"]
  node_state["Shared scenario state<br/>[FlammeContext.jsx]"]
  node_prompt["Condition parser<br/>[prompt.js]"]
  node_ranker["Evidence ranker<br/>[ranking.js]"]
end

subgraph group_evidence["Evidence exploration"]
  node_evidence_page["Evidence search<br/>[EvidencePage.jsx]"]
  node_investigations["Investigation comparison"]
  node_rankings["Finding rankings<br/>[RankingsPage.jsx]"]
  node_gaps["Coverage gap map<br/>[GapsPage.jsx]"]
  node_sources["NASA source catalog<br/>[SourcesPage.jsx]"]
  node_ask["Ask interface<br/>[AskPage.jsx]"]
  node_catalog[("Sample evidence data<br/>[data.js]")]
  node_ask_api["Ask API endpoint<br/>[ask.js]"]
end

subgraph group_lab["Interactive flame lab"]
  node_lab_config["Lab condition controls<br/>[LabPage.jsx]"]
  node_lab_view["3D flame chamber<br/>[Lab.jsx]"]
  node_scene["Chamber scene<br/>[labScene.js]"]
  node_illustrative["Illustrative response<br/>[labModel.js]"]
end

subgraph group_models["Modeling and data"]
  node_flex["FLEX inference<br/>[flexModel.js]"]
  node_cfig["CFI-G inference<br/>[cfigModel.js]"]
  node_model_docs["Model transparency<br/>[ModelPage.jsx]"]
  node_ml_training["Offline model training"]
  node_cfig_training["CFI-G training"]
end

node_user(("Researcher"))
node_si_service{{"LLM interpretation service"}}

node_user -->|"opens pages"| node_router
node_router -->|"mounts workspace"| node_shell
node_router -->|"provides shared state"| node_state
node_shell -->|"reads source selection"| node_state
node_state -->|"ranks and filters"| node_catalog
node_state -->|"calls ranking"| node_ranker
node_evidence_page -->|"reads evidence state"| node_state
node_investigations -->|"ranks linked findings"| node_ranker
node_rankings -->|"scores findings"| node_ranker
node_gaps -->|"uses coverage logic"| node_ranker
node_sources -->|"presents citations"| node_user
node_ask -->|"reads shared context"| node_state
node_ask -->|"parses questions"| node_prompt
node_ask -->|"requests interpretation"| node_ask_api
node_ask_api -.->|"sends LLM request"| node_si_service
node_lab_config -->|"derives flame regime"| node_illustrative
node_lab_config -->|"predicts FLEX response"| node_flex
node_lab_config -->|"predicts CFI-G response"| node_cfig
node_lab_config -->|"opens 3D view"| node_lab_view
node_lab_view -->|"renders chamber"| node_scene
node_scene -->|"uses response model"| node_illustrative
node_model_docs -->|"documents inference"| node_flex
node_ml_training -->|"fits browser model"| node_flex
node_cfig_training -->|"fits browser model"| node_cfig
node_user -->|"compares studies"| node_investigations
node_user -->|"explores scored findings"| node_rankings
node_user -->|"inspects coverage"| node_gaps

click node_router "https://github.com/farhanlabibahan/flamme/blob/main/src/main.jsx"
click node_shell "https://github.com/farhanlabibahan/flamme/blob/main/src/components/Shell.jsx"
click node_state "https://github.com/farhanlabibahan/flamme/blob/main/src/context/FlammeContext.jsx"
click node_evidence_page "https://github.com/farhanlabibahan/flamme/blob/main/src/pages/EvidencePage.jsx"
click node_investigations "https://github.com/farhanlabibahan/flamme/blob/main/src/pages/InvestigationsPage.jsx"
click node_rankings "https://github.com/farhanlabibahan/flamme/blob/main/src/pages/RankingsPage.jsx"
click node_gaps "https://github.com/farhanlabibahan/flamme/blob/main/src/pages/GapsPage.jsx"
click node_sources "https://github.com/farhanlabibahan/flamme/blob/main/src/pages/SourcesPage.jsx"
click node_ask "https://github.com/farhanlabibahan/flamme/blob/main/src/pages/AskPage.jsx"
click node_prompt "https://github.com/farhanlabibahan/flamme/blob/main/src/prompt.js"
click node_ranker "https://github.com/farhanlabibahan/flamme/blob/main/src/ranking.js"
click node_catalog "https://github.com/farhanlabibahan/flamme/blob/main/src/data.js"
click node_lab_config "https://github.com/farhanlabibahan/flamme/blob/main/src/pages/LabPage.jsx"
click node_lab_view "https://github.com/farhanlabibahan/flamme/blob/main/src/Lab.jsx"
click node_scene "https://github.com/farhanlabibahan/flamme/blob/main/src/labScene.js"
click node_illustrative "https://github.com/farhanlabibahan/flamme/blob/main/src/labModel.js"
click node_flex "https://github.com/farhanlabibahan/flamme/blob/main/src/flexModel.js"
click node_cfig "https://github.com/farhanlabibahan/flamme/blob/main/src/cfigModel.js"
click node_model_docs "https://github.com/farhanlabibahan/flamme/blob/main/src/pages/ModelPage.jsx"
click node_ml_training "https://github.com/farhanlabibahan/flamme/blob/main/ML/build_flex_model.py"
click node_cfig_training "https://github.com/farhanlabibahan/flamme/blob/main/ML/build_cfig_model.py"
click node_ask_api "https://github.com/farhanlabibahan/flamme/blob/main/api/ask.js"

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_router,node_shell,node_state,node_prompt,node_ranker toneBlue
class node_evidence_page,node_investigations,node_rankings,node_gaps,node_sources,node_ask,node_catalog,node_ask_api toneAmber
class node_lab_config,node_lab_view,node_scene,node_illustrative toneMint
class node_flex,node_cfig,node_model_docs,node_ml_training,node_cfig_training toneRose
class node_user,node_si_service toneIndigo
```

## Components

### Application and state

- [Page router](https://github.com/farhanlabibahan/flamme/blob/main/src/main.jsx): `src/main.jsx`
- [Workspace shell](https://github.com/farhanlabibahan/flamme/blob/main/src/components/Shell.jsx): `src/components/Shell.jsx`
- [Shared scenario state](https://github.com/farhanlabibahan/flamme/blob/main/src/context/FlammeContext.jsx): `src/context/FlammeContext.jsx`
- [Condition parser](https://github.com/farhanlabibahan/flamme/blob/main/src/prompt.js): `src/prompt.js`
- [Evidence ranker](https://github.com/farhanlabibahan/flamme/blob/main/src/ranking.js): `src/ranking.js`

### Evidence exploration

- [Evidence search](https://github.com/farhanlabibahan/flamme/blob/main/src/pages/EvidencePage.jsx): `src/pages/EvidencePage.jsx`
- [Investigation comparison](https://github.com/farhanlabibahan/flamme/blob/main/src/pages/InvestigationsPage.jsx): `src/pages/InvestigationsPage.jsx`
- [Finding rankings](https://github.com/farhanlabibahan/flamme/blob/main/src/pages/RankingsPage.jsx): `src/pages/RankingsPage.jsx`
- [Coverage gap map](https://github.com/farhanlabibahan/flamme/blob/main/src/pages/GapsPage.jsx): `src/pages/GapsPage.jsx`
- [NASA source catalog](https://github.com/farhanlabibahan/flamme/blob/main/src/pages/SourcesPage.jsx): `src/pages/SourcesPage.jsx`
- [Ask interface](https://github.com/farhanlabibahan/flamme/blob/main/src/pages/AskPage.jsx): `src/pages/AskPage.jsx`
- [Sample evidence data](https://github.com/farhanlabibahan/flamme/blob/main/src/data.js): `src/data.js`
- [Ask API endpoint](https://github.com/farhanlabibahan/flamme/blob/main/api/ask.js): `api/ask.js`

### Interactive flame lab

- [Lab condition controls](https://github.com/farhanlabibahan/flamme/blob/main/src/pages/LabPage.jsx): `src/pages/LabPage.jsx`
- [3D flame chamber](https://github.com/farhanlabibahan/flamme/blob/main/src/Lab.jsx): `src/Lab.jsx`
- [Chamber scene](https://github.com/farhanlabibahan/flamme/blob/main/src/labScene.js): `src/labScene.js`
- [Illustrative response](https://github.com/farhanlabibahan/flamme/blob/main/src/labModel.js): `src/labModel.js`

### Modeling and data

- [FLEX inference](https://github.com/farhanlabibahan/flamme/blob/main/src/flexModel.js): `src/flexModel.js`
- [CFI-G inference](https://github.com/farhanlabibahan/flamme/blob/main/src/cfigModel.js): `src/cfigModel.js`
- [Model transparency](https://github.com/farhanlabibahan/flamme/blob/main/src/pages/ModelPage.jsx): `src/pages/ModelPage.jsx`
- [Offline model training](https://github.com/farhanlabibahan/flamme/blob/main/ML/build_flex_model.py): `ML/build_flex_model.py`
- [CFI-G training](https://github.com/farhanlabibahan/flamme/blob/main/ML/build_cfig_model.py): `ML/build_cfig_model.py`

### Other components

- **Researcher**
- **LLM interpretation service**

## Connections

- Researcher → Page router: opens pages (evidence: `src/main.jsx`)
- Page router → Workspace shell: mounts workspace (evidence: `src/main.jsx`)
- Page router → Shared scenario state: provides shared state (evidence: `src/main.jsx`)
- Workspace shell → Shared scenario state: reads source selection (evidence: `src/components/Shell.jsx`)
- Shared scenario state → Sample evidence data: ranks and filters (evidence: `src/context/FlammeContext.jsx`)
- Shared scenario state → Evidence ranker: calls ranking (evidence: `src/context/FlammeContext.jsx`)
- Evidence search → Shared scenario state: reads evidence state (evidence: `src/pages/EvidencePage.jsx`)
- Investigation comparison → Evidence ranker: ranks linked findings (evidence: `src/pages/InvestigationsPage.jsx`)
- Finding rankings → Evidence ranker: scores findings (evidence: `src/pages/RankingsPage.jsx`)
- Coverage gap map → Evidence ranker: uses coverage logic (evidence: `src/pages/GapsPage.jsx`)
- NASA source catalog → Researcher: presents citations
- Ask interface → Shared scenario state: reads shared context (evidence: `src/pages/AskPage.jsx`)
- Ask interface → Condition parser: parses questions (evidence: `src/pages/AskPage.jsx`)
- Ask interface → Ask API endpoint: requests interpretation
- Ask API endpoint → LLM interpretation service: sends LLM request
- Lab condition controls → Illustrative response: derives flame regime (evidence: `src/pages/LabPage.jsx`)
- Lab condition controls → FLEX inference: predicts FLEX response (evidence: `src/pages/LabPage.jsx`)
- Lab condition controls → CFI-G inference: predicts CFI-G response (evidence: `src/pages/LabPage.jsx`)
- Lab condition controls → 3D flame chamber: opens 3D view (evidence: `src/pages/LabPage.jsx`)
- 3D flame chamber → Chamber scene: renders chamber (evidence: `src/Lab.jsx`)
- Chamber scene → Illustrative response: uses response model (evidence: `src/labScene.js`)
- Model transparency → FLEX inference: documents inference (evidence: `src/pages/ModelPage.jsx`)
- Offline model training → FLEX inference: fits browser model
- CFI-G training → CFI-G inference: fits browser model
- Researcher → Investigation comparison: compares studies
- Researcher → Finding rankings: explores scored findings
- Researcher → Coverage gap map: inspects coverage
