# stfbk/pillar architecture

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

- Interactive diagram: https://gitdiagram.com/stfbk/pillar
- Repository: https://github.com/stfbk/pillar

## Overview

P.I.L.L.A.R. is a Streamlit privacy-threat-modeling tool. Developers describe an application or create/import a DFD, run one of three LINDDUN analyses, assess threat impact and controls, then download a report. The map preserves the documented workflow and major analysis branches; some connections are supported by the README or source-index references rather than complete excerpts, so unsampled internals are not detailed.

Main entry points: [`main.py`](https://github.com/stfbk/pillar/blob/master/main.py) (Streamlit app), [`llms/linddun_pro.py`](https://github.com/stfbk/pillar/blob/master/llms/linddun_pro.py) (LINDDUN PRO analysis), [`tabs/risk_assessment.py`](https://github.com/stfbk/pillar/blob/master/tabs/risk_assessment.py) (Risk assessment tab), [`llms/simple.py`](https://github.com/stfbk/pillar/blob/master/llms/simple.py) (SIMPLE analysis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_app["Streamlit app<br/>[main.py]"]
  node_sidebar["Model settings<br/>[sidebar.py]"]
  node_application["Application description"]
  node_dfd_ui["DFD editor<br/>[dfd.py]"]
  node_simple_ui["SIMPLE tab<br/>[simple.py]"]
  node_go_ui["LINDDUN GO tab<br/>[linddun_go.py]"]
  node_pro_ui["LINDDUN PRO tab<br/>[linddun_pro.py]"]
  node_risk_ui["Risk assessment tab<br/>[risk_assessment.py]"]
  node_report_ui["Report tab<br/>[report.py]"]
end

subgraph group_analysis["Threat analysis"]
  node_dfd_engine["DFD generation<br/>[dfd.py]"]
  node_simple_engine["SIMPLE analysis<br/>[simple.py]"]
  node_go_engine["LINDDUN GO simulation<br/>[linddun_go.py]"]
  node_pro_engine["LINDDUN PRO analysis<br/>[linddun_pro.py]"]
end

subgraph group_assessment["Risk and reporting"]
  node_risk_engine["Impact and controls<br/>[risk_assessment.py]"]
  node_patterns["Privacy patterns"]
  node_report_output["Downloadable report<br/>[report.py]"]
end

subgraph group_support["Models and prompts"]
  node_prompt_library["Analysis prompts<br/>[prompts.py]"]
  node_provider_config["Provider configuration<br/>[config.py]"]
  node_mapping_utils["Threat mapping helpers<br/>[utils.py]"]
end

node_developer(("Developer or analyst"))
node_llm_services{{"LLM providers"}}
node_linddun_trees{{"LINDDUN threat trees"}}

node_developer -->|"uses"| node_app
node_app -->|"renders"| node_sidebar
node_app -->|"renders"| node_application
node_app -->|"renders"| node_dfd_ui
node_app -->|"renders"| node_simple_ui
node_app -->|"renders"| node_go_ui
node_app -->|"renders"| node_pro_ui
node_app -->|"renders"| node_risk_ui
node_app -->|"renders"| node_report_ui
node_developer -->|"describes app"| node_application
node_developer -->|"edits or imports"| node_dfd_ui
node_dfd_ui -->|"generates DFD"| node_dfd_engine
node_simple_ui -->|"requests analysis"| node_simple_engine
node_go_ui -->|"runs simulation"| node_go_engine
node_pro_ui -->|"runs analysis"| node_pro_engine
node_risk_ui -->|"requests assessment"| node_risk_engine
node_risk_engine -->|"suggests controls"| node_patterns
node_report_ui -->|"generates"| node_report_output
node_risk_ui -->|"uses threat results"| node_simple_engine
node_risk_ui -->|"uses threat results"| node_go_engine
node_report_ui -->|"includes assessment"| node_risk_ui
node_simple_engine -->|"uses prompts"| node_prompt_library
node_dfd_engine -->|"uses prompts"| node_prompt_library
node_go_engine -->|"uses prompts"| node_prompt_library
node_pro_engine -->|"uses prompts"| node_prompt_library
node_risk_engine -->|"uses prompts"| node_prompt_library
node_simple_engine -.->|"queries models"| node_llm_services
node_go_engine -->|"queries agents"| node_llm_services
node_pro_engine -.->|"queries models"| node_llm_services
node_risk_engine -.->|"queries models"| node_llm_services
node_sidebar -->|"reads settings"| node_provider_config
node_go_engine -->|"reads settings"| node_provider_config
node_pro_engine -->|"reads settings"| node_provider_config
node_simple_engine -->|"reads settings"| node_provider_config
node_pro_engine -->|"fetches trees"| node_linddun_trees
node_pro_engine -->|"uses mappings"| node_mapping_utils

click node_app "https://github.com/stfbk/pillar/blob/master/main.py"
click node_sidebar "https://github.com/stfbk/pillar/blob/master/tabs/sidebar.py"
click node_application "https://github.com/stfbk/pillar/blob/master/tabs/application_info.py"
click node_dfd_ui "https://github.com/stfbk/pillar/blob/master/tabs/dfd.py"
click node_simple_ui "https://github.com/stfbk/pillar/blob/master/tabs/simple.py"
click node_go_ui "https://github.com/stfbk/pillar/blob/master/tabs/linddun_go.py"
click node_pro_ui "https://github.com/stfbk/pillar/blob/master/tabs/linddun_pro.py"
click node_risk_ui "https://github.com/stfbk/pillar/blob/master/tabs/risk_assessment.py"
click node_report_ui "https://github.com/stfbk/pillar/blob/master/tabs/report.py"
click node_dfd_engine "https://github.com/stfbk/pillar/blob/master/llms/dfd.py"
click node_simple_engine "https://github.com/stfbk/pillar/blob/master/llms/simple.py"
click node_go_engine "https://github.com/stfbk/pillar/blob/master/llms/linddun_go.py"
click node_pro_engine "https://github.com/stfbk/pillar/blob/master/llms/linddun_pro.py"
click node_prompt_library "https://github.com/stfbk/pillar/blob/master/llms/prompts.py"
click node_provider_config "https://github.com/stfbk/pillar/blob/master/llms/config.py"
click node_risk_engine "https://github.com/stfbk/pillar/blob/master/llms/risk_assessment.py"
click node_patterns "https://github.com/stfbk/pillar/blob/master/misc/privacypatterns.json"
click node_report_output "https://github.com/stfbk/pillar/blob/master/tabs/report.py"
click node_mapping_utils "https://github.com/stfbk/pillar/blob/master/misc/utils.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_sidebar,node_application,node_dfd_ui,node_simple_ui,node_go_ui,node_pro_ui,node_risk_ui,node_report_ui toneBlue
class node_dfd_engine,node_simple_engine,node_go_engine,node_pro_engine toneAmber
class node_risk_engine,node_patterns,node_report_output toneMint
class node_prompt_library,node_provider_config,node_mapping_utils toneRose
class node_developer,node_llm_services,node_linddun_trees toneIndigo
```

## Components

### User interface

- [Streamlit app](https://github.com/stfbk/pillar/blob/master/main.py): `main.py`
- [Model settings](https://github.com/stfbk/pillar/blob/master/tabs/sidebar.py): `tabs/sidebar.py`
- [Application description](https://github.com/stfbk/pillar/blob/master/tabs/application_info.py): `tabs/application_info.py`
- [DFD editor](https://github.com/stfbk/pillar/blob/master/tabs/dfd.py): `tabs/dfd.py`
- [SIMPLE tab](https://github.com/stfbk/pillar/blob/master/tabs/simple.py): `tabs/simple.py`
- [LINDDUN GO tab](https://github.com/stfbk/pillar/blob/master/tabs/linddun_go.py): `tabs/linddun_go.py`
- [LINDDUN PRO tab](https://github.com/stfbk/pillar/blob/master/tabs/linddun_pro.py): `tabs/linddun_pro.py`
- [Risk assessment tab](https://github.com/stfbk/pillar/blob/master/tabs/risk_assessment.py): `tabs/risk_assessment.py`
- [Report tab](https://github.com/stfbk/pillar/blob/master/tabs/report.py): `tabs/report.py`

### Threat analysis

- [DFD generation](https://github.com/stfbk/pillar/blob/master/llms/dfd.py): `llms/dfd.py`
- [SIMPLE analysis](https://github.com/stfbk/pillar/blob/master/llms/simple.py): `llms/simple.py`
- [LINDDUN GO simulation](https://github.com/stfbk/pillar/blob/master/llms/linddun_go.py): `llms/linddun_go.py`
- [LINDDUN PRO analysis](https://github.com/stfbk/pillar/blob/master/llms/linddun_pro.py): `llms/linddun_pro.py`

### Risk and reporting

- [Impact and controls](https://github.com/stfbk/pillar/blob/master/llms/risk_assessment.py): `llms/risk_assessment.py`
- [Privacy patterns](https://github.com/stfbk/pillar/blob/master/misc/privacypatterns.json): `misc/privacypatterns.json`
- [Downloadable report](https://github.com/stfbk/pillar/blob/master/tabs/report.py): `tabs/report.py`

### Models and prompts

- [Analysis prompts](https://github.com/stfbk/pillar/blob/master/llms/prompts.py): `llms/prompts.py`
- [Provider configuration](https://github.com/stfbk/pillar/blob/master/llms/config.py): `llms/config.py`
- [Threat mapping helpers](https://github.com/stfbk/pillar/blob/master/misc/utils.py): `misc/utils.py`

### Other components

- **Developer or analyst**
- **LLM providers**
- **LINDDUN threat trees**

## Connections

- Developer or analyst → Streamlit app: uses (evidence: `README.md`)
- Streamlit app → Model settings: renders (evidence: `main.py`)
- Streamlit app → Application description: renders (evidence: `main.py`)
- Streamlit app → DFD editor: renders (evidence: `main.py`)
- Streamlit app → SIMPLE tab: renders (evidence: `README.md`)
- Streamlit app → LINDDUN GO tab: renders (evidence: `README.md`)
- Streamlit app → LINDDUN PRO tab: renders (evidence: `README.md`)
- Streamlit app → Risk assessment tab: renders (evidence: `README.md`)
- Streamlit app → Report tab: renders (evidence: `README.md`)
- Developer or analyst → Application description: describes app (evidence: `README.md`)
- Developer or analyst → DFD editor: edits or imports (evidence: `README.md`)
- DFD editor → DFD generation: generates DFD (evidence: `tabs/dfd.py`)
- SIMPLE tab → SIMPLE analysis: requests analysis (evidence: `tabs/simple.py`)
- LINDDUN GO tab → LINDDUN GO simulation: runs simulation (evidence: `tabs/linddun_go.py`)
- LINDDUN PRO tab → LINDDUN PRO analysis: runs analysis (evidence: `tabs/linddun_pro.py`)
- Risk assessment tab → Impact and controls: requests assessment (evidence: `tabs/risk_assessment.py`)
- Impact and controls → Privacy patterns: suggests controls (evidence: `README.md`)
- Report tab → Downloadable report: generates (evidence: `tabs/report.py`)
- Risk assessment tab → SIMPLE analysis: uses threat results (evidence: `tabs/risk_assessment.py`)
- Risk assessment tab → LINDDUN GO simulation: uses threat results (evidence: `tabs/risk_assessment.py`)
- Report tab → Risk assessment tab: includes assessment (evidence: `tabs/report.py`)
- SIMPLE analysis → Analysis prompts: uses prompts (evidence: `llms/simple.py`)
- DFD generation → Analysis prompts: uses prompts (evidence: `llms/dfd.py`)
- LINDDUN GO simulation → Analysis prompts: uses prompts (evidence: `llms/linddun_go.py`)
- LINDDUN PRO analysis → Analysis prompts: uses prompts (evidence: `llms/linddun_pro.py`)
- Impact and controls → Analysis prompts: uses prompts (evidence: `llms/risk_assessment.py`)
- SIMPLE analysis → LLM providers: queries models
- LINDDUN GO simulation → LLM providers: queries agents (evidence: `llms/linddun_go.py`)
- LINDDUN PRO analysis → LLM providers: queries models
- Impact and controls → LLM providers: queries models
- Model settings → Provider configuration: reads settings (evidence: `tabs/sidebar.py`)
- LINDDUN GO simulation → Provider configuration: reads settings (evidence: `llms/linddun_go.py`)
- LINDDUN PRO analysis → Provider configuration: reads settings (evidence: `llms/linddun_pro.py`)
- SIMPLE analysis → Provider configuration: reads settings (evidence: `llms/simple.py`)
- LINDDUN PRO analysis → LINDDUN threat trees: fetches trees (evidence: `llms/linddun_pro.py`)
- LINDDUN PRO analysis → Threat mapping helpers: uses mappings (evidence: `llms/linddun_pro.py`)
