# arvindiyu/manthan architecture

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

- Interactive diagram: https://gitdiagram.com/arvindiyu/manthan
- Repository: https://github.com/arvindiyu/manthan

## Overview

MANTHAN is a local-first application-security orchestration gateway: users submit repository, image, SBOM, or endpoint scans, then inspect normalized results and related security data through the UI, REST API, or MCP. Its core flow selects engines, dispatches configured scanner providers, and stores results; additional branches cover commit-centered quality gates and GitHub webhooks. The README documents capabilities beyond the sampled source, so those are represented at subsystem level where implementation details are unavailable; edges are limited to documented or excerpt-supported relationships.

Main entry points: [`gateway/main.js`](https://github.com/arvindiyu/manthan/blob/main/gateway/main.js) (Gateway API), [`gateway/services/scan.js`](https://github.com/arvindiyu/manthan/blob/main/gateway/services/scan.js) (Scan Orchestrator), [`gateway/config/loader.js`](https://github.com/arvindiyu/manthan/blob/main/gateway/config/loader.js) (Config Loader), [`gateway/services/commit.js`](https://github.com/arvindiyu/manthan/blob/main/gateway/services/commit.js) (Commit Scan Flow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_configuration["Configuration"]
  node_config_loader["Config Loader<br/>[loader.js]"]
  node_env_reader["Environment Reader<br/>[env.js]"]
  node_yaml_parser["YAML Parser<br/>[yaml.js]"]
end

subgraph group_scan["Scanning"]
  node_engine_selector["Engine Selector<br/>[engine-selector.js]"]
  node_scan_service["Scan Orchestrator<br/>[scan.js]"]
  node_provider_registry["Provider Registry<br/>[registry.js]"]
  node_scanner_adapters["Scanner Adapters<br/>[base-tool.js]"]
end

subgraph group_results["Results and State"]
  node_sarif_parser["SARIF Parser<br/>[sarif-parser.js]"]
  node_finding_services["Finding Processing"]
  node_finding_signature["Finding Signatures"]
  node_vulnerability_services["Vulnerability Triage"]
  node_artifacts["Artifact Services<br/>[artifacts.js]"]
  node_store["Store Adapter<br/>[index.js]"]
  node_repository[("SQLite Repository<br/>[repository.js]")]
end

subgraph group_interfaces["Interfaces"]
  node_gateway["Gateway API<br/>[main.js]"]
  node_ui["HTMX UI<br/>[dashboard.js]"]
  node_ui_layout["Page Layout<br/>[layout.js]"]
  node_mcp_tools["MCP Tools<br/>[index.js]"]
end

subgraph group_events["Events and Integrations"]
  node_commit_flow["Commit Scan Flow<br/>[commit.js]"]
  node_github_webhook["GitHub Webhook<br/>[webhook.js]"]
  node_github_clone["Repository Cloner<br/>[repo-cloner.js]"]
  node_quality_gates["Quality Gates<br/>[commit.js]"]
end

node_operator(("User or IDE"))
node_git_host(("GitHub"))
node_external_scanners["OSS Scanner CLIs"]

node_operator -->|"submits requests"| node_gateway
node_gateway -->|"loads config"| node_config_loader
node_config_loader -->|"reads settings"| node_env_reader
node_config_loader -->|"parses YAML"| node_yaml_parser
node_gateway -->|"creates store"| node_store
node_gateway -->|"selects engines"| node_engine_selector
node_engine_selector -->|"filters providers"| node_provider_registry
node_gateway -->|"starts scans"| node_scan_service
node_scan_service -->|"dispatches scans"| node_provider_registry
node_provider_registry -->|"registers providers"| node_scanner_adapters
node_scanner_adapters -->|"runs subprocesses"| node_external_scanners
node_scan_service -.->|"normalizes reports"| node_sarif_parser
node_scan_service -->|"persists results"| node_store
node_sarif_parser -->|"computes signatures"| node_finding_signature
node_store -->|"uses SQLite repository"| node_repository
node_gateway -->|"serves artifacts"| node_artifacts
node_gateway -->|"routes UI pages"| node_ui
node_ui -->|"renders through"| node_ui_layout
node_operator -->|"invokes tools"| node_mcp_tools
node_mcp_tools -->|"calls scan API"| node_gateway
node_git_host -->|"sends events"| node_github_webhook
node_github_webhook -->|"dispatches event"| node_commit_flow
node_commit_flow -->|"produces decisions"| node_quality_gates
node_commit_flow -->|"runs scanners"| node_scan_service
node_github_clone -.->|"provides workspace"| node_scan_service
node_gateway -.->|"serves triage views"| node_vulnerability_services
node_gateway -.->|"presents findings"| node_finding_services

click node_config_loader "https://github.com/arvindiyu/manthan/blob/main/gateway/config/loader.js"
click node_env_reader "https://github.com/arvindiyu/manthan/blob/main/gateway/config/env.js"
click node_yaml_parser "https://github.com/arvindiyu/manthan/blob/main/gateway/utils/yaml.js"
click node_gateway "https://github.com/arvindiyu/manthan/blob/main/gateway/main.js"
click node_engine_selector "https://github.com/arvindiyu/manthan/blob/main/gateway/services/engine-selector.js"
click node_scan_service "https://github.com/arvindiyu/manthan/blob/main/gateway/services/scan.js"
click node_provider_registry "https://github.com/arvindiyu/manthan/blob/main/gateway/integrations/registry.js"
click node_scanner_adapters "https://github.com/arvindiyu/manthan/blob/main/gateway/integrations/scanners/base-tool.js"
click node_sarif_parser "https://github.com/arvindiyu/manthan/blob/main/gateway/integrations/sarif-parser.js"
click node_finding_services "https://github.com/arvindiyu/manthan/blob/main/gateway/services/finding-presenter.js"
click node_finding_signature "https://github.com/arvindiyu/manthan/blob/main/gateway/services/finding-signature.js"
click node_vulnerability_services "https://github.com/arvindiyu/manthan/blob/main/gateway/services/vulnerability-aggregator.js"
click node_artifacts "https://github.com/arvindiyu/manthan/blob/main/gateway/services/artifacts.js"
click node_store "https://github.com/arvindiyu/manthan/blob/main/gateway/services/store/index.js"
click node_repository "https://github.com/arvindiyu/manthan/blob/main/gateway/db/repository.js"
click node_ui "https://github.com/arvindiyu/manthan/blob/main/gateway/ui/pages/dashboard.js"
click node_ui_layout "https://github.com/arvindiyu/manthan/blob/main/gateway/ui/layout.js"
click node_mcp_tools "https://github.com/arvindiyu/manthan/blob/main/mcp/tools/index.js"
click node_commit_flow "https://github.com/arvindiyu/manthan/blob/main/gateway/services/commit.js"
click node_github_webhook "https://github.com/arvindiyu/manthan/blob/main/gateway/services/github/webhook.js"
click node_github_clone "https://github.com/arvindiyu/manthan/blob/main/gateway/services/github/repo-cloner.js"
click node_quality_gates "https://github.com/arvindiyu/manthan/blob/main/gateway/services/commit.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_config_loader,node_env_reader,node_yaml_parser,node_operator toneBlue
class node_engine_selector,node_scan_service,node_provider_registry,node_scanner_adapters toneAmber
class node_sarif_parser,node_finding_services,node_finding_signature,node_vulnerability_services,node_artifacts,node_store,node_repository toneMint
class node_gateway,node_ui,node_ui_layout,node_mcp_tools toneRose
class node_commit_flow,node_github_webhook,node_github_clone,node_quality_gates,node_git_host,node_external_scanners toneIndigo
```

## Components

### Configuration

- [Config Loader](https://github.com/arvindiyu/manthan/blob/main/gateway/config/loader.js): `gateway/config/loader.js`
- [Environment Reader](https://github.com/arvindiyu/manthan/blob/main/gateway/config/env.js): `gateway/config/env.js`
- [YAML Parser](https://github.com/arvindiyu/manthan/blob/main/gateway/utils/yaml.js): `gateway/utils/yaml.js`

### Scanning

- [Engine Selector](https://github.com/arvindiyu/manthan/blob/main/gateway/services/engine-selector.js): `gateway/services/engine-selector.js`
- [Scan Orchestrator](https://github.com/arvindiyu/manthan/blob/main/gateway/services/scan.js): `gateway/services/scan.js`
- [Provider Registry](https://github.com/arvindiyu/manthan/blob/main/gateway/integrations/registry.js): `gateway/integrations/registry.js`
- [Scanner Adapters](https://github.com/arvindiyu/manthan/blob/main/gateway/integrations/scanners/base-tool.js): `gateway/integrations/scanners/base-tool.js`

### Results and State

- [SARIF Parser](https://github.com/arvindiyu/manthan/blob/main/gateway/integrations/sarif-parser.js): `gateway/integrations/sarif-parser.js`
- [Finding Processing](https://github.com/arvindiyu/manthan/blob/main/gateway/services/finding-presenter.js): `gateway/services/finding-presenter.js`
- [Finding Signatures](https://github.com/arvindiyu/manthan/blob/main/gateway/services/finding-signature.js): `gateway/services/finding-signature.js`
- [Vulnerability Triage](https://github.com/arvindiyu/manthan/blob/main/gateway/services/vulnerability-aggregator.js): `gateway/services/vulnerability-aggregator.js`
- [Artifact Services](https://github.com/arvindiyu/manthan/blob/main/gateway/services/artifacts.js): `gateway/services/artifacts.js`
- [Store Adapter](https://github.com/arvindiyu/manthan/blob/main/gateway/services/store/index.js): `gateway/services/store/index.js`
- [SQLite Repository](https://github.com/arvindiyu/manthan/blob/main/gateway/db/repository.js): `gateway/db/repository.js`

### Interfaces

- [Gateway API](https://github.com/arvindiyu/manthan/blob/main/gateway/main.js): `gateway/main.js`
- [HTMX UI](https://github.com/arvindiyu/manthan/blob/main/gateway/ui/pages/dashboard.js): `gateway/ui/pages/dashboard.js`
- [Page Layout](https://github.com/arvindiyu/manthan/blob/main/gateway/ui/layout.js): `gateway/ui/layout.js`
- [MCP Tools](https://github.com/arvindiyu/manthan/blob/main/mcp/tools/index.js): `mcp/tools/index.js`

### Events and Integrations

- [Commit Scan Flow](https://github.com/arvindiyu/manthan/blob/main/gateway/services/commit.js): `gateway/services/commit.js`
- [GitHub Webhook](https://github.com/arvindiyu/manthan/blob/main/gateway/services/github/webhook.js): `gateway/services/github/webhook.js`
- [Repository Cloner](https://github.com/arvindiyu/manthan/blob/main/gateway/services/github/repo-cloner.js): `gateway/services/github/repo-cloner.js`
- [Quality Gates](https://github.com/arvindiyu/manthan/blob/main/gateway/services/commit.js): `gateway/services/commit.js`

### Other components

- **User or IDE**
- **GitHub**
- **OSS Scanner CLIs**

## Connections

- User or IDE → Gateway API: submits requests (evidence: `README.md`)
- Gateway API → Config Loader: loads config (evidence: `gateway/main.js`)
- Config Loader → Environment Reader: reads settings (evidence: `gateway/config/loader.js`)
- Config Loader → YAML Parser: parses YAML (evidence: `gateway/config/loader.js`)
- Gateway API → Store Adapter: creates store (evidence: `gateway/main.js`)
- Gateway API → Engine Selector: selects engines (evidence: `gateway/main.js`)
- Engine Selector → Provider Registry: filters providers (evidence: `gateway/services/engine-selector.js`)
- Gateway API → Scan Orchestrator: starts scans (evidence: `gateway/main.js`)
- Scan Orchestrator → Provider Registry: dispatches scans (evidence: `README.md`)
- Provider Registry → Scanner Adapters: registers providers (evidence: `gateway/integrations/registry.js`)
- Scanner Adapters → OSS Scanner CLIs: runs subprocesses (evidence: `README.md`)
- Scan Orchestrator → SARIF Parser: normalizes reports
- Scan Orchestrator → Store Adapter: persists results (evidence: `README.md`)
- SARIF Parser → Finding Signatures: computes signatures (evidence: `gateway/integrations/sarif-parser.js`)
- Store Adapter → SQLite Repository: uses SQLite repository (evidence: `gateway/services/store/index.js`)
- Gateway API → Artifact Services: serves artifacts (evidence: `gateway/main.js`)
- Gateway API → HTMX UI: routes UI pages (evidence: `gateway/main.js`)
- HTMX UI → Page Layout: renders through (evidence: `gateway/ui/pages/dashboard.js`)
- User or IDE → MCP Tools: invokes tools (evidence: `README.md`)
- MCP Tools → Gateway API: calls scan API (evidence: `README.md`)
- GitHub → GitHub Webhook: sends events (evidence: `README.md`)
- GitHub Webhook → Commit Scan Flow: dispatches event (evidence: `gateway/services/github/webhook.js`)
- Commit Scan Flow → Quality Gates: produces decisions (evidence: `README.md`)
- Commit Scan Flow → Scan Orchestrator: runs scanners (evidence: `README.md`)
- Repository Cloner → Scan Orchestrator: provides workspace
- Gateway API → Vulnerability Triage: serves triage views (evidence: `gateway/main.js`)
- Gateway API → Finding Processing: presents findings (evidence: `gateway/main.js`)
