# bhavyasharma-sys/flame-in-firewall architecture

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

- Interactive diagram: https://gitdiagram.com/bhavyasharma-sys/flame-in-firewall
- Repository: https://github.com/bhavyasharma-sys/flame-in-firewall

## Overview

Flame in Freefall is a NASA spacecraft fire-safety intelligence application. Users explore mission data, configure cabin conditions, inspect combustion-risk and Shapley results, compare NASA test runs, and ask FlameAI questions grounded in documents and graph facts. The browser modules call the unified FastAPI server; its domain engines and Graph-RAG services supply the results. The README documents additional explorer, library, dashboard, and visualization capabilities. Some backend and UI modules were not sampled, so only documented or evidenced connections are shown.

Main entry points: [`server.py`](https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/server.py) (FastAPI service), [`core/rag_pipeline.py`](https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/core/rag_pipeline.py) (Graph-RAG pipeline), [`frontend/js/app.js`](https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/frontend/js/app.js) (UI bootstrap), [`frontend/js/api.js`](https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/frontend/js/api.js) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Mission Control UI"]
  node_app["UI bootstrap<br/>[app.js]"]
  node_cabin_ui["Cabin safety lab<br/>[cabin.js]"]
  node_flame_twin["Flame digital twin<br/>[flame-twin.js]"]
  node_rank_ui["Run ranker<br/>[ranking.js]"]
  node_graph_ui["Knowledge graph UI<br/>[graph.js]"]
  node_chat_ui["FlameAI co-pilot<br/>[chat.js]"]
  node_library_ui["Research library<br/>[resources.js]"]
  node_api_client["API client<br/>[api.js]"]
end

subgraph group_api["Application API"]
  node_server["FastAPI service<br/>[server.py]"]
end

subgraph group_domain["Safety Analysis"]
  node_combustion["Combustion physics<br/>[combustion.py]"]
  node_fire_risk["Cabin risk engine<br/>[fire_risk.py]"]
  node_shapley["Shapley attribution<br/>[shapley.py]"]
  node_scenario_ranker["Scenario ranker<br/>[scenario_ranker.py]"]
  node_entity_ranker["Entity rankings<br/>[entity_ranker.py]"]
end

subgraph group_knowledge["NASA Knowledge"]
  node_loader["NASA data loader<br/>[data_loader.py]"]
  node_ingestion["Corpus ingestion<br/>[ingestion.py]"]
  node_kg["Knowledge graph<br/>[knowledge_graph.py]"]
end

subgraph group_rag["FlameAI Retrieval"]
  node_vectorstore["Hybrid vector search<br/>[vectorstore.py]"]
  node_rag["Graph-RAG pipeline<br/>[rag_pipeline.py]"]
  node_llm["LLM providers<br/>[llm_client.py]"]
  node_citations["Citation audit<br/>[citations.py]"]
  node_charts["Scientific charts<br/>[chart_generator.py]"]
  node_memory["Conversation memory<br/>[memory.py]"]
end

node_user(("Mission user"))

node_user -->|"uses"| node_app
node_app -->|"initializes"| node_cabin_ui
node_app -->|"initializes"| node_rank_ui
node_app -->|"initializes"| node_graph_ui
node_app -->|"initializes"| node_chat_ui
node_app -->|"initializes"| node_library_ui
node_app -->|"initializes"| node_flame_twin
node_cabin_ui -->|"requests evaluation"| node_api_client
node_rank_ui -->|"requests rankings"| node_api_client
node_graph_ui -->|"requests graph"| node_api_client
node_chat_ui -->|"sends questions"| node_api_client
node_library_ui -->|"requests documents"| node_api_client
node_api_client -->|"calls API"| node_server
node_flame_twin -->|"requests physics"| node_server
node_server -->|"evaluates cabin"| node_combustion
node_server -.->|"computes risk"| node_fire_risk
node_server -.->|"attributes risk"| node_shapley
node_server -->|"ranks runs"| node_scenario_ranker
node_server -.->|"ranks entities"| node_entity_ranker
node_server -.->|"loads datasets"| node_loader
node_loader -.->|"provides documents"| node_ingestion
node_ingestion -.->|"indexes chunks"| node_vectorstore
node_server -.->|"serves graph"| node_kg
node_rag -->|"retrieves evidence"| node_vectorstore
node_rag -->|"adds graph facts"| node_kg
node_rag -->|"ranks matching runs"| node_scenario_ranker
node_rag -->|"evaluates scenario"| node_fire_risk
node_rag -->|"generates answer"| node_llm
node_rag -->|"audits citations"| node_citations
node_rag -->|"creates charts"| node_charts
node_rag -.->|"uses conversation context"| node_memory

