# sindhu2818/fortivo architecture

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

- Interactive diagram: https://gitdiagram.com/sindhu2818/fortivo
- Repository: https://github.com/sindhu2818/fortivo

## Overview

The repository centers on a security-scanning service: it prepares a target repository, runs security scanners, analyzes findings into risk and attack paths, optionally enriches results with LLMs, and persists scan results. A frontend presents scan data, while demo-app is a separate invoicing application that can serve as a scan target. The README is empty, and several important modules were indexed but not excerpted; the graph therefore omits uncertain runtime links rather than assuming them.

Main entry points: [`backend/core/pipeline.py`](https://github.com/sindhu2818/fortivo/blob/main/backend/core/pipeline.py) (Scan pipeline), [`backend/core/risk_agent.py`](https://github.com/sindhu2818/fortivo/blob/main/backend/core/risk_agent.py) (Risk analysis agent), [`demo-app/routes/users.py`](https://github.com/sindhu2818/fortivo/blob/main/demo-app/routes/users.py) (User routes), [`demo-app/services/user_service.py`](https://github.com/sindhu2818/fortivo/blob/main/demo-app/services/user_service.py) (User operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_scan["Scan runtime"]
  node_clone["Repository preparation<br/>[clone.py]"]
  node_scanner["Scanner agent<br/>[scanner_agent.py]"]
  node_semgrep["Semgrep scanner<br/>[semgrep.py]"]
  node_trivy["Trivy scanner<br/>[trivy.py]"]
  node_pipeline["Scan pipeline<br/>[pipeline.py]"]
  node_models["Scan data contract<br/>[models.py]"]
  node_storage[("Result storage<br/>[storage.py]")]
  node_api["Backend API<br/>[main.py]"]
end

subgraph group_analysis["Risk analysis"]
  node_normalizer["Finding normalization<br/>[normalize.py]"]
  node_riskagent["Risk analysis agent<br/>[risk_agent.py]"]
  node_reducer["Finding reduction<br/>[reduce.py]"]
  node_scorer["Risk scoring<br/>[score.py]"]
  node_attackpaths["Attack paths<br/>[attack_paths.py]"]
  node_llm["LLM coordinator<br/>[llm.py]"]
  node_gemini["Gemini enrichment<br/>[gemini.py]"]
  node_grok["Grok enrichment<br/>[grok.py]"]
end

subgraph group_frontend["Scan interface"]
  node_web["Web interface<br/>[page.tsx]"]
  node_dashboard["Scan dashboard<br/>[page.tsx]"]
  node_session["Scan sessions<br/>[session.ts]"]
  node_dataset["Demo scan data<br/>[dataset.ts]"]
end

subgraph group_demo["Demo application"]
  node_demoapp["Invoicing service<br/>[app.py]"]
  node_user_routes["User routes<br/>[users.py]"]
  node_user_service["User operations<br/>[user_service.py]"]
  node_user_model["User model<br/>[user.py]"]
  node_db[("SQLite access<br/>[db.py]")]
  node_orders["Order operations<br/>[order_service.py]"]
  node_dates["Date utilities<br/>[dates.py]"]
  node_pagination["Pagination<br/>[pagination.py]"]
  node_serializers["Response serializers<br/>[serializers.py]"]
  node_audit["Audit logging<br/>[audit_log.py]"]
  node_config["Application config<br/>[config.py]"]
end

node_repo(("Target repository"))

node_repo -.->|"scan target"| node_clone
node_pipeline -->|"runs scanners"| node_scanner
node_pipeline -->|"analyzes findings"| node_riskagent
node_pipeline -->|"enriches results"| node_llm
node_pipeline -->|"saves results"| node_storage
node_pipeline -->|"derives repo name"| node_clone
node_scanner -->|"prepares checkout"| node_clone
node_scanner -->|"runs scan"| node_semgrep
node_scanner -->|"runs scan"| node_trivy
node_riskagent -->|"normalizes findings"| node_normalizer
node_riskagent -->|"reduces findings"| node_reducer
node_riskagent -->|"calculates risk"| node_scorer
node_riskagent -->|"builds paths"| node_attackpaths
node_llm -->|"enriches findings"| node_gemini
node_llm -->|"advises on risk"| node_grok
node_api -->|"imports pipeline"| node_pipeline
node_api -->|"imports storage"| node_storage
node_api -->|"uses contract"| node_models
node_web -.->|"opens scan view"| node_dashboard
node_dashboard -.->|"uses sessions"| node_session
node_session -->|"loads demo data"| node_dataset
node_demoapp -->|"registers routes"| node_user_routes
node_user_routes -->|"calls user operations"| node_user_service
node_user_routes -->|"serializes responses"| node_serializers
node_user_routes -->|"records events"| node_audit
node_user_routes -->|"queries directly"| node_db
node_user_service -->|"reads and writes"| node_db
node_user_service -->|"uses user model"| node_user_model
node_user_service -->|"formats timestamps"| node_dates
node_user_service -->|"paginates results"| node_pagination
node_orders -->|"reads and writes"| node_db
node_orders -->|"sets order dates"| node_dates
node_orders -->|"paginates orders"| node_pagination
node_db -->|"reads database settings"| node_config
node_audit -->|"formats event times"| node_dates
node_serializers -->|"formats date fields"| node_dates

click node_clone "https://github.com/sindhu2818/fortivo/blob/main/backend/scanners/clone.py"
click node_scanner "https://github.com/sindhu2818/fortivo/blob/main/backend/scanners/scanner_agent.py"
click node_semgrep "https://github.com/sindhu2818/fortivo/blob/main/backend/scanners/semgrep.py"
click node_trivy "https://github.com/sindhu2818/fortivo/blob/main/backend/scanners/trivy.py"
click node_pipeline "https://github.com/sindhu2818/fortivo/blob/main/backend/core/pipeline.py"
click node_models "https://github.com/sindhu2818/fortivo/blob/main/backend/models.py"
click node_storage "https://github.com/sindhu2818/fortivo/blob/main/backend/storage.py"
click node_normalizer "https://github.com/sindhu2818/fortivo/blob/main/backend/scanners/normalize.py"
click node_riskagent "https://github.com/sindhu2818/fortivo/blob/main/backend/core/risk_agent.py"
click node_reducer "https://github.com/sindhu2818/fortivo/blob/main/backend/core/reduce.py"
click node_scorer "https://github.com/sindhu2818/fortivo/blob/main/backend/core/score.py"
click node_attackpaths "https://github.com/sindhu2818/fortivo/blob/main/backend/core/attack_paths.py"
click node_llm "https://github.com/sindhu2818/fortivo/blob/main/backend/core/llm.py"
click node_gemini "https://github.com/sindhu2818/fortivo/blob/main/backend/core/gemini.py"
click node_grok "https://github.com/sindhu2818/fortivo/blob/main/backend/core/grok.py"
click node_web "https://github.com/sindhu2818/fortivo/blob/main/frontend/app/page.tsx"
click node_dashboard "https://github.com/sindhu2818/fortivo/blob/main/frontend/app/dashboard/%5BscanId%5D/page.tsx"
click node_session "https://github.com/sindhu2818/fortivo/blob/main/frontend/lib/session.ts"
click node_dataset "https://github.com/sindhu2818/fortivo/blob/main/frontend/lib/dataset.ts"
click node_api "https://github.com/sindhu2818/fortivo/blob/main/backend/main.py"
click node_demoapp "https://github.com/sindhu2818/fortivo/blob/main/demo-app/app.py"
click node_user_routes "https://github.com/sindhu2818/fortivo/blob/main/demo-app/routes/users.py"
click node_user_service "https://github.com/sindhu2818/fortivo/blob/main/demo-app/services/user_service.py"
click node_user_model "https://github.com/sindhu2818/fortivo/blob/main/demo-app/models/user.py"
click node_db "https://github.com/sindhu2818/fortivo/blob/main/demo-app/services/db.py"
click node_orders "https://github.com/sindhu2818/fortivo/blob/main/demo-app/services/order_service.py"
click node_dates "https://github.com/sindhu2818/fortivo/blob/main/demo-app/services/dates.py"
click node_pagination "https://github.com/sindhu2818/fortivo/blob/main/demo-app/services/pagination.py"
click node_serializers "https://github.com/sindhu2818/fortivo/blob/main/demo-app/models/serializers.py"
click node_audit "https://github.com/sindhu2818/fortivo/blob/main/demo-app/services/audit_log.py"
click node_config "https://github.com/sindhu2818/fortivo/blob/main/demo-app/config.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_clone,node_scanner,node_semgrep,node_trivy,node_pipeline,node_models,node_storage,node_api toneBlue
class node_normalizer,node_riskagent,node_reducer,node_scorer,node_attackpaths,node_llm,node_gemini,node_grok toneAmber
class node_web,node_dashboard,node_session,node_dataset toneMint
class node_demoapp,node_user_routes,node_user_service,node_user_model,node_db,node_orders,node_dates,node_pagination,node_serializers,node_audit,node_config toneRose
class node_repo toneIndigo
```

## Components

### Scan runtime

- [Repository preparation](https://github.com/sindhu2818/fortivo/blob/main/backend/scanners/clone.py): `backend/scanners/clone.py`
- [Scanner agent](https://github.com/sindhu2818/fortivo/blob/main/backend/scanners/scanner_agent.py): `backend/scanners/scanner_agent.py`
- [Semgrep scanner](https://github.com/sindhu2818/fortivo/blob/main/backend/scanners/semgrep.py): `backend/scanners/semgrep.py`
- [Trivy scanner](https://github.com/sindhu2818/fortivo/blob/main/backend/scanners/trivy.py): `backend/scanners/trivy.py`
- [Scan pipeline](https://github.com/sindhu2818/fortivo/blob/main/backend/core/pipeline.py): `backend/core/pipeline.py`
- [Scan data contract](https://github.com/sindhu2818/fortivo/blob/main/backend/models.py): `backend/models.py`
- [Result storage](https://github.com/sindhu2818/fortivo/blob/main/backend/storage.py): `backend/storage.py`
- [Backend API](https://github.com/sindhu2818/fortivo/blob/main/backend/main.py): `backend/main.py`

### Risk analysis

- [Finding normalization](https://github.com/sindhu2818/fortivo/blob/main/backend/scanners/normalize.py): `backend/scanners/normalize.py`
- [Risk analysis agent](https://github.com/sindhu2818/fortivo/blob/main/backend/core/risk_agent.py): `backend/core/risk_agent.py`
- [Finding reduction](https://github.com/sindhu2818/fortivo/blob/main/backend/core/reduce.py): `backend/core/reduce.py`
- [Risk scoring](https://github.com/sindhu2818/fortivo/blob/main/backend/core/score.py): `backend/core/score.py`
- [Attack paths](https://github.com/sindhu2818/fortivo/blob/main/backend/core/attack_paths.py): `backend/core/attack_paths.py`
- [LLM coordinator](https://github.com/sindhu2818/fortivo/blob/main/backend/core/llm.py): `backend/core/llm.py`
- [Gemini enrichment](https://github.com/sindhu2818/fortivo/blob/main/backend/core/gemini.py): `backend/core/gemini.py`
- [Grok enrichment](https://github.com/sindhu2818/fortivo/blob/main/backend/core/grok.py): `backend/core/grok.py`

### Scan interface

- [Web interface](https://github.com/sindhu2818/fortivo/blob/main/frontend/app/page.tsx): `frontend/app/page.tsx`
- [Scan dashboard](https://github.com/sindhu2818/fortivo/blob/main/frontend/app/dashboard/%5BscanId%5D/page.tsx): `frontend/app/dashboard/[scanId]/page.tsx`
- [Scan sessions](https://github.com/sindhu2818/fortivo/blob/main/frontend/lib/session.ts): `frontend/lib/session.ts`
- [Demo scan data](https://github.com/sindhu2818/fortivo/blob/main/frontend/lib/dataset.ts): `frontend/lib/dataset.ts`

### Demo application

- [Invoicing service](https://github.com/sindhu2818/fortivo/blob/main/demo-app/app.py): `demo-app/app.py`
- [User routes](https://github.com/sindhu2818/fortivo/blob/main/demo-app/routes/users.py): `demo-app/routes/users.py`
- [User operations](https://github.com/sindhu2818/fortivo/blob/main/demo-app/services/user_service.py): `demo-app/services/user_service.py`
- [User model](https://github.com/sindhu2818/fortivo/blob/main/demo-app/models/user.py): `demo-app/models/user.py`
- [SQLite access](https://github.com/sindhu2818/fortivo/blob/main/demo-app/services/db.py): `demo-app/services/db.py`
- [Order operations](https://github.com/sindhu2818/fortivo/blob/main/demo-app/services/order_service.py): `demo-app/services/order_service.py`
- [Date utilities](https://github.com/sindhu2818/fortivo/blob/main/demo-app/services/dates.py): `demo-app/services/dates.py`
- [Pagination](https://github.com/sindhu2818/fortivo/blob/main/demo-app/services/pagination.py): `demo-app/services/pagination.py`
- [Response serializers](https://github.com/sindhu2818/fortivo/blob/main/demo-app/models/serializers.py): `demo-app/models/serializers.py`
- [Audit logging](https://github.com/sindhu2818/fortivo/blob/main/demo-app/services/audit_log.py): `demo-app/services/audit_log.py`
- [Application config](https://github.com/sindhu2818/fortivo/blob/main/demo-app/config.py): `demo-app/config.py`

### Other components

- **Target repository**

## Connections

- Target repository → Repository preparation: scan target
- Scan pipeline → Scanner agent: runs scanners (evidence: `backend/core/pipeline.py`)
- Scan pipeline → Risk analysis agent: analyzes findings (evidence: `backend/core/pipeline.py`)
- Scan pipeline → LLM coordinator: enriches results (evidence: `backend/core/pipeline.py`)
- Scan pipeline → Result storage: saves results (evidence: `backend/core/pipeline.py`)
- Scan pipeline → Repository preparation: derives repo name (evidence: `backend/core/pipeline.py`)
- Scanner agent → Repository preparation: prepares checkout (evidence: `backend/scanners/scanner_agent.py`)
- Scanner agent → Semgrep scanner: runs scan (evidence: `backend/scanners/scanner_agent.py`)
- Scanner agent → Trivy scanner: runs scan (evidence: `backend/scanners/scanner_agent.py`)
- Risk analysis agent → Finding normalization: normalizes findings (evidence: `backend/core/risk_agent.py`)
- Risk analysis agent → Finding reduction: reduces findings (evidence: `backend/core/risk_agent.py`)
- Risk analysis agent → Risk scoring: calculates risk (evidence: `backend/core/risk_agent.py`)
- Risk analysis agent → Attack paths: builds paths (evidence: `backend/core/risk_agent.py`)
- LLM coordinator → Gemini enrichment: enriches findings (evidence: `backend/core/llm.py`)
- LLM coordinator → Grok enrichment: advises on risk (evidence: `backend/core/llm.py`)
- Backend API → Scan pipeline: imports pipeline (evidence: `backend/main.py`)
- Backend API → Result storage: imports storage (evidence: `backend/main.py`)
- Backend API → Scan data contract: uses contract (evidence: `backend/main.py`)
- Web interface → Scan dashboard: opens scan view
- Scan dashboard → Scan sessions: uses sessions
- Scan sessions → Demo scan data: loads demo data (evidence: `frontend/lib/session.ts`)
- Invoicing service → User routes: registers routes (evidence: `demo-app/app.py`)
- User routes → User operations: calls user operations (evidence: `demo-app/routes/users.py`)
- User routes → Response serializers: serializes responses (evidence: `demo-app/routes/users.py`)
- User routes → Audit logging: records events (evidence: `demo-app/routes/users.py`)
- User routes → SQLite access: queries directly (evidence: `demo-app/routes/users.py`)
- User operations → SQLite access: reads and writes (evidence: `demo-app/services/user_service.py`)
- User operations → User model: uses user model (evidence: `demo-app/services/user_service.py`)
- User operations → Date utilities: formats timestamps (evidence: `demo-app/services/user_service.py`)
- User operations → Pagination: paginates results (evidence: `demo-app/services/user_service.py`)
- Order operations → SQLite access: reads and writes (evidence: `demo-app/services/order_service.py`)
- Order operations → Date utilities: sets order dates (evidence: `demo-app/services/order_service.py`)
- Order operations → Pagination: paginates orders (evidence: `demo-app/services/order_service.py`)
- SQLite access → Application config: reads database settings (evidence: `demo-app/services/db.py`)
- Audit logging → Date utilities: formats event times (evidence: `demo-app/services/audit_log.py`)
- Response serializers → Date utilities: formats date fields (evidence: `demo-app/models/serializers.py`)
