# f3rb123/beetle architecture

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

- Interactive diagram: https://gitdiagram.com/f3rb123/beetle
- Repository: https://github.com/f3rb123/beetle

## Overview

Beetle is an offline-first mobile application security platform. An authenticated analyst uploads an APK, IPA, or supported repository archive; the backend decompiles and analyzes it, then presents evidence-backed findings, attack paths, and source locations in an investigation workspace. Deterministic intelligence and reporting are core capabilities; AI interpretation is optional. The README documents several capabilities whose implementation was not sampled, so their links are shown as unverified where needed. Source excerpts and the index support only the cited relationships; unsampled implementation details are not assumed.

Main entry points: [`backend/main.py`](https://github.com/f3rb123/beetle/blob/main/backend/main.py) (API and scan orchestration), [`backend/analyzers/canonical_finding.py`](https://github.com/f3rb123/beetle/blob/main/backend/analyzers/canonical_finding.py) (Canonical findings), [`frontend/src/pages/Results.jsx`](https://github.com/f3rb123/beetle/blob/main/frontend/src/pages/Results.jsx) (Investigation workspace), [`backend/decompiler.py`](https://github.com/f3rb123/beetle/blob/main/backend/decompiler.py) (App decompilation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Analyst experience"]
  node_app["Web application<br/>[App.jsx]"]
  node_scan_ui["Scan workflow<br/>[ScanApp.jsx]"]
  node_results_ui["Investigation workspace<br/>[Results.jsx]"]
  node_sections["Finding views<br/>[SectionViews.jsx]"]
  node_source_ui["Source explorer<br/>[SourceExplorer.jsx]"]
end

subgraph group_scan["Scanning and analysis"]
  node_decompiler["App decompilation<br/>[decompiler.py]"]
  node_analyzers["Platform analyzers"]
  node_taint["Taint analysis<br/>[taint_analyzer.py]"]
  node_binary["Binary inspection"]
end

subgraph group_intelligence["Finding intelligence"]
  node_findings["Canonical findings"]
  node_ownership["Ownership classification<br/>[engine.py]"]
  node_evidence["Evidence selection<br/>[engine.py]"]
  node_fusion["Finding fusion<br/>[engine.py]"]
  node_chains["Attack chains<br/>[engine.py]"]
  node_ai["Optional AI assistance<br/>[ai_actions.py]"]
end

subgraph group_outputs["Reports and integrations"]
  node_pdf["PDF reports<br/>[pdf_generator.py]"]
  node_compliance["Compliance reports<br/>[compliance_pdf.py]"]
  node_sbom["CycloneDX SBOM<br/>[sbom_generator.py]"]
  node_sarif["SARIF export<br/>[sarif_exporter.py]"]
  node_webhooks["Webhooks<br/>[webhooks.py]"]
  node_policy["CI policy gating<br/>[policy.py]"]
end

subgraph group_platform["Platform services"]
  node_api["API and scan orchestration<br/>[main.py]"]
  node_scan_storage[("Scan and source storage<br/>[scan_storage.py]")]
  node_database[("Scan history database<br/>[database.py]")]
  node_auth["Authentication<br/>[auth.py]"]
end

node_analyst(("Security analyst"))

node_analyst -->|"uses"| node_app
node_app -->|"routes to"| node_scan_ui
node_app -->|"routes to"| node_results_ui
node_scan_ui -.->|"submits scan"| node_api
node_api -->|"invokes"| node_decompiler
node_decompiler -->|"uses"| node_scan_storage
node_decompiler -->|"uses"| node_binary
node_decompiler -->|"uses"| node_analyzers
node_analyzers -.->|"includes"| node_taint
node_analyzers -.->|"produces"| node_findings
node_findings -->|"classified by"| node_ownership
node_findings -->|"selected by"| node_evidence
node_findings -->|"fused by"| node_fusion
node_findings -->|"correlated by"| node_chains
node_api -->|"uses"| node_database
node_database -->|"normalizes"| node_findings
node_api -->|"uses"| node_auth
node_results_ui -->|"renders"| node_sections
node_results_ui -.->|"provides navigation"| node_source_ui
node_results_ui -.->|"loads results"| node_api
node_api -->|"offers optional assistance"| node_ai
node_api -->|"generates"| node_pdf
node_api -->|"generates"| node_compliance
node_api -->|"generates"| node_sbom
node_api -->|"exports"| node_sarif
node_api -->|"dispatches"| node_webhooks
node_api -->|"applies"| node_policy

click node_app "https://github.com/f3rb123/beetle/blob/main/frontend/src/App.jsx"
click node_scan_ui "https://github.com/f3rb123/beetle/blob/main/frontend/src/pages/ScanApp.jsx"
click node_results_ui "https://github.com/f3rb123/beetle/blob/main/frontend/src/pages/Results.jsx"
click node_sections "https://github.com/f3rb123/beetle/blob/main/frontend/src/components/workspace/SectionViews.jsx"
click node_source_ui "https://github.com/f3rb123/beetle/blob/main/frontend/src/components/workspace2/SourceExplorer.jsx"
click node_api "https://github.com/f3rb123/beetle/blob/main/backend/main.py"
click node_decompiler "https://github.com/f3rb123/beetle/blob/main/backend/decompiler.py"
click node_analyzers "https://github.com/f3rb123/beetle/tree/main/backend/analyzers"
click node_taint "https://github.com/f3rb123/beetle/blob/main/backend/analyzers/taint_analyzer.py"
click node_binary "https://github.com/f3rb123/beetle/blob/main/backend/analyzers/binary_inspector.py"
click node_scan_storage "https://github.com/f3rb123/beetle/blob/main/backend/analyzers/scan_storage.py"
click node_findings "https://github.com/f3rb123/beetle/blob/main/backend/analyzers/canonical_finding.py"
click node_ownership "https://github.com/f3rb123/beetle/blob/main/backend/analyzers/ownership/engine.py"
click node_evidence "https://github.com/f3rb123/beetle/blob/main/backend/analyzers/evidence_selection/engine.py"
click node_fusion "https://github.com/f3rb123/beetle/blob/main/backend/analyzers/fusion/engine.py"
click node_chains "https://github.com/f3rb123/beetle/blob/main/backend/analyzers/attack_chains/engine.py"
click node_database "https://github.com/f3rb123/beetle/blob/main/backend/database.py"
click node_auth "https://github.com/f3rb123/beetle/blob/main/backend/auth.py"
click node_ai "https://github.com/f3rb123/beetle/blob/main/backend/ai_actions.py"
click node_pdf "https://github.com/f3rb123/beetle/blob/main/backend/report/pdf_generator.py"
click node_compliance "https://github.com/f3rb123/beetle/blob/main/backend/report/compliance_pdf.py"
click node_sbom "https://github.com/f3rb123/beetle/blob/main/backend/report/sbom_generator.py"
click node_sarif "https://github.com/f3rb123/beetle/blob/main/backend/sarif_exporter.py"
click node_webhooks "https://github.com/f3rb123/beetle/blob/main/backend/webhooks.py"
click node_policy "https://github.com/f3rb123/beetle/blob/main/backend/policy.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_scan_ui,node_results_ui,node_sections,node_source_ui toneBlue
class node_decompiler,node_analyzers,node_taint,node_binary toneAmber
class node_findings,node_ownership,node_evidence,node_fusion,node_chains,node_ai toneMint
class node_pdf,node_compliance,node_sbom,node_sarif,node_webhooks,node_policy toneRose
class node_api,node_scan_storage,node_database,node_auth,node_analyst toneIndigo
```

## Components

### Analyst experience

- [Web application](https://github.com/f3rb123/beetle/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Scan workflow](https://github.com/f3rb123/beetle/blob/main/frontend/src/pages/ScanApp.jsx): `frontend/src/pages/ScanApp.jsx`
- [Investigation workspace](https://github.com/f3rb123/beetle/blob/main/frontend/src/pages/Results.jsx): `frontend/src/pages/Results.jsx`
- [Finding views](https://github.com/f3rb123/beetle/blob/main/frontend/src/components/workspace/SectionViews.jsx): `frontend/src/components/workspace/SectionViews.jsx`
- [Source explorer](https://github.com/f3rb123/beetle/blob/main/frontend/src/components/workspace2/SourceExplorer.jsx): `frontend/src/components/workspace2/SourceExplorer.jsx`

### Scanning and analysis

- [App decompilation](https://github.com/f3rb123/beetle/blob/main/backend/decompiler.py): `backend/decompiler.py`
- [Platform analyzers](https://github.com/f3rb123/beetle/tree/main/backend/analyzers): `backend/analyzers`
- [Taint analysis](https://github.com/f3rb123/beetle/blob/main/backend/analyzers/taint_analyzer.py): `backend/analyzers/taint_analyzer.py`
- [Binary inspection](https://github.com/f3rb123/beetle/blob/main/backend/analyzers/binary_inspector.py): `backend/analyzers/binary_inspector.py`

### Finding intelligence

- [Canonical findings](https://github.com/f3rb123/beetle/blob/main/backend/analyzers/canonical_finding.py): `backend/analyzers/canonical_finding.py`
- [Ownership classification](https://github.com/f3rb123/beetle/blob/main/backend/analyzers/ownership/engine.py): `backend/analyzers/ownership/engine.py`
- [Evidence selection](https://github.com/f3rb123/beetle/blob/main/backend/analyzers/evidence_selection/engine.py): `backend/analyzers/evidence_selection/engine.py`
- [Finding fusion](https://github.com/f3rb123/beetle/blob/main/backend/analyzers/fusion/engine.py): `backend/analyzers/fusion/engine.py`
- [Attack chains](https://github.com/f3rb123/beetle/blob/main/backend/analyzers/attack_chains/engine.py): `backend/analyzers/attack_chains/engine.py`
- [Optional AI assistance](https://github.com/f3rb123/beetle/blob/main/backend/ai_actions.py): `backend/ai_actions.py`

### Reports and integrations

- [PDF reports](https://github.com/f3rb123/beetle/blob/main/backend/report/pdf_generator.py): `backend/report/pdf_generator.py`
- [Compliance reports](https://github.com/f3rb123/beetle/blob/main/backend/report/compliance_pdf.py): `backend/report/compliance_pdf.py`
- [CycloneDX SBOM](https://github.com/f3rb123/beetle/blob/main/backend/report/sbom_generator.py): `backend/report/sbom_generator.py`
- [SARIF export](https://github.com/f3rb123/beetle/blob/main/backend/sarif_exporter.py): `backend/sarif_exporter.py`
- [Webhooks](https://github.com/f3rb123/beetle/blob/main/backend/webhooks.py): `backend/webhooks.py`
- [CI policy gating](https://github.com/f3rb123/beetle/blob/main/backend/policy.py): `backend/policy.py`

### Platform services

- [API and scan orchestration](https://github.com/f3rb123/beetle/blob/main/backend/main.py): `backend/main.py`
- [Scan and source storage](https://github.com/f3rb123/beetle/blob/main/backend/analyzers/scan_storage.py): `backend/analyzers/scan_storage.py`
- [Scan history database](https://github.com/f3rb123/beetle/blob/main/backend/database.py): `backend/database.py`
- [Authentication](https://github.com/f3rb123/beetle/blob/main/backend/auth.py): `backend/auth.py`

### Other components

- **Security analyst**

## Connections

- Security analyst → Web application: uses
- Web application → Scan workflow: routes to (evidence: `frontend/src/App.jsx`)
- Web application → Investigation workspace: routes to (evidence: `frontend/src/App.jsx`)
- Scan workflow → API and scan orchestration: submits scan
- API and scan orchestration → App decompilation: invokes (evidence: `backend/main.py`)
- App decompilation → Scan and source storage: uses (evidence: `backend/decompiler.py`)
- App decompilation → Binary inspection: uses (evidence: `backend/decompiler.py`)
- App decompilation → Platform analyzers: uses (evidence: `backend/decompiler.py`)
- Platform analyzers → Taint analysis: includes
- Platform analyzers → Canonical findings: produces (evidence: `backend/analyzers/ownership/engine.py`)
- Canonical findings → Ownership classification: classified by (evidence: `backend/analyzers/ownership/engine.py`)
- Canonical findings → Evidence selection: selected by (evidence: `backend/analyzers/evidence_selection/engine.py`)
- Canonical findings → Finding fusion: fused by (evidence: `backend/analyzers/fusion/engine.py`)
- Canonical findings → Attack chains: correlated by (evidence: `backend/analyzers/attack_chains/engine.py`)
- API and scan orchestration → Scan history database: uses (evidence: `backend/main.py`)
- Scan history database → Canonical findings: normalizes (evidence: `backend/database.py`)
- API and scan orchestration → Authentication: uses (evidence: `backend/main.py`)
- Investigation workspace → Finding views: renders (evidence: `frontend/src/pages/Results.jsx`)
- Investigation workspace → Source explorer: provides navigation
- Investigation workspace → API and scan orchestration: loads results
- API and scan orchestration → Optional AI assistance: offers optional assistance (evidence: `backend/main.py`)
- API and scan orchestration → PDF reports: generates (evidence: `backend/main.py`)
- API and scan orchestration → Compliance reports: generates (evidence: `backend/main.py`)
- API and scan orchestration → CycloneDX SBOM: generates (evidence: `backend/main.py`)
- API and scan orchestration → SARIF export: exports (evidence: `backend/main.py`)
- API and scan orchestration → Webhooks: dispatches (evidence: `backend/main.py`)
- API and scan orchestration → CI policy gating: applies (evidence: `backend/main.py`)