click node_app "https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/frontend/js/app.js"
click node_cabin_ui "https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/frontend/js/cabin.js"
click node_flame_twin "https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/frontend/js/flame-twin.js"
click node_rank_ui "https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/frontend/js/ranking.js"
click node_graph_ui "https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/frontend/js/graph.js"
click node_chat_ui "https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/frontend/js/chat.js"
click node_library_ui "https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/frontend/js/resources.js"
click node_api_client "https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/frontend/js/api.js"
click node_server "https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/server.py"
click node_combustion "https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/domain/combustion.py"
click node_fire_risk "https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/domain/fire_risk.py"
click node_shapley "https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/domain/shapley.py"
click node_scenario_ranker "https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/domain/scenario_ranker.py"
click node_entity_ranker "https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/domain/entity_ranker.py"
click node_loader "https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/utils/data_loader.py"
click node_ingestion "https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/core/ingestion.py"
click node_kg "https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/core/knowledge_graph.py"
click node_vectorstore "https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/core/vectorstore.py"
click node_rag "https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/core/rag_pipeline.py"
click node_llm "https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/core/llm_client.py"
click node_citations "https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/core/citations.py"
click node_charts "https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/core/chart_generator.py"
click node_memory "https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/core/memory.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_cabin_ui,node_flame_twin,node_rank_ui,node_graph_ui,node_chat_ui,node_library_ui,node_api_client,node_user toneBlue
class node_server toneAmber
class node_combustion,node_fire_risk,node_shapley,node_scenario_ranker,node_entity_ranker toneMint
class node_loader,node_ingestion,node_kg toneRose
class node_vectorstore,node_rag,node_llm,node_citations,node_charts,node_memory toneIndigo
```

## Components

### Mission Control UI

- [UI bootstrap](https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/frontend/js/app.js): `frontend/js/app.js`
- [Cabin safety lab](https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/frontend/js/cabin.js): `frontend/js/cabin.js`
- [Flame digital twin](https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/frontend/js/flame-twin.js): `frontend/js/flame-twin.js`
- [Run ranker](https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/frontend/js/ranking.js): `frontend/js/ranking.js`
- [Knowledge graph UI](https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/frontend/js/graph.js): `frontend/js/graph.js`
- [FlameAI co-pilot](https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/frontend/js/chat.js): `frontend/js/chat.js`
- [Research library](https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/frontend/js/resources.js): `frontend/js/resources.js`
- [API client](https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/frontend/js/api.js): `frontend/js/api.js`

### Application API

- [FastAPI service](https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/server.py): `server.py`

### Safety Analysis

- [Combustion physics](https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/domain/combustion.py): `domain/combustion.py`
- [Cabin risk engine](https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/domain/fire_risk.py): `domain/fire_risk.py`
- [Shapley attribution](https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/domain/shapley.py): `domain/shapley.py`
- [Scenario ranker](https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/domain/scenario_ranker.py): `domain/scenario_ranker.py`
- [Entity rankings](https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/domain/entity_ranker.py): `domain/entity_ranker.py`

### NASA Knowledge

- [NASA data loader](https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/utils/data_loader.py): `utils/data_loader.py`
- [Corpus ingestion](https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/core/ingestion.py): `core/ingestion.py`
- [Knowledge graph](https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/core/knowledge_graph.py): `core/knowledge_graph.py`

### FlameAI Retrieval

- [Hybrid vector search](https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/core/vectorstore.py): `core/vectorstore.py`
- [Graph-RAG pipeline](https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/core/rag_pipeline.py): `core/rag_pipeline.py`
- [LLM providers](https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/core/llm_client.py): `core/llm_client.py`
- [Citation audit](https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/core/citations.py): `core/citations.py`
- [Scientific charts](https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/core/chart_generator.py): `core/chart_generator.py`
- [Conversation memory](https://github.com/bhavyasharma-sys/flame-in-firewall/blob/main/core/memory.py): `core/memory.py`

### Other components

- **Mission user**

## Connections

- Mission user → UI bootstrap: uses (evidence: `README.md`)
- UI bootstrap → Cabin safety lab: initializes (evidence: `frontend/js/app.js`)
- UI bootstrap → Run ranker: initializes (evidence: `frontend/js/app.js`)
- UI bootstrap → Knowledge graph UI: initializes (evidence: `frontend/js/app.js`)
- UI bootstrap → FlameAI co-pilot: initializes (evidence: `frontend/js/app.js`)
- UI bootstrap → Research library: initializes (evidence: `frontend/js/app.js`)
- UI bootstrap → Flame digital twin: initializes (evidence: `frontend/js/app.js`)
- Cabin safety lab → API client: requests evaluation (evidence: `frontend/js/cabin.js`)
- Run ranker → API client: requests rankings (evidence: `README.md`)
- Knowledge graph UI → API client: requests graph (evidence: `frontend/js/graph.js`)
- FlameAI co-pilot → API client: sends questions (evidence: `frontend/js/chat.js`)
- Research library → API client: requests documents (evidence: `README.md`)
- API client → FastAPI service: calls API (evidence: `README.md`)
- Flame digital twin → FastAPI service: requests physics (evidence: `README.md`)
- FastAPI service → Combustion physics: evaluates cabin (evidence: `server.py`)
- FastAPI service → Cabin risk engine: computes risk (evidence: `server.py`)
- FastAPI service → Shapley attribution: attributes risk
- FastAPI service → Scenario ranker: ranks runs (evidence: `server.py`)
- FastAPI service → Entity rankings: ranks entities (evidence: `server.py`)
- FastAPI service → NASA data loader: loads datasets (evidence: `server.py`)
- NASA data loader → Corpus ingestion: provides documents (evidence: `core/ingestion.py`)
- Corpus ingestion → Hybrid vector search: indexes chunks
- FastAPI service → Knowledge graph: serves graph (evidence: `server.py`)
- Graph-RAG pipeline → Hybrid vector search: retrieves evidence (evidence: `README.md`)
- Graph-RAG pipeline → Knowledge graph: adds graph facts (evidence: `README.md`)
- Graph-RAG pipeline → Scenario ranker: ranks matching runs (evidence: `core/rag_pipeline.py`)
- Graph-RAG pipeline → Cabin risk engine: evaluates scenario (evidence: `core/rag_pipeline.py`)
- Graph-RAG pipeline → LLM providers: generates answer (evidence: `README.md`)
- Graph-RAG pipeline → Citation audit: audits citations (evidence: `README.md`)
- Graph-RAG pipeline → Scientific charts: creates charts (evidence: `README.md`)
- Graph-RAG pipeline → Conversation memory: uses conversation context (evidence: `core/rag_pipeline.py`)
