# lintsinghua/deepaudit architecture

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

- Interactive diagram: https://gitdiagram.com/lintsinghua/deepaudit
- Repository: https://github.com/lintsinghua/deepaudit

## Overview

DeepAudit is a web-based AI security-auditing product. The documented user journey is to manage or import a project, launch an Agent audit, follow its live execution, inspect findings, and export a report; the product also supports instant code analysis, rules, prompts, and project dashboards. The graph combines those documented capabilities with source-index relationships and excerpts. Several central implementations were not sampled, so uncertain runtime links are omitted or marked unverified.

Main entry points: [`backend/app/api/v1/endpoints/agent_tasks.py`](https://github.com/lintsinghua/deepaudit/blob/v3.0.0/backend/app/api/v1/endpoints/agent_tasks.py) (Agent task API), [`frontend/src/app/routes.tsx`](https://github.com/lintsinghua/deepaudit/blob/v3.0.0/frontend/src/app/routes.tsx) (Product routes), [`frontend/src/pages/AgentAudit/index.tsx`](https://github.com/lintsinghua/deepaudit/blob/v3.0.0/frontend/src/pages/AgentAudit/index.tsx) (Agent audit UI), [`backend/app/services/agent/agents/orchestrator.py`](https://github.com/lintsinghua/deepaudit/blob/v3.0.0/backend/app/services/agent/agents/orchestrator.py) (Agent orchestration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_routes["Product routes<br/>[routes.tsx]"]
  node_agent_ui["Agent audit UI<br/>[index.tsx]"]
  node_stream_hook["Stream hook<br/>[useAgentStream.ts]"]
  node_projects_ui["Project management<br/>[Projects.tsx]"]
  node_instant_ui["Instant analysis"]
  node_report_ui["Report export<br/>[reportExport.ts]"]
end

subgraph group_api["API and projects"]
  node_api_router["API router<br/>[api.py]"]
  node_agent_api["Agent task API<br/>[agent_tasks.py]"]
  node_project_api["Project API<br/>[projects.py]"]
  node_scanner["Repository scanner<br/>[scanner.py]"]
  node_task_model["Audit task records<br/>[agent_task.py]"]
end

subgraph group_audit["Audit engine"]
  node_agent_orchestrator["Agent orchestration<br/>[orchestrator.py]"]
  node_agent_base["Agent runtime<br/>[base.py]"]
  node_agent_events["Audit events<br/>[event_manager.py]"]
  node_streaming["Event streaming<br/>[stream_handler.py]"]
end

subgraph group_intelligence["Analysis intelligence"]
  node_llm_service["LLM service<br/>[service.py]"]
  node_llm_factory["Provider factory<br/>[factory.py]"]
  node_llm_adapter["LiteLLM adapter<br/>[litellm_adapter.py]"]
  node_knowledge["Framework knowledge<br/>[fastapi.py]"]
  node_rag["RAG retrieval<br/>[retriever.py]"]
end

subgraph group_platform["Platform services"]
  node_database[("Application database<br/>[session.py]")]
  node_configuration["Runtime configuration<br/>[config.py]"]
  node_zip_storage[("Project ZIP storage<br/>[zip_storage.py]")]
end

node_user(("Auditor"))

node_user -->|"uses"| node_routes
node_routes -->|"routes to"| node_agent_ui
node_routes -->|"routes to"| node_projects_ui
node_routes -->|"routes to"| node_instant_ui
node_agent_ui -.->|"uses stream"| node_stream_hook
node_agent_ui -.->|"starts audit"| node_agent_api
node_projects_ui -.->|"manages projects"| node_project_api
node_instant_ui -.->|"submits analysis"| node_scanner
node_report_ui -.->|"exports report"| node_agent_ui
node_api_router -->|"registers"| node_agent_api
node_api_router -->|"registers"| node_project_api
node_agent_api -->|"reads and writes"| node_task_model
node_agent_api -.->|"launches audit"| node_agent_orchestrator
node_agent_orchestrator -->|"uses runtime"| node_agent_base
node_agent_orchestrator -.->|"requests analysis"| node_llm_service
node_agent_api -->|"streams task events"| node_agent_events
node_agent_events -->|"persists events"| node_task_model
node_stream_hook -.->|"receives events"| node_streaming
node_llm_service -->|"creates adapter"| node_llm_factory
node_llm_factory -.->|"selects provider"| node_llm_adapter
node_agent_base -.->|"uses guidance"| node_knowledge
node_agent_base -.->|"retrieves context"| node_rag
node_configuration -->|"configures connection"| node_database
node_configuration -->|"sets storage path"| node_zip_storage

click node_routes "https://github.com/lintsinghua/deepaudit/blob/v3.0.0/frontend/src/app/routes.tsx"
click node_agent_ui "https://github.com/lintsinghua/deepaudit/blob/v3.0.0/frontend/src/pages/AgentAudit/index.tsx"
click node_stream_hook "https://github.com/lintsinghua/deepaudit/blob/v3.0.0/frontend/src/hooks/useAgentStream.ts"
click node_projects_ui "https://github.com/lintsinghua/deepaudit/blob/v3.0.0/frontend/src/pages/Projects.tsx"
click node_instant_ui "https://github.com/lintsinghua/deepaudit/blob/v3.0.0/frontend/src/pages/InstantAnalysis.tsx"
click node_report_ui "https://github.com/lintsinghua/deepaudit/blob/v3.0.0/frontend/src/features/reports/services/reportExport.ts"
click node_api_router "https://github.com/lintsinghua/deepaudit/blob/v3.0.0/backend/app/api/v1/api.py"
click node_agent_api "https://github.com/lintsinghua/deepaudit/blob/v3.0.0/backend/app/api/v1/endpoints/agent_tasks.py"
click node_project_api "https://github.com/lintsinghua/deepaudit/blob/v3.0.0/backend/app/api/v1/endpoints/projects.py"
click node_scanner "https://github.com/lintsinghua/deepaudit/blob/v3.0.0/backend/app/services/scanner.py"
click node_task_model "https://github.com/lintsinghua/deepaudit/blob/v3.0.0/backend/app/models/agent_task.py"
click node_agent_orchestrator "https://github.com/lintsinghua/deepaudit/blob/v3.0.0/backend/app/services/agent/agents/orchestrator.py"
click node_agent_base "https://github.com/lintsinghua/deepaudit/blob/v3.0.0/backend/app/services/agent/agents/base.py"
click node_agent_events "https://github.com/lintsinghua/deepaudit/blob/v3.0.0/backend/app/services/agent/event_manager.py"
click node_streaming "https://github.com/lintsinghua/deepaudit/blob/v3.0.0/backend/app/services/agent/streaming/stream_handler.py"
click node_llm_service "https://github.com/lintsinghua/deepaudit/blob/v3.0.0/backend/app/services/llm/service.py"
click node_llm_factory "https://github.com/lintsinghua/deepaudit/blob/v3.0.0/backend/app/services/llm/factory.py"
click node_llm_adapter "https://github.com/lintsinghua/deepaudit/blob/v3.0.0/backend/app/services/llm/adapters/litellm_adapter.py"
click node_knowledge "https://github.com/lintsinghua/deepaudit/blob/v3.0.0/backend/app/services/agent/knowledge/frameworks/fastapi.py"
click node_rag "https://github.com/lintsinghua/deepaudit/blob/v3.0.0/backend/app/services/rag/retriever.py"
click node_database "https://github.com/lintsinghua/deepaudit/blob/v3.0.0/backend/app/db/session.py"
click node_configuration "https://github.com/lintsinghua/deepaudit/blob/v3.0.0/backend/app/core/config.py"
click node_zip_storage "https://github.com/lintsinghua/deepaudit/blob/v3.0.0/backend/app/services/zip_storage.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_routes,node_agent_ui,node_stream_hook,node_projects_ui,node_instant_ui,node_report_ui toneBlue
class node_api_router,node_agent_api,node_project_api,node_scanner,node_task_model toneAmber
class node_agent_orchestrator,node_agent_base,node_agent_events,node_streaming toneMint
class node_llm_service,node_llm_factory,node_llm_adapter,node_knowledge,node_rag toneRose
class node_database,node_configuration,node_zip_storage,node_user toneIndigo
```

## Components

### Web application

- [Product routes](https://github.com/lintsinghua/deepaudit/blob/v3.0.0/frontend/src/app/routes.tsx): `frontend/src/app/routes.tsx`
- [Agent audit UI](https://github.com/lintsinghua/deepaudit/blob/v3.0.0/frontend/src/pages/AgentAudit/index.tsx): `frontend/src/pages/AgentAudit/index.tsx`
- [Stream hook](https://github.com/lintsinghua/deepaudit/blob/v3.0.0/frontend/src/hooks/useAgentStream.ts): `frontend/src/hooks/useAgentStream.ts`
- [Project management](https://github.com/lintsinghua/deepaudit/blob/v3.0.0/frontend/src/pages/Projects.tsx): `frontend/src/pages/Projects.tsx`
- [Instant analysis](https://github.com/lintsinghua/deepaudit/blob/v3.0.0/frontend/src/pages/InstantAnalysis.tsx): `frontend/src/pages/InstantAnalysis.tsx`
- [Report export](https://github.com/lintsinghua/deepaudit/blob/v3.0.0/frontend/src/features/reports/services/reportExport.ts): `frontend/src/features/reports/services/reportExport.ts`

### API and projects

- [API router](https://github.com/lintsinghua/deepaudit/blob/v3.0.0/backend/app/api/v1/api.py): `backend/app/api/v1/api.py`
- [Agent task API](https://github.com/lintsinghua/deepaudit/blob/v3.0.0/backend/app/api/v1/endpoints/agent_tasks.py): `backend/app/api/v1/endpoints/agent_tasks.py`
- [Project API](https://github.com/lintsinghua/deepaudit/blob/v3.0.0/backend/app/api/v1/endpoints/projects.py): `backend/app/api/v1/endpoints/projects.py`
- [Repository scanner](https://github.com/lintsinghua/deepaudit/blob/v3.0.0/backend/app/services/scanner.py): `backend/app/services/scanner.py`
- [Audit task records](https://github.com/lintsinghua/deepaudit/blob/v3.0.0/backend/app/models/agent_task.py): `backend/app/models/agent_task.py`

### Audit engine

- [Agent orchestration](https://github.com/lintsinghua/deepaudit/blob/v3.0.0/backend/app/services/agent/agents/orchestrator.py): `backend/app/services/agent/agents/orchestrator.py`
- [Agent runtime](https://github.com/lintsinghua/deepaudit/blob/v3.0.0/backend/app/services/agent/agents/base.py): `backend/app/services/agent/agents/base.py`
- [Audit events](https://github.com/lintsinghua/deepaudit/blob/v3.0.0/backend/app/services/agent/event_manager.py): `backend/app/services/agent/event_manager.py`
- [Event streaming](https://github.com/lintsinghua/deepaudit/blob/v3.0.0/backend/app/services/agent/streaming/stream_handler.py): `backend/app/services/agent/streaming/stream_handler.py`

### Analysis intelligence

- [LLM service](https://github.com/lintsinghua/deepaudit/blob/v3.0.0/backend/app/services/llm/service.py): `backend/app/services/llm/service.py`
- [Provider factory](https://github.com/lintsinghua/deepaudit/blob/v3.0.0/backend/app/services/llm/factory.py): `backend/app/services/llm/factory.py`
- [LiteLLM adapter](https://github.com/lintsinghua/deepaudit/blob/v3.0.0/backend/app/services/llm/adapters/litellm_adapter.py): `backend/app/services/llm/adapters/litellm_adapter.py`
- [Framework knowledge](https://github.com/lintsinghua/deepaudit/blob/v3.0.0/backend/app/services/agent/knowledge/frameworks/fastapi.py): `backend/app/services/agent/knowledge/frameworks/fastapi.py`
- [RAG retrieval](https://github.com/lintsinghua/deepaudit/blob/v3.0.0/backend/app/services/rag/retriever.py): `backend/app/services/rag/retriever.py`

### Platform services

- [Application database](https://github.com/lintsinghua/deepaudit/blob/v3.0.0/backend/app/db/session.py): `backend/app/db/session.py`
- [Runtime configuration](https://github.com/lintsinghua/deepaudit/blob/v3.0.0/backend/app/core/config.py): `backend/app/core/config.py`
- [Project ZIP storage](https://github.com/lintsinghua/deepaudit/blob/v3.0.0/backend/app/services/zip_storage.py): `backend/app/services/zip_storage.py`

### Other components

- **Auditor**

## Connections

- Auditor → Product routes: uses (evidence: `README.md`)
- Product routes → Agent audit UI: routes to (evidence: `frontend/src/app/routes.tsx`)
- Product routes → Project management: routes to (evidence: `frontend/src/app/routes.tsx`)
- Product routes → Instant analysis: routes to (evidence: `frontend/src/app/routes.tsx`)
- Agent audit UI → Stream hook: uses stream
- Agent audit UI → Agent task API: starts audit
- Project management → Project API: manages projects
- Instant analysis → Repository scanner: submits analysis
- Report export → Agent audit UI: exports report
- API router → Agent task API: registers (evidence: `backend/app/api/v1/api.py`)
- API router → Project API: registers (evidence: `backend/app/api/v1/api.py`)
- Agent task API → Audit task records: reads and writes (evidence: `backend/app/api/v1/endpoints/agent_tasks.py`)
- Agent task API → Agent orchestration: launches audit
- Agent orchestration → Agent runtime: uses runtime (evidence: `backend/app/services/agent/agents/orchestrator.py`)
- Agent orchestration → LLM service: requests analysis
- Agent task API → Audit events: streams task events (evidence: `backend/app/api/v1/endpoints/agent_tasks.py`)
- Audit events → Audit task records: persists events (evidence: `backend/app/services/agent/event_manager.py`)
- Stream hook → Event streaming: receives events
- LLM service → Provider factory: creates adapter (evidence: `backend/app/services/llm/service.py`)
- Provider factory → LiteLLM adapter: selects provider
- Agent runtime → Framework knowledge: uses guidance
- Agent runtime → RAG retrieval: retrieves context
- Runtime configuration → Application database: configures connection (evidence: `backend/app/db/session.py`)
- Runtime configuration → Project ZIP storage: sets storage path (evidence: `backend/app/services/zip_storage.py`)
