# a3-n/xpfarm architecture

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

- Interactive diagram: https://gitdiagram.com/a3-n/xpfarm
- Repository: https://github.com/a3-n/xpfarm

## Overview

XPFarm is a web-based vulnerability scanner that coordinates discovery, network and web-asset analysis, and vulnerability lookup across wrapped security tools, with results managed through a database and web UI. Its separate Overlord capability supports AI-assisted binary and mobile analysis through specialized tools. The scan stages and major product branches follow the README architecture map; sampled source confirms selected Overlord tool-to-helper calls. Other source relationships were not inspected, so the graph omits unsupported internal call details.

Main entry points: [`internal/core/manager.go`](https://github.com/a3-n/xpfarm/blob/main/internal/core/manager.go) (Scan orchestration), [`overlord/tools/r2analyze.ts`](https://github.com/a3-n/xpfarm/blob/main/overlord/tools/r2analyze.ts) (Binary analysis tools), [`internal/ui/server.go`](https://github.com/a3-n/xpfarm/blob/main/internal/ui/server.go) (Web UI and API), [`overlord/tools/lib/tool_instrument.ts`](https://github.com/a3-n/xpfarm/blob/main/overlord/tools/lib/tool_instrument.ts) (Tool instrumentation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Web application"]
  node_ui["Web UI and API<br/>[server.go]"]
  node_entry["Application startup<br/>[main.go]"]
end

subgraph group_scan["Scan engine"]
  node_manager["Scan orchestration<br/>[manager.go]"]
  node_target["Target resolution<br/>[target.go]"]
  node_nuclei_plan["Nuclei scan planning<br/>[nuclei_tags.go]"]
  node_search["Global search<br/>[search.go]"]
  node_template_index["Template indexing"]
end

subgraph group_modules["Security modules"]
  node_registry["Module registry<br/>[registry.go]"]
  node_subfinder["Subdomain discovery<br/>[subfinder.go]"]
  node_network_scan["Port and service scans<br/>[naabu.go]"]
  node_http_probe["HTTP probing<br/>[httpx.go]"]
  node_web_analysis["Web asset analysis<br/>[gowitness.go]"]
  node_tech_detection["Technology detection<br/>[wappalyzer.go]"]
  node_vuln_scan["Vulnerability scanning<br/>[nuclei.go]"]
  node_cve_lookup["CVE lookup<br/>[cvemap.go]"]
end

subgraph group_data["Data and alerts"]
  node_database[("SQLite database<br/>[db.go]")]
  node_models["Scan data models<br/>[models.go]"]
  node_notifications["Scan notifications"]
end

subgraph group_overlord["Overlord analysis"]
  node_overlord_proxy["Overlord API proxy<br/>[overlord.go]"]
  node_binary_tools["Binary analysis tools<br/>[r2analyze.ts]"]
  node_triage["Binary triage<br/>[r2triage.ts]"]
  node_apk_analysis["APK analysis<br/>[apk_analyze.ts]"]
  node_runtime_hook["Frida runtime hooks<br/>[frida_hook.ts]"]
  node_yara["YARA scanning<br/>[yarascan.ts]"]
  node_r2_session["Radare2 sessions<br/>[r2session.ts]"]
  node_json_utils["JSON extraction<br/>[json_utils.ts]"]
  node_instrumentation["Tool instrumentation<br/>[tool_instrument.ts]"]
  node_logging["Overlord logging<br/>[logger.ts]"]
end

node_user(("Security user"))
node_opencode["OpenCode service"]
node_wrapped_tools["External security tools"]

node_user -->|"uses"| node_ui
node_ui -->|"starts scans"| node_manager
node_ui -->|"submits searches"| node_search
node_entry -->|"initializes"| node_database
node_entry -->|"registers modules"| node_registry
node_entry -->|"indexes templates"| node_template_index
node_entry -->|"starts server"| node_ui
node_manager -->|"resolves targets"| node_target
node_manager -->|"discovers subdomains"| node_subfinder
node_manager -->|"scans ports"| node_network_scan
node_manager -->|"probes HTTP"| node_http_probe
node_manager -->|"processes web assets"| node_web_analysis
node_manager -->|"detects technologies"| node_tech_detection
node_manager -->|"looks up CVEs"| node_cve_lookup
node_manager -->|"plans scans"| node_nuclei_plan
node_manager -->|"runs scans"| node_vuln_scan
node_registry -->|"wraps tools"| node_wrapped_tools
node_manager -.->|"stores scan data"| node_database
node_database -->|"persists"| node_models
node_ui -->|"routes requests"| node_overlord_proxy
node_overlord_proxy -->|"proxies API"| node_opencode
node_opencode -.->|"invokes tools"| node_binary_tools
node_opencode -.->|"invokes tools"| node_triage
node_opencode -.->|"invokes tools"| node_apk_analysis
node_opencode -.->|"invokes tools"| node_runtime_hook
node_opencode -.->|"invokes tools"| node_yara
node_binary_tools -->|"runs commands"| node_r2_session
node_binary_tools -->|"extracts JSON"| node_json_utils
node_binary_tools -->|"wraps execution"| node_instrumentation
node_binary_tools -->|"logs activity"| node_logging
node_triage -->|"runs commands"| node_r2_session
node_triage -->|"extracts JSON"| node_json_utils
node_r2_session -->|"logs sessions"| node_logging
node_instrumentation -->|"logs tool calls"| node_logging
node_apk_analysis -->|"wraps execution"| node_instrumentation
node_runtime_hook -->|"wraps execution"| node_instrumentation
node_yara -->|"wraps execution"| node_instrumentation

click node_ui "https://github.com/a3-n/xpfarm/blob/main/internal/ui/server.go"
click node_entry "https://github.com/a3-n/xpfarm/blob/main/main.go"
click node_manager "https://github.com/a3-n/xpfarm/blob/main/internal/core/manager.go"
click node_target "https://github.com/a3-n/xpfarm/blob/main/internal/core/target.go"
click node_nuclei_plan "https://github.com/a3-n/xpfarm/blob/main/internal/core/nuclei_tags.go"
click node_search "https://github.com/a3-n/xpfarm/blob/main/internal/core/search.go"
click node_template_index "https://github.com/a3-n/xpfarm/blob/main/internal/core/template_indexer.go"
click node_registry "https://github.com/a3-n/xpfarm/blob/main/internal/modules/registry.go"
click node_subfinder "https://github.com/a3-n/xpfarm/blob/main/internal/modules/subfinder.go"
click node_network_scan "https://github.com/a3-n/xpfarm/blob/main/internal/modules/naabu.go"
click node_http_probe "https://github.com/a3-n/xpfarm/blob/main/internal/modules/httpx.go"
click node_web_analysis "https://github.com/a3-n/xpfarm/blob/main/internal/modules/gowitness.go"
click node_tech_detection "https://github.com/a3-n/xpfarm/blob/main/internal/modules/wappalyzer.go"
click node_vuln_scan "https://github.com/a3-n/xpfarm/blob/main/internal/modules/nuclei.go"
click node_cve_lookup "https://github.com/a3-n/xpfarm/blob/main/internal/modules/cvemap.go"
click node_database "https://github.com/a3-n/xpfarm/blob/main/internal/database/db.go"
click node_models "https://github.com/a3-n/xpfarm/blob/main/internal/database/models.go"
click node_notifications "https://github.com/a3-n/xpfarm/tree/main/internal/notifications"
click node_overlord_proxy "https://github.com/a3-n/xpfarm/blob/main/internal/overlord/overlord.go"
click node_binary_tools "https://github.com/a3-n/xpfarm/blob/main/overlord/tools/r2analyze.ts"
click node_triage "https://github.com/a3-n/xpfarm/blob/main/overlord/tools/r2triage.ts"
click node_apk_analysis "https://github.com/a3-n/xpfarm/blob/main/overlord/tools/apk_analyze.ts"
click node_runtime_hook "https://github.com/a3-n/xpfarm/blob/main/overlord/tools/frida_hook.ts"
click node_yara "https://github.com/a3-n/xpfarm/blob/main/overlord/tools/yarascan.ts"
click node_r2_session "https://github.com/a3-n/xpfarm/blob/main/overlord/tools/lib/r2session.ts"
click node_json_utils "https://github.com/a3-n/xpfarm/blob/main/overlord/tools/lib/json_utils.ts"
click node_instrumentation "https://github.com/a3-n/xpfarm/blob/main/overlord/tools/lib/tool_instrument.ts"
click node_logging "https://github.com/a3-n/xpfarm/blob/main/overlord/tools/lib/logger.ts"

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_ui,node_entry,node_user toneBlue
class node_manager,node_target,node_nuclei_plan,node_search,node_template_index toneAmber
class node_registry,node_subfinder,node_network_scan,node_http_probe,node_web_analysis,node_tech_detection,node_vuln_scan,node_cve_lookup toneMint
class node_database,node_models,node_notifications toneRose
class node_overlord_proxy,node_binary_tools,node_triage,node_apk_analysis,node_runtime_hook,node_yara,node_r2_session,node_json_utils,node_instrumentation,node_logging,node_opencode,node_wrapped_tools toneIndigo
```

## Components

### Web application

- [Web UI and API](https://github.com/a3-n/xpfarm/blob/main/internal/ui/server.go): `internal/ui/server.go`
- [Application startup](https://github.com/a3-n/xpfarm/blob/main/main.go): `main.go`

### Scan engine

- [Scan orchestration](https://github.com/a3-n/xpfarm/blob/main/internal/core/manager.go): `internal/core/manager.go`
- [Target resolution](https://github.com/a3-n/xpfarm/blob/main/internal/core/target.go): `internal/core/target.go`
- [Nuclei scan planning](https://github.com/a3-n/xpfarm/blob/main/internal/core/nuclei_tags.go): `internal/core/nuclei_tags.go`
- [Global search](https://github.com/a3-n/xpfarm/blob/main/internal/core/search.go): `internal/core/search.go`
- [Template indexing](https://github.com/a3-n/xpfarm/blob/main/internal/core/template_indexer.go): `internal/core/template_indexer.go`

### Security modules

- [Module registry](https://github.com/a3-n/xpfarm/blob/main/internal/modules/registry.go): `internal/modules/registry.go`
- [Subdomain discovery](https://github.com/a3-n/xpfarm/blob/main/internal/modules/subfinder.go): `internal/modules/subfinder.go`
- [Port and service scans](https://github.com/a3-n/xpfarm/blob/main/internal/modules/naabu.go): `internal/modules/naabu.go`
- [HTTP probing](https://github.com/a3-n/xpfarm/blob/main/internal/modules/httpx.go): `internal/modules/httpx.go`
- [Web asset analysis](https://github.com/a3-n/xpfarm/blob/main/internal/modules/gowitness.go): `internal/modules/gowitness.go`
- [Technology detection](https://github.com/a3-n/xpfarm/blob/main/internal/modules/wappalyzer.go): `internal/modules/wappalyzer.go`
- [Vulnerability scanning](https://github.com/a3-n/xpfarm/blob/main/internal/modules/nuclei.go): `internal/modules/nuclei.go`
- [CVE lookup](https://github.com/a3-n/xpfarm/blob/main/internal/modules/cvemap.go): `internal/modules/cvemap.go`

### Data and alerts

- [SQLite database](https://github.com/a3-n/xpfarm/blob/main/internal/database/db.go): `internal/database/db.go`
- [Scan data models](https://github.com/a3-n/xpfarm/blob/main/internal/database/models.go): `internal/database/models.go`
- [Scan notifications](https://github.com/a3-n/xpfarm/tree/main/internal/notifications): `internal/notifications`

### Overlord analysis

- [Overlord API proxy](https://github.com/a3-n/xpfarm/blob/main/internal/overlord/overlord.go): `internal/overlord/overlord.go`
- [Binary analysis tools](https://github.com/a3-n/xpfarm/blob/main/overlord/tools/r2analyze.ts): `overlord/tools/r2analyze.ts`
- [Binary triage](https://github.com/a3-n/xpfarm/blob/main/overlord/tools/r2triage.ts): `overlord/tools/r2triage.ts`
- [APK analysis](https://github.com/a3-n/xpfarm/blob/main/overlord/tools/apk_analyze.ts): `overlord/tools/apk_analyze.ts`
- [Frida runtime hooks](https://github.com/a3-n/xpfarm/blob/main/overlord/tools/frida_hook.ts): `overlord/tools/frida_hook.ts`
- [YARA scanning](https://github.com/a3-n/xpfarm/blob/main/overlord/tools/yarascan.ts): `overlord/tools/yarascan.ts`
- [Radare2 sessions](https://github.com/a3-n/xpfarm/blob/main/overlord/tools/lib/r2session.ts): `overlord/tools/lib/r2session.ts`
- [JSON extraction](https://github.com/a3-n/xpfarm/blob/main/overlord/tools/lib/json_utils.ts): `overlord/tools/lib/json_utils.ts`
- [Tool instrumentation](https://github.com/a3-n/xpfarm/blob/main/overlord/tools/lib/tool_instrument.ts): `overlord/tools/lib/tool_instrument.ts`
- [Overlord logging](https://github.com/a3-n/xpfarm/blob/main/overlord/tools/lib/logger.ts): `overlord/tools/lib/logger.ts`

### Other components

- **Security user**
- **OpenCode service**
- **External security tools**

## Connections

- Security user → Web UI and API: uses
- Web UI and API → Scan orchestration: starts scans
- Web UI and API → Global search: submits searches
- Application startup → SQLite database: initializes
- Application startup → Module registry: registers modules
- Application startup → Template indexing: indexes templates
- Application startup → Web UI and API: starts server
- Scan orchestration → Target resolution: resolves targets
- Scan orchestration → Subdomain discovery: discovers subdomains
- Scan orchestration → Port and service scans: scans ports
- Scan orchestration → HTTP probing: probes HTTP
- Scan orchestration → Web asset analysis: processes web assets
- Scan orchestration → Technology detection: detects technologies
- Scan orchestration → CVE lookup: looks up CVEs
- Scan orchestration → Nuclei scan planning: plans scans
- Scan orchestration → Vulnerability scanning: runs scans
- Module registry → External security tools: wraps tools
- Scan orchestration → SQLite database: stores scan data
- SQLite database → Scan data models: persists
- Web UI and API → Overlord API proxy: routes requests
- Overlord API proxy → OpenCode service: proxies API
- OpenCode service → Binary analysis tools: invokes tools
- OpenCode service → Binary triage: invokes tools
- OpenCode service → APK analysis: invokes tools
- OpenCode service → Frida runtime hooks: invokes tools
- OpenCode service → YARA scanning: invokes tools
- Binary analysis tools → Radare2 sessions: runs commands (evidence: `overlord/tools/r2analyze.ts`)
- Binary analysis tools → JSON extraction: extracts JSON (evidence: `overlord/tools/r2analyze.ts`)
- Binary analysis tools → Tool instrumentation: wraps execution (evidence: `overlord/tools/r2analyze.ts`)
- Binary analysis tools → Overlord logging: logs activity (evidence: `overlord/tools/r2analyze.ts`)
- Binary triage → Radare2 sessions: runs commands (evidence: `overlord/tools/r2triage.ts`)
- Binary triage → JSON extraction: extracts JSON (evidence: `overlord/tools/r2triage.ts`)
- Radare2 sessions → Overlord logging: logs sessions (evidence: `overlord/tools/lib/r2session.ts`)
- Tool instrumentation → Overlord logging: logs tool calls (evidence: `overlord/tools/lib/tool_instrument.ts`)
- APK analysis → Tool instrumentation: wraps execution (evidence: `overlord/tools/apk_analyze.ts`)
- Frida runtime hooks → Tool instrumentation: wraps execution (evidence: `overlord/tools/frida_hook.ts`)
- YARA scanning → Tool instrumentation: wraps execution (evidence: `overlord/tools/yarascan.ts`)
