# ashfaqhyder/codnex architecture

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

- Interactive diagram: https://gitdiagram.com/ashfaqhyder/codnex
- Repository: https://github.com/ashfaqhyder/codnex

## Overview

codnex is a localhost, multi-language code-quality review service. The main workflow is: a user submits source or a project, the API analyzes supported files and functions, saves a JSON report, and the dashboard presents findings, complexity, and classifier results. Users can also reopen reports, compare static findings, inspect model evaluation, and export JSON or HTML. The graph follows documented wiring and source-index references; unsampled implementation details are omitted, and README-only relationships are cited there.

Main entry points: [`dashboard.py`](https://github.com/ashfaqhyder/codnex/blob/main/dashboard.py) (Web dashboard), [`service.py`](https://github.com/ashfaqhyder/codnex/blob/main/service.py) (FastAPI service), [`engine.py`](https://github.com/ashfaqhyder/codnex/blob/main/engine.py) (Static diagnostics), [`local_model.py`](https://github.com/ashfaqhyder/codnex/blob/main/local_model.py) (Function inference)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_submission["Project submission"]
  node_api["FastAPI service<br/>[service.py]"]
  node_project_input["Project intake<br/>[service.py]"]
end

subgraph group_analysis["Code analysis"]
  node_file_dispatch["File dispatch<br/>[service.py]"]
  node_static_review["Static diagnostics<br/>[engine.py]"]
  node_python_checks["Python checks<br/>[analyzer.py]"]
  node_growth["Complexity estimates<br/>[complexity.py]"]
  node_native_parsers["Native parsers<br/>[native_analysis.py]"]
  node_function_extract["Function extraction"]
end

subgraph group_models["Local classifier"]
  node_inference["Function inference<br/>[local_model.py]"]
  node_model_artifacts[("Model artifacts")]
end

subgraph group_workspace["Review workspace"]
  node_dashboard["Web dashboard<br/>[dashboard.py]"]
  node_legacy_dashboard["Python review UI<br/>[app.py]"]
  node_overview["Overview and charts"]
  node_inspector["Source inspector<br/>[dashboard.py]"]
  node_evaluation["Model evaluation view<br/>[dashboard.py]"]
end

subgraph group_persistence["Reports and storage"]
  node_sqlite[("Report database<br/>[service.py]")]
  node_history["Report history<br/>[service.py]"]
  node_comparison["Finding comparison<br/>[report_tools.py]"]
  node_exports["HTML export<br/>[report_tools.py]"]
end

node_user(("Reviewer"))
node_github["GitHub repository"]

node_user -->|"submits source"| node_dashboard
node_dashboard -->|"requests reports"| node_api
node_user -->|"reviews Python"| node_legacy_dashboard
node_legacy_dashboard -->|"analyzes source"| node_static_review
node_api -->|"accepts uploads"| node_project_input
node_project_input -.->|"downloads snapshot"| node_github
node_project_input -->|"dispatches files"| node_file_dispatch
node_file_dispatch -->|"runs checks"| node_static_review
node_static_review -->|"checks Python"| node_python_checks
node_static_review -->|"estimates growth"| node_growth
node_file_dispatch -->|"parses native code"| node_native_parsers
node_file_dispatch -->|"extracts functions"| node_function_extract
node_file_dispatch -->|"predicts functions"| node_inference
node_inference -->|"loads weights"| node_model_artifacts
node_api -->|"stores reports"| node_sqlite
node_api -->|"lists reports"| node_history
node_dashboard -->|"loads saved reports"| node_history
node_dashboard -->|"renders charts"| node_overview
node_dashboard -->|"shows source findings"| node_inspector
node_dashboard -->|"shows evaluation"| node_evaluation
node_dashboard -->|"compares findings"| node_comparison
node_api -->|"computes changes"| node_comparison
node_api -->|"renders HTML"| node_exports

click node_dashboard "https://github.com/ashfaqhyder/codnex/blob/main/dashboard.py"
click node_legacy_dashboard "https://github.com/ashfaqhyder/codnex/blob/main/app.py"
click node_api "https://github.com/ashfaqhyder/codnex/blob/main/service.py"
click node_project_input "https://github.com/ashfaqhyder/codnex/blob/main/service.py"
click node_file_dispatch "https://github.com/ashfaqhyder/codnex/blob/main/service.py"
click node_static_review "https://github.com/ashfaqhyder/codnex/blob/main/engine.py"
click node_python_checks "https://github.com/ashfaqhyder/codnex/blob/main/analyzer.py"
click node_growth "https://github.com/ashfaqhyder/codnex/blob/main/complexity.py"
click node_native_parsers "https://github.com/ashfaqhyder/codnex/blob/main/native_analysis.py"
click node_function_extract "https://github.com/ashfaqhyder/codnex/blob/main/function_extraction.py"
click node_inference "https://github.com/ashfaqhyder/codnex/blob/main/local_model.py"
click node_model_artifacts "https://github.com/ashfaqhyder/codnex/tree/main/models/defect_classifier"
click node_sqlite "https://github.com/ashfaqhyder/codnex/blob/main/service.py"
click node_history "https://github.com/ashfaqhyder/codnex/blob/main/service.py"
click node_comparison "https://github.com/ashfaqhyder/codnex/blob/main/report_tools.py"
click node_overview "https://github.com/ashfaqhyder/codnex/blob/main/workspace_charts.py"
click node_inspector "https://github.com/ashfaqhyder/codnex/blob/main/dashboard.py"
click node_evaluation "https://github.com/ashfaqhyder/codnex/blob/main/dashboard.py"
click node_exports "https://github.com/ashfaqhyder/codnex/blob/main/report_tools.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,node_project_input,node_user toneBlue
class node_file_dispatch,node_static_review,node_python_checks,node_growth,node_native_parsers,node_function_extract toneAmber
class node_inference,node_model_artifacts toneMint
class node_dashboard,node_legacy_dashboard,node_overview,node_inspector,node_evaluation toneRose
class node_sqlite,node_history,node_comparison,node_exports,node_github toneIndigo
```

## Components

### Project submission

- [FastAPI service](https://github.com/ashfaqhyder/codnex/blob/main/service.py): `service.py`
- [Project intake](https://github.com/ashfaqhyder/codnex/blob/main/service.py): `service.py`

### Code analysis

- [File dispatch](https://github.com/ashfaqhyder/codnex/blob/main/service.py): `service.py`
- [Static diagnostics](https://github.com/ashfaqhyder/codnex/blob/main/engine.py): `engine.py`
- [Python checks](https://github.com/ashfaqhyder/codnex/blob/main/analyzer.py): `analyzer.py`
- [Complexity estimates](https://github.com/ashfaqhyder/codnex/blob/main/complexity.py): `complexity.py`
- [Native parsers](https://github.com/ashfaqhyder/codnex/blob/main/native_analysis.py): `native_analysis.py`
- [Function extraction](https://github.com/ashfaqhyder/codnex/blob/main/function_extraction.py): `function_extraction.py`

### Local classifier

- [Function inference](https://github.com/ashfaqhyder/codnex/blob/main/local_model.py): `local_model.py`
- [Model artifacts](https://github.com/ashfaqhyder/codnex/tree/main/models/defect_classifier): `models/defect_classifier`

### Review workspace

- [Web dashboard](https://github.com/ashfaqhyder/codnex/blob/main/dashboard.py): `dashboard.py`
- [Python review UI](https://github.com/ashfaqhyder/codnex/blob/main/app.py): `app.py`
- [Overview and charts](https://github.com/ashfaqhyder/codnex/blob/main/workspace_charts.py): `workspace_charts.py`
- [Source inspector](https://github.com/ashfaqhyder/codnex/blob/main/dashboard.py): `dashboard.py`
- [Model evaluation view](https://github.com/ashfaqhyder/codnex/blob/main/dashboard.py): `dashboard.py`

### Reports and storage

- [Report database](https://github.com/ashfaqhyder/codnex/blob/main/service.py): `service.py`
- [Report history](https://github.com/ashfaqhyder/codnex/blob/main/service.py): `service.py`
- [Finding comparison](https://github.com/ashfaqhyder/codnex/blob/main/report_tools.py): `report_tools.py`
- [HTML export](https://github.com/ashfaqhyder/codnex/blob/main/report_tools.py): `report_tools.py`

### Other components

- **Reviewer**
- **GitHub repository**

## Connections

- Reviewer → Web dashboard: submits source (evidence: `README.md`)
- Web dashboard → FastAPI service: requests reports (evidence: `README.md`)
- Reviewer → Python review UI: reviews Python (evidence: `README.md`)
- Python review UI → Static diagnostics: analyzes source (evidence: `app.py`)
- FastAPI service → Project intake: accepts uploads (evidence: `service.py`)
- Project intake → GitHub repository: downloads snapshot (evidence: `README.md`)
- Project intake → File dispatch: dispatches files (evidence: `service.py`)
- File dispatch → Static diagnostics: runs checks (evidence: `service.py`)
- Static diagnostics → Python checks: checks Python (evidence: `engine.py`)
- Static diagnostics → Complexity estimates: estimates growth (evidence: `engine.py`)
- File dispatch → Native parsers: parses native code (evidence: `service.py`)
- File dispatch → Function extraction: extracts functions (evidence: `service.py`)
- File dispatch → Function inference: predicts functions (evidence: `service.py`)
- Function inference → Model artifacts: loads weights (evidence: `local_model.py`)
- FastAPI service → Report database: stores reports (evidence: `README.md`)
- FastAPI service → Report history: lists reports (evidence: `service.py`)
- Web dashboard → Report history: loads saved reports (evidence: `README.md`)
- Web dashboard → Overview and charts: renders charts (evidence: `dashboard.py`)
- Web dashboard → Source inspector: shows source findings (evidence: `dashboard.py`)
- Web dashboard → Model evaluation view: shows evaluation (evidence: `README.md`)
- Web dashboard → Finding comparison: compares findings (evidence: `README.md`)
- FastAPI service → Finding comparison: computes changes (evidence: `service.py`)
- FastAPI service → HTML export: renders HTML (evidence: `service.py`)
