# mrugakshi77/depradar architecture

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

- Interactive diagram: https://gitdiagram.com/mrugakshi77/depradar
- Repository: https://github.com/mrugakshi77/depradar

## Overview

DepRadar scans Python dependencies submitted as package lists, requirements content, or GitHub repositories, then returns per-package risk findings and an overall score. The main flow enters through the API, parses or fetches dependency input where needed, runs bounded package lookups with PyPI and OSV, applies risk classification, and persists scan and cache records for reports. The README also documents a CLI, single-package lookup, health checks, and a browser frontend. Relationships reflect the shown route and service calls plus documented capabilities; the frontend and CLI implementation paths were not sampled.

Main entry points: [`app/routes/scan.py`](https://github.com/mrugakshi77/depradar/blob/main/app/routes/scan.py) (Scan endpoints), [`app/main.py`](https://github.com/mrugakshi77/depradar/blob/main/app/main.py) (FastAPI app), [`app/services/scan_service.py`](https://github.com/mrugakshi77/depradar/blob/main/app/services/scan_service.py) (Scan orchestration), [`app/db/database.py`](https://github.com/mrugakshi77/depradar/blob/main/app/db/database.py) (Database sessions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API entrypoints"]
  node_api_app["FastAPI app<br/>[main.py]"]
  node_scan_routes["Scan endpoints<br/>[scan.py]"]
  node_package_route["Package lookup<br/>[package.py]"]
  node_health_route["Health checks<br/>[health.py]"]
  node_schemas["API schemas<br/>[package.py]"]
end

subgraph group_analysis["Scan and risk analysis"]
  node_requirements_parser["Requirements parser<br/>[parser.py]"]
  node_github_fetch["GitHub file fetch<br/>[github.py]"]
  node_scan_service["Scan orchestration<br/>[scan_service.py]"]
  node_risk_assessment["Risk assessment<br/>[scan_service.py]"]
end

subgraph group_persistence["Cache and persistence"]
  node_database_layer["Database sessions<br/>[database.py]"]
  node_domain_models["Scan and cache records<br/>[package.py]"]
  node_database[("Relational database")]
end

subgraph group_integrations["External sources"]
  node_pypi_osv["PyPI and OSV lookup<br/>[pypi.py]"]
  node_config["Runtime settings<br/>[config.py]"]
end

node_user(("User or CI"))
node_cli["CLI commands<br/>[depradar.py]"]
node_browser["Browser SPA<br/>[index.html]"]
node_pypi_service(("PyPI"))
node_osv_service(("OSV.dev"))
node_github_service(("GitHub"))
node_report["Risk report"]

node_user -->|"uses"| node_api_app
node_cli -.->|"calls API"| node_api_app
node_browser -.->|"uses API"| node_api_app
node_api_app -->|"registers"| node_scan_routes
node_api_app -->|"registers"| node_package_route
node_api_app -->|"registers"| node_health_route
node_api_app -->|"initializes"| node_database_layer
node_scan_routes -->|"validates and returns"| node_schemas
node_scan_routes -->|"parses content"| node_requirements_parser
node_scan_routes -->|"fetches requirements"| node_github_fetch
node_scan_routes -->|"runs and retrieves"| node_scan_service
node_scan_routes -->|"reads cache records"| node_domain_models
node_scan_routes -->|"builds report"| node_report
node_package_route -->|"refreshes package cache"| node_scan_service
node_package_route -->|"returns lookup schema"| node_schemas
node_health_route -->|"checks database"| node_database_layer
node_health_route -->|"checks reachability"| node_github_fetch
node_scan_service -->|"classifies and scores"| node_risk_assessment
node_scan_service -->|"fetches package data"| node_pypi_osv
node_scan_service -->|"reads and writes"| node_database_layer
node_scan_service -->|"creates scan records"| node_domain_models
node_pypi_osv -->|"uses API settings"| node_config
node_github_fetch -->|"uses API settings"| node_config
node_database_layer -->|"uses database URL"| node_config
node_database_layer -.->|"connects"| node_database
node_domain_models -->|"uses ORM base"| node_database_layer
node_pypi_osv -.->|"queries metadata"| node_pypi_service
node_pypi_osv -.->|"queries vulnerabilities"| node_osv_service
node_github_fetch -.->|"resolves and fetches"| node_github_service
node_health_route -.->|"checks reachability"| node_pypi_service
node_health_route -.->|"checks reachability"| node_osv_service

click node_cli "https://github.com/mrugakshi77/depradar/blob/main/cli/depradar.py"
click node_browser "https://github.com/mrugakshi77/depradar/blob/main/frontend/index.html"
click node_api_app "https://github.com/mrugakshi77/depradar/blob/main/app/main.py"
click node_scan_routes "https://github.com/mrugakshi77/depradar/blob/main/app/routes/scan.py"
click node_package_route "https://github.com/mrugakshi77/depradar/blob/main/app/routes/package.py"
click node_health_route "https://github.com/mrugakshi77/depradar/blob/main/app/routes/health.py"
click node_schemas "https://github.com/mrugakshi77/depradar/blob/main/app/schemas/package.py"
click node_requirements_parser "https://github.com/mrugakshi77/depradar/blob/main/app/services/parser.py"
click node_github_fetch "https://github.com/mrugakshi77/depradar/blob/main/app/services/github.py"
click node_scan_service "https://github.com/mrugakshi77/depradar/blob/main/app/services/scan_service.py"
click node_risk_assessment "https://github.com/mrugakshi77/depradar/blob/main/app/services/scan_service.py"
click node_pypi_osv "https://github.com/mrugakshi77/depradar/blob/main/app/services/pypi.py"
click node_config "https://github.com/mrugakshi77/depradar/blob/main/app/core/config.py"
click node_database_layer "https://github.com/mrugakshi77/depradar/blob/main/app/db/database.py"
click node_domain_models "https://github.com/mrugakshi77/depradar/blob/main/app/models/package.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_api_app,node_scan_routes,node_package_route,node_health_route,node_schemas,node_user,node_browser toneBlue
class node_requirements_parser,node_github_fetch,node_scan_service,node_risk_assessment toneAmber
class node_database_layer,node_domain_models,node_database toneMint
class node_pypi_osv,node_config toneRose
class node_cli toneTeal
class node_pypi_service,node_osv_service,node_github_service,node_report toneIndigo
```

## Components

### API entrypoints

- [FastAPI app](https://github.com/mrugakshi77/depradar/blob/main/app/main.py): `app/main.py`
- [Scan endpoints](https://github.com/mrugakshi77/depradar/blob/main/app/routes/scan.py): `app/routes/scan.py`
- [Package lookup](https://github.com/mrugakshi77/depradar/blob/main/app/routes/package.py): `app/routes/package.py`
- [Health checks](https://github.com/mrugakshi77/depradar/blob/main/app/routes/health.py): `app/routes/health.py`
- [API schemas](https://github.com/mrugakshi77/depradar/blob/main/app/schemas/package.py): `app/schemas/package.py`

### Scan and risk analysis

- [Requirements parser](https://github.com/mrugakshi77/depradar/blob/main/app/services/parser.py): `app/services/parser.py`
- [GitHub file fetch](https://github.com/mrugakshi77/depradar/blob/main/app/services/github.py): `app/services/github.py`
- [Scan orchestration](https://github.com/mrugakshi77/depradar/blob/main/app/services/scan_service.py): `app/services/scan_service.py`
- [Risk assessment](https://github.com/mrugakshi77/depradar/blob/main/app/services/scan_service.py): `app/services/scan_service.py`

### Cache and persistence

- [Database sessions](https://github.com/mrugakshi77/depradar/blob/main/app/db/database.py): `app/db/database.py`
- [Scan and cache records](https://github.com/mrugakshi77/depradar/blob/main/app/models/package.py): `app/models/package.py`
- **Relational database**

### External sources

- [PyPI and OSV lookup](https://github.com/mrugakshi77/depradar/blob/main/app/services/pypi.py): `app/services/pypi.py`
- [Runtime settings](https://github.com/mrugakshi77/depradar/blob/main/app/core/config.py): `app/core/config.py`

### Other components

- **User or CI**
- [CLI commands](https://github.com/mrugakshi77/depradar/blob/main/cli/depradar.py): `cli/depradar.py`
- [Browser SPA](https://github.com/mrugakshi77/depradar/blob/main/frontend/index.html): `frontend/index.html`
- **PyPI**
- **OSV.dev**
- **GitHub**
- **Risk report**

## Connections

- User or CI → FastAPI app: uses (evidence: `README.md`)
- CLI commands → FastAPI app: calls API (evidence: `README.md`)
- Browser SPA → FastAPI app: uses API
- FastAPI app → Scan endpoints: registers (evidence: `app/main.py`)
- FastAPI app → Package lookup: registers (evidence: `app/main.py`)
- FastAPI app → Health checks: registers (evidence: `app/main.py`)
- FastAPI app → Database sessions: initializes (evidence: `app/main.py`)
- Scan endpoints → API schemas: validates and returns (evidence: `app/routes/scan.py`)
- Scan endpoints → Requirements parser: parses content (evidence: `app/routes/scan.py`)
- Scan endpoints → GitHub file fetch: fetches requirements (evidence: `app/routes/scan.py`)
- Scan endpoints → Scan orchestration: runs and retrieves (evidence: `app/routes/scan.py`)
- Scan endpoints → Scan and cache records: reads cache records (evidence: `app/routes/scan.py`)
- Scan endpoints → Risk report: builds report (evidence: `app/routes/scan.py`)
- Package lookup → Scan orchestration: refreshes package cache (evidence: `app/routes/package.py`)
- Package lookup → API schemas: returns lookup schema (evidence: `app/routes/package.py`)
- Health checks → Database sessions: checks database (evidence: `app/routes/health.py`)
- Health checks → GitHub file fetch: checks reachability (evidence: `app/routes/health.py`)
- Scan orchestration → Risk assessment: classifies and scores (evidence: `app/services/scan_service.py`)
- Scan orchestration → PyPI and OSV lookup: fetches package data (evidence: `app/services/scan_service.py`)
- Scan orchestration → Database sessions: reads and writes (evidence: `app/services/scan_service.py`)
- Scan orchestration → Scan and cache records: creates scan records (evidence: `app/services/scan_service.py`)
- PyPI and OSV lookup → Runtime settings: uses API settings (evidence: `app/services/pypi.py`)
- GitHub file fetch → Runtime settings: uses API settings (evidence: `app/services/github.py`)
- Database sessions → Runtime settings: uses database URL (evidence: `app/db/database.py`)
- Database sessions → Relational database: connects
- Scan and cache records → Database sessions: uses ORM base (evidence: `app/models/package.py`)
- PyPI and OSV lookup → PyPI: queries metadata
- PyPI and OSV lookup → OSV.dev: queries vulnerabilities
- GitHub file fetch → GitHub: resolves and fetches
- Health checks → PyPI: checks reachability
- Health checks → OSV.dev: checks reachability
