# sanketpatel32/blunt-code architecture

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

- Interactive diagram: https://gitdiagram.com/sanketpatel32/blunt-code
- Repository: https://github.com/sanketpatel32/blunt-code

## Overview

Blunt Code is a local-first code-quality and security scanner with a browser UI and headless CLI. The main workflow is to select a workspace, plan and run analyzers, persist findings, then inspect, compare, suppress, and export results or apply a CI gate. The graph preserves major documented capabilities, including pentest/DAST, tool management, scan history, and reports. Several backend links rely on README workflow documentation because their implementation files were not excerpted; those limits are reflected by omitting unverified call details.

Main entry points: [`internal/scans/service.go`](https://github.com/sanketpatel32/blunt-code/blob/main/internal/scans/service.go) (Scan execution), [`web/src/api.ts`](https://github.com/sanketpatel32/blunt-code/blob/main/web/src/api.ts) (Browser API client), [`internal/database/database.go`](https://github.com/sanketpatel32/blunt-code/blob/main/internal/database/database.go) (Local findings store), [`internal/api/server.go`](https://github.com/sanketpatel32/blunt-code/blob/main/internal/api/server.go) (Loopback API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User entry points"]
  node_cli["CLI commands"]
end

subgraph group_scan["Scan pipeline"]
  node_workspace["Workspace discovery"]
  node_planning["Scan planning<br/>[plan.go]"]
  node_scanservice["Scan execution<br/>[service.go]"]
  node_analyzers["Analyzer suite"]
  node_pentest["Pentest and DAST<br/>[dast.go]"]
  node_tools["Managed tools<br/>[manager.go]"]
end

subgraph group_results["Findings and outputs"]
  node_findings["Finding classification<br/>[classify.go]"]
  node_database[("Local findings store<br/>[database.go]")]
  node_history["Baselines and history<br/>[coverage.go]"]
  node_reports["Report exports<br/>[report.go]"]
  node_gate["Policy and CI gate<br/>[gate.go]"]
end

subgraph group_interface["Local interface"]
  node_webapp["Web application<br/>[App.tsx]"]
  node_api["Loopback API<br/>[server.go]"]
  node_webapi["Browser API client<br/>[api.ts]"]
  node_reportview["Finding report view<br/>[ReportView.tsx]"]
  node_search["Finding search<br/>[SearchPage.tsx]"]
  node_dashboard["Dashboard and workspaces<br/>[HomePage.tsx]"]
end

node_user(("Developer / operator"))
node_filesystem["Project files"]

node_user -->|"runs commands"| node_cli
node_user -->|"uses locally"| node_webapp
node_webapp -->|"requests data"| node_webapi
node_webapi -->|"calls API"| node_api
node_cli -->|"runs scans"| node_scanservice
node_api -.->|"starts scans"| node_scanservice
node_filesystem -->|"provides project"| node_workspace
node_scanservice -.->|"discovers inputs"| node_workspace
node_scanservice -.->|"plans execution"| node_planning
node_scanservice -->|"runs analyzers"| node_analyzers
node_scanservice -->|"runs pentest"| node_pentest
node_scanservice -.->|"uses managed tools"| node_tools
node_analyzers -->|"produce findings"| node_findings
node_pentest -->|"produces findings"| node_findings
node_findings -->|"persisted locally"| node_database
node_database -->|"supports comparison"| node_history
node_database -->|"feeds exports"| node_reports
node_database -->|"feeds CI gate"| node_gate
node_api -.->|"serves report data"| node_reportview
node_reportview -->|"loads and suppresses"| node_webapi
node_webapi -.->|"supplies findings"| node_search
node_webapi -.->|"supplies workspace data"| node_dashboard

click node_cli "https://github.com/sanketpatel32/blunt-code/tree/main/cmd/bluntcode"
click node_webapp "https://github.com/sanketpatel32/blunt-code/blob/main/web/src/App.tsx"
click node_api "https://github.com/sanketpatel32/blunt-code/blob/main/internal/api/server.go"
click node_workspace "https://github.com/sanketpatel32/blunt-code/tree/main/internal/discovery"
click node_planning "https://github.com/sanketpatel32/blunt-code/blob/main/internal/scans/plan.go"
click node_scanservice "https://github.com/sanketpatel32/blunt-code/blob/main/internal/scans/service.go"
click node_analyzers "https://github.com/sanketpatel32/blunt-code/tree/main/internal/analyzers"
click node_pentest "https://github.com/sanketpatel32/blunt-code/blob/main/internal/dast/dast.go"
click node_tools "https://github.com/sanketpatel32/blunt-code/blob/main/internal/tools/manager.go"
click node_findings "https://github.com/sanketpatel32/blunt-code/blob/main/internal/diffclassify/classify.go"
click node_database "https://github.com/sanketpatel32/blunt-code/blob/main/internal/database/database.go"
click node_history "https://github.com/sanketpatel32/blunt-code/blob/main/internal/scans/coverage.go"
click node_reports "https://github.com/sanketpatel32/blunt-code/blob/main/internal/reports/report.go"
click node_gate "https://github.com/sanketpatel32/blunt-code/blob/main/internal/scans/gate.go"
click node_webapi "https://github.com/sanketpatel32/blunt-code/blob/main/web/src/api.ts"
click node_reportview "https://github.com/sanketpatel32/blunt-code/blob/main/web/src/pages/report/ReportView.tsx"
click node_search "https://github.com/sanketpatel32/blunt-code/blob/main/web/src/pages/SearchPage.tsx"
click node_dashboard "https://github.com/sanketpatel32/blunt-code/blob/main/web/src/pages/HomePage.tsx"

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_cli toneBlue
class node_workspace,node_planning,node_scanservice,node_analyzers,node_pentest,node_tools toneAmber
class node_findings,node_database,node_history,node_reports,node_gate toneMint
class node_webapp,node_api,node_webapi,node_reportview,node_search,node_dashboard toneRose
class node_user,node_filesystem toneIndigo
```

## Components

### User entry points

- [CLI commands](https://github.com/sanketpatel32/blunt-code/tree/main/cmd/bluntcode): `cmd/bluntcode`

### Scan pipeline

- [Workspace discovery](https://github.com/sanketpatel32/blunt-code/tree/main/internal/discovery): `internal/discovery`
- [Scan planning](https://github.com/sanketpatel32/blunt-code/blob/main/internal/scans/plan.go): `internal/scans/plan.go`
- [Scan execution](https://github.com/sanketpatel32/blunt-code/blob/main/internal/scans/service.go): `internal/scans/service.go`
- [Analyzer suite](https://github.com/sanketpatel32/blunt-code/tree/main/internal/analyzers): `internal/analyzers`
- [Pentest and DAST](https://github.com/sanketpatel32/blunt-code/blob/main/internal/dast/dast.go): `internal/dast/dast.go`
- [Managed tools](https://github.com/sanketpatel32/blunt-code/blob/main/internal/tools/manager.go): `internal/tools/manager.go`

### Findings and outputs

- [Finding classification](https://github.com/sanketpatel32/blunt-code/blob/main/internal/diffclassify/classify.go): `internal/diffclassify/classify.go`
- [Local findings store](https://github.com/sanketpatel32/blunt-code/blob/main/internal/database/database.go): `internal/database/database.go`
- [Baselines and history](https://github.com/sanketpatel32/blunt-code/blob/main/internal/scans/coverage.go): `internal/scans/coverage.go`
- [Report exports](https://github.com/sanketpatel32/blunt-code/blob/main/internal/reports/report.go): `internal/reports/report.go`
- [Policy and CI gate](https://github.com/sanketpatel32/blunt-code/blob/main/internal/scans/gate.go): `internal/scans/gate.go`

### Local interface

- [Web application](https://github.com/sanketpatel32/blunt-code/blob/main/web/src/App.tsx): `web/src/App.tsx`
- [Loopback API](https://github.com/sanketpatel32/blunt-code/blob/main/internal/api/server.go): `internal/api/server.go`
- [Browser API client](https://github.com/sanketpatel32/blunt-code/blob/main/web/src/api.ts): `web/src/api.ts`
- [Finding report view](https://github.com/sanketpatel32/blunt-code/blob/main/web/src/pages/report/ReportView.tsx): `web/src/pages/report/ReportView.tsx`
- [Finding search](https://github.com/sanketpatel32/blunt-code/blob/main/web/src/pages/SearchPage.tsx): `web/src/pages/SearchPage.tsx`
- [Dashboard and workspaces](https://github.com/sanketpatel32/blunt-code/blob/main/web/src/pages/HomePage.tsx): `web/src/pages/HomePage.tsx`

### Other components

- **Developer / operator**
- **Project files**

## Connections

- Developer / operator → CLI commands: runs commands (evidence: `README.md`)
- Developer / operator → Web application: uses locally (evidence: `README.md`)
- Web application → Browser API client: requests data (evidence: `web/src/App.tsx`)
- Browser API client → Loopback API: calls API (evidence: `web/src/api.ts`)
- CLI commands → Scan execution: runs scans (evidence: `README.md`)
- Loopback API → Scan execution: starts scans
- Project files → Workspace discovery: provides project (evidence: `README.md`)
- Scan execution → Workspace discovery: discovers inputs
- Scan execution → Scan planning: plans execution
- Scan execution → Analyzer suite: runs analyzers (evidence: `README.md`)
- Scan execution → Pentest and DAST: runs pentest (evidence: `README.md`)
- Scan execution → Managed tools: uses managed tools
- Analyzer suite → Finding classification: produce findings (evidence: `README.md`)
- Pentest and DAST → Finding classification: produces findings (evidence: `README.md`)
- Finding classification → Local findings store: persisted locally (evidence: `README.md`)
- Local findings store → Baselines and history: supports comparison (evidence: `README.md`)
- Local findings store → Report exports: feeds exports (evidence: `README.md`)
- Local findings store → Policy and CI gate: feeds CI gate (evidence: `README.md`)
- Loopback API → Finding report view: serves report data
- Finding report view → Browser API client: loads and suppresses (evidence: `web/src/pages/report/ReportView.tsx`)
- Browser API client → Finding search: supplies findings
- Browser API client → Dashboard and workspaces: supplies workspace data
