# dhathri073/githubprofileanalyzer architecture

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

- Interactive diagram: https://gitdiagram.com/dhathri073/githubprofileanalyzer
- Repository: https://github.com/dhathri073/githubprofileanalyzer

## Overview

GitHub Profile Analyzer is a small web application and REST API for collecting, caching, and serving GitHub profile insights. A user submits a username through the static UI; the API validates it, returns a result cached for one hour or fetches GitHub user and repository data, computes star and language summaries, stores the profile, and returns it for display. API clients can also page through stored profiles, read one, or delete one. The graph reflects the sampled runtime code and README; the UI’s configurable API URL is documented, but the sampled script uses a hardcoded URL.

Main entry points: [`server.js`](https://github.com/dhathri073/githubprofileanalyzer/blob/main/server.js) (Express server), [`script.js`](https://github.com/dhathri073/githubprofileanalyzer/blob/main/script.js) (UI interactions), [`routes/profileRoutes.js`](https://github.com/dhathri073/githubprofileanalyzer/blob/main/routes/profileRoutes.js) (Profile routes), [`db.js`](https://github.com/dhathri073/githubprofileanalyzer/blob/main/db.js) (Database access)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web interface"]
  node_web_ui["Analyzer UI<br/>[index.html]"]
  node_ui_logic["UI interactions<br/>[script.js]"]
end

subgraph group_api["REST API"]
  node_server["Express server<br/>[server.js]"]
  node_routes["Profile routes<br/>[profileRoutes.js]"]
end

subgraph group_analysis["GitHub analysis"]
  node_github_service["GitHub collector<br/>[githubService.js]"]
end

subgraph group_storage["Profile storage"]
  node_db_module["Database access<br/>[db.js]"]
  node_profiles_db[("Profiles table<br/>[schema.sql]")]
end

node_user(("User"))
node_api_client(("API client"))
node_github["GitHub API"]
node_browser_storage[("Browser storage")]

node_user -->|"uses"| node_web_ui
node_web_ui -->|"loads"| node_ui_logic
node_ui_logic -->|"POST analysis"| node_server
node_api_client -->|"API requests"| node_server
node_server -->|"dispatches"| node_routes
node_server -->|"initializes"| node_db_module
node_routes -->|"queries"| node_db_module
node_routes -->|"collects insights"| node_github_service
node_github_service -->|"fetches user and repos"| node_github
node_db_module -->|"reads and writes"| node_profiles_db
node_ui_logic -->|"stores history and theme"| node_browser_storage
node_server -->|"returns API response"| node_ui_logic

click node_web_ui "https://github.com/dhathri073/githubprofileanalyzer/blob/main/index.html"
click node_ui_logic "https://github.com/dhathri073/githubprofileanalyzer/blob/main/script.js"
click node_server "https://github.com/dhathri073/githubprofileanalyzer/blob/main/server.js"
click node_routes "https://github.com/dhathri073/githubprofileanalyzer/blob/main/routes/profileRoutes.js"
click node_github_service "https://github.com/dhathri073/githubprofileanalyzer/blob/main/services/githubService.js"
click node_db_module "https://github.com/dhathri073/githubprofileanalyzer/blob/main/db.js"
click node_profiles_db "https://github.com/dhathri073/githubprofileanalyzer/blob/main/schema.sql"

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_web_ui,node_ui_logic,node_user,node_api_client toneBlue
class node_server,node_routes,node_browser_storage toneAmber
class node_github_service,node_github toneMint
class node_db_module,node_profiles_db toneRose
```

## Components

### Web interface

- [Analyzer UI](https://github.com/dhathri073/githubprofileanalyzer/blob/main/index.html): `index.html`
- [UI interactions](https://github.com/dhathri073/githubprofileanalyzer/blob/main/script.js): `script.js`

### REST API

- [Express server](https://github.com/dhathri073/githubprofileanalyzer/blob/main/server.js): `server.js`
- [Profile routes](https://github.com/dhathri073/githubprofileanalyzer/blob/main/routes/profileRoutes.js): `routes/profileRoutes.js`

### GitHub analysis

- [GitHub collector](https://github.com/dhathri073/githubprofileanalyzer/blob/main/services/githubService.js): `services/githubService.js`

### Profile storage

- [Database access](https://github.com/dhathri073/githubprofileanalyzer/blob/main/db.js): `db.js`
- [Profiles table](https://github.com/dhathri073/githubprofileanalyzer/blob/main/schema.sql): `schema.sql`

### Other components

- **User**
- **API client**
- **GitHub API**
- **Browser storage**

## Connections

- User → Analyzer UI: uses
- Analyzer UI → UI interactions: loads
- UI interactions → Express server: POST analysis
- API client → Express server: API requests
- Express server → Profile routes: dispatches
- Express server → Database access: initializes
- Profile routes → Database access: queries
- Profile routes → GitHub collector: collects insights
- GitHub collector → GitHub API: fetches user and repos
- Database access → Profiles table: reads and writes
- UI interactions → Browser storage: stores history and theme
- Express server → UI interactions: returns API response
