# ludovicmoyo/open-source-project-analyzer architecture

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

- Interactive diagram: https://gitdiagram.com/ludovicmoyo/open-source-project-analyzer
- Repository: https://github.com/ludovicmoyo/open-source-project-analyzer

## Overview

Open-Source Project Analyzer turns a public GitHub repository URL into a persisted, combined health report. The principal workflow is URL submission, GitHub metadata and README retrieval, deterministic scoring, structured Gemini review, then report assembly. The frontend progress stages and chained API calls are documented in the README; source excerpts show backend route ownership and data access. The frontend page and some backend handlers were not excerpted, so undocumented call relationships are omitted.

Main entry points: [`src/routes.rs`](https://github.com/ludovicmoyo/open-source-project-analyzer/blob/main/src/routes.rs) (API routes), [`src/ai_handlers.rs`](https://github.com/ludovicmoyo/open-source-project-analyzer/blob/main/src/ai_handlers.rs) (Gemini review), [`migrations`](https://github.com/ludovicmoyo/open-source-project-analyzer/tree/main/migrations) (PostgreSQL), [`src/handlers.rs`](https://github.com/ludovicmoyo/open-source-project-analyzer/blob/main/src/handlers.rs) (Repository endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_frontend["Analysis UI<br/>[page.tsx]"]
end

subgraph group_api["API workflow"]
  node_api_routes["API routes<br/>[routes.rs]"]
  node_repo_handlers["Repository endpoints<br/>[handlers.rs]"]
  node_repo_models["Repository data models<br/>[models.rs]"]
  node_app_state["Shared app state<br/>[state.rs]"]
  node_server["Axum server<br/>[main.rs]"]
end

subgraph group_analysis["Analysis"]
  node_scoring["Rule-based scoring<br/>[scoring.rs]"]
  node_ai_handler["Gemini review<br/>[ai_handlers.rs]"]
  node_ai_models["Typed AI analysis<br/>[ai_models.rs]"]
  node_report_handler["Report assembly<br/>[report_handlers.rs]"]
  node_report_models["Report response<br/>[report_models.rs]"]
end

subgraph group_persistence["Persistence"]
  node_database[("PostgreSQL")]
end

node_user(("Repository analyst"))
node_github["GitHub REST API"]
node_gemini["Gemini API"]

node_user -->|"submits URL"| node_frontend
node_frontend -->|"chains API calls"| node_api_routes
node_server -->|"mounts routes"| node_api_routes
node_api_routes -->|"routes repository requests"| node_repo_handlers
node_api_routes -->|"routes score requests"| node_scoring
node_api_routes -->|"routes AI requests"| node_ai_handler
node_api_routes -->|"routes report requests"| node_report_handler
node_repo_handlers -->|"fetches repository data"| node_github
node_repo_handlers -->|"upserts and reads"| node_database
node_scoring -->|"reads and saves scores"| node_database
node_ai_handler -->|"reads repository; saves analysis"| node_database
node_ai_handler -->|"requests structured review"| node_gemini
node_ai_handler -->|"extracts typed result"| node_ai_models
node_report_handler -->|"reads report inputs"| node_database
node_report_handler -->|"builds response"| node_report_models
node_server -->|"provides shared state"| node_app_state

click node_frontend "https://github.com/ludovicmoyo/open-source-project-analyzer/blob/main/frontend/app/page.tsx"
click node_api_routes "https://github.com/ludovicmoyo/open-source-project-analyzer/blob/main/src/routes.rs"
click node_repo_handlers "https://github.com/ludovicmoyo/open-source-project-analyzer/blob/main/src/handlers.rs"
click node_repo_models "https://github.com/ludovicmoyo/open-source-project-analyzer/blob/main/src/models.rs"
click node_scoring "https://github.com/ludovicmoyo/open-source-project-analyzer/blob/main/src/scoring.rs"
click node_ai_handler "https://github.com/ludovicmoyo/open-source-project-analyzer/blob/main/src/ai_handlers.rs"
click node_ai_models "https://github.com/ludovicmoyo/open-source-project-analyzer/blob/main/src/ai_models.rs"
click node_report_handler "https://github.com/ludovicmoyo/open-source-project-analyzer/blob/main/src/report_handlers.rs"
click node_report_models "https://github.com/ludovicmoyo/open-source-project-analyzer/blob/main/src/report_models.rs"
click node_database "https://github.com/ludovicmoyo/open-source-project-analyzer/tree/main/migrations"
click node_app_state "https://github.com/ludovicmoyo/open-source-project-analyzer/blob/main/src/state.rs"
click node_server "https://github.com/ludovicmoyo/open-source-project-analyzer/blob/main/src/main.rs"

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_frontend toneBlue
class node_api_routes,node_repo_handlers,node_repo_models,node_app_state,node_server toneAmber
class node_scoring,node_ai_handler,node_ai_models,node_report_handler,node_report_models,node_github,node_gemini toneMint
class node_database toneRose
class node_user toneIndigo
```

## Components

### User experience

- [Analysis UI](https://github.com/ludovicmoyo/open-source-project-analyzer/blob/main/frontend/app/page.tsx): `frontend/app/page.tsx`

### API workflow

- [API routes](https://github.com/ludovicmoyo/open-source-project-analyzer/blob/main/src/routes.rs): `src/routes.rs`
- [Repository endpoints](https://github.com/ludovicmoyo/open-source-project-analyzer/blob/main/src/handlers.rs): `src/handlers.rs`
- [Repository data models](https://github.com/ludovicmoyo/open-source-project-analyzer/blob/main/src/models.rs): `src/models.rs`
- [Shared app state](https://github.com/ludovicmoyo/open-source-project-analyzer/blob/main/src/state.rs): `src/state.rs`
- [Axum server](https://github.com/ludovicmoyo/open-source-project-analyzer/blob/main/src/main.rs): `src/main.rs`

### Analysis

- [Rule-based scoring](https://github.com/ludovicmoyo/open-source-project-analyzer/blob/main/src/scoring.rs): `src/scoring.rs`
- [Gemini review](https://github.com/ludovicmoyo/open-source-project-analyzer/blob/main/src/ai_handlers.rs): `src/ai_handlers.rs`
- [Typed AI analysis](https://github.com/ludovicmoyo/open-source-project-analyzer/blob/main/src/ai_models.rs): `src/ai_models.rs`
- [Report assembly](https://github.com/ludovicmoyo/open-source-project-analyzer/blob/main/src/report_handlers.rs): `src/report_handlers.rs`
- [Report response](https://github.com/ludovicmoyo/open-source-project-analyzer/blob/main/src/report_models.rs): `src/report_models.rs`

### Persistence

- [PostgreSQL](https://github.com/ludovicmoyo/open-source-project-analyzer/tree/main/migrations): `migrations`

### Other components

- **Repository analyst**
- **GitHub REST API**
- **Gemini API**

## Connections

- Repository analyst → Analysis UI: submits URL (evidence: `README.md`)
- Analysis UI → API routes: chains API calls (evidence: `README.md`)
- Axum server → API routes: mounts routes (evidence: `src/main.rs`)
- API routes → Repository endpoints: routes repository requests (evidence: `src/routes.rs`)
- API routes → Rule-based scoring: routes score requests (evidence: `src/routes.rs`)
- API routes → Gemini review: routes AI requests (evidence: `src/routes.rs`)
- API routes → Report assembly: routes report requests (evidence: `src/routes.rs`)
- Repository endpoints → GitHub REST API: fetches repository data (evidence: `src/handlers.rs`)
- Repository endpoints → PostgreSQL: upserts and reads (evidence: `src/handlers.rs`)
- Rule-based scoring → PostgreSQL: reads and saves scores (evidence: `src/scoring.rs`)
- Gemini review → PostgreSQL: reads repository; saves analysis (evidence: `src/ai_handlers.rs`)
- Gemini review → Gemini API: requests structured review (evidence: `src/ai_handlers.rs`)
- Gemini review → Typed AI analysis: extracts typed result (evidence: `src/ai_handlers.rs`)
- Report assembly → PostgreSQL: reads report inputs (evidence: `src/report_handlers.rs`)
- Report assembly → Report response: builds response (evidence: `src/report_handlers.rs`)
- Axum server → Shared app state: provides shared state (evidence: `src/main.rs`)
