# rowkavdev/github-profile-stats architecture

> Architecture diagram of the GitHub repository rowkavdev/github-profile-stats, 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/rowkavdev/github-profile-stats
- Repository: https://github.com/rowkavdev/github-profile-stats

## Overview

GitHub Profile Stats serves live, embeddable SVG and PNG cards, badges, language charts, sparklines, visit counts, and service-status views. The main workflow accepts a user or repository and display options, retrieves GitHub data, then renders an image response; builders help users preview and copy embeds. The README documents several layouts and metrics beyond the sampled route implementations. Unsampled internals are represented only where the tree or README supports the capability; uncertain wiring is omitted.

Main entry points: [`src/lib/github.ts`](https://github.com/rowkavdev/github-profile-stats/blob/main/src/lib/github.ts) (GitHub data access), [`src/app/api/profile/route.ts`](https://github.com/rowkavdev/github-profile-stats/blob/main/src/app/api/profile/route.ts) (Profile and repo API), [`src/app/api/card/route.ts`](https://github.com/rowkavdev/github-profile-stats/blob/main/src/app/api/card/route.ts) (Stats card API), [`src/app/api/mini/route.ts`](https://github.com/rowkavdev/github-profile-stats/blob/main/src/app/api/mini/route.ts) (Mini badge API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_home["Landing page<br/>[page.tsx]"]
  node_profilepage["Profile page<br/>[page.tsx]"]
  node_repopage["Repository page<br/>[page.tsx]"]
  node_visualbuilder["Visual builder<br/>[VisualBuilder.tsx]"]
  node_socialbuilder["Social card builder"]
  node_repobuilder["Repository card builder"]
  node_cardpreview["Card preview<br/>[CardPreview.tsx]"]
end

subgraph group_stats["GitHub statistics"]
  node_cardapi["Stats card API<br/>[route.ts]"]
  node_miniapi["Mini badge API<br/>[route.ts]"]
  node_langsapi["Language chart API<br/>[route.ts]"]
  node_sparkapi["Sparkline API<br/>[route.ts]"]
  node_profileapi["Profile and repo API<br/>[route.ts]"]
  node_pngapi["PNG card API<br/>[route.tsx]"]
  node_githubdata["GitHub data access<br/>[github.ts]"]
end

subgraph group_render["Image rendering"]
  node_svg["SVG renderers<br/>[index.ts]"]
  node_badge["Badge renderer<br/>[index.ts]"]
  node_profilecard["Profile card renderer<br/>[profile-card.ts]"]
  node_themes["Theme registry<br/>[themes.ts]"]
end

subgraph group_ops["Tracking and status"]
  node_visitsapi["Visit counter API<br/>[route.ts]"]
  node_badgeapi["User count API<br/>[route.ts]"]
  node_tracking["Visit tracking<br/>[tracking.ts]"]
  node_statuspage["Status page<br/>[page.tsx]"]
  node_statusapi["Status report API<br/>[route.ts]"]
  node_statuslib["Status collection<br/>[status.ts]"]
  node_statusbadge["Status badge API<br/>[route.ts]"]
end

node_embedder(("Embed consumer"))
node_github["GitHub API"]
node_redis["Redis"]

node_embedder -->|"requests card"| node_cardapi
node_embedder -->|"requests badge"| node_miniapi
node_embedder -->|"requests chart"| node_langsapi
node_embedder -->|"requests sparkline"| node_sparkapi
node_embedder -->|"requests card"| node_profileapi
node_embedder -->|"requests PNG"| node_pngapi
node_cardapi -->|"fetches stats"| node_githubdata
node_miniapi -->|"fetches stats"| node_githubdata
node_langsapi -->|"fetches languages"| node_githubdata
node_sparkapi -->|"fetches stats"| node_githubdata
node_profileapi -->|"fetches stats"| node_githubdata
node_profileapi -->|"renders card"| node_profilecard
node_pngapi -->|"fetches stats"| node_githubdata
node_pngapi -->|"renders card"| node_profilecard
node_githubdata -->|"queries"| node_github
node_cardapi -->|"renders card"| node_svg
node_cardapi -->|"resolves theme"| node_themes
node_miniapi -->|"renders badge"| node_badge
node_miniapi -->|"resolves theme"| node_themes
node_langsapi -->|"renders chart"| node_svg
node_langsapi -->|"resolves theme"| node_themes
node_sparkapi -->|"renders sparkline"| node_svg
node_sparkapi -->|"resolves theme"| node_themes
node_visitsapi -->|"counts views"| node_tracking
node_visitsapi -->|"renders badge"| node_badge
node_badgeapi -->|"reads count"| node_tracking
node_badgeapi -->|"renders badge"| node_badge
node_tracking -->|"updates counters"| node_redis
node_statuspage -->|"requests report"| node_statusapi
node_statusapi -->|"collects report"| node_statuslib
node_statusbadge -->|"fetches report"| node_statusapi
node_statusbadge -->|"renders badge"| node_badge
node_visualbuilder -->|"configures preview"| node_cardpreview
node_socialbuilder -->|"previews card"| node_profileapi
node_repobuilder -->|"previews card"| node_profileapi
node_repobuilder -->|"downloads PNG"| node_pngapi
node_home -->|"offers builder"| node_visualbuilder
node_profilepage -->|"offers builder"| node_socialbuilder
node_repopage -->|"offers builder"| node_repobuilder

click node_home "https://github.com/rowkavdev/github-profile-stats/blob/main/src/app/page.tsx"
click node_profilepage "https://github.com/rowkavdev/github-profile-stats/blob/main/src/app/%5Busername%5D/page.tsx"
click node_repopage "https://github.com/rowkavdev/github-profile-stats/blob/main/src/app/%5Busername%5D/%5Brepo%5D/page.tsx"
click node_visualbuilder "https://github.com/rowkavdev/github-profile-stats/blob/main/src/components/VisualBuilder.tsx"
click node_socialbuilder "https://github.com/rowkavdev/github-profile-stats/blob/main/src/components/ProfilePage/SocialCardBuilder.tsx"
click node_repobuilder "https://github.com/rowkavdev/github-profile-stats/blob/main/src/components/RepositoryPage/RepositoryCardBuilder.tsx"
click node_cardpreview "https://github.com/rowkavdev/github-profile-stats/blob/main/src/components/CardPreview/CardPreview.tsx"
click node_cardapi "https://github.com/rowkavdev/github-profile-stats/blob/main/src/app/api/card/route.ts"
click node_miniapi "https://github.com/rowkavdev/github-profile-stats/blob/main/src/app/api/mini/route.ts"
click node_langsapi "https://github.com/rowkavdev/github-profile-stats/blob/main/src/app/api/langs/route.ts"
click node_sparkapi "https://github.com/rowkavdev/github-profile-stats/blob/main/src/app/api/sparkline/route.ts"
click node_profileapi "https://github.com/rowkavdev/github-profile-stats/blob/main/src/app/api/profile/route.ts"
click node_pngapi "https://github.com/rowkavdev/github-profile-stats/blob/main/src/app/api/profile/png/route.tsx"
click node_githubdata "https://github.com/rowkavdev/github-profile-stats/blob/main/src/lib/github.ts"
click node_svg "https://github.com/rowkavdev/github-profile-stats/blob/main/src/lib/svg/index.ts"
click node_badge "https://github.com/rowkavdev/github-profile-stats/blob/main/src/lib/svg/badge/index.ts"
click node_profilecard "https://github.com/rowkavdev/github-profile-stats/blob/main/src/lib/profile-card.ts"
click node_themes "https://github.com/rowkavdev/github-profile-stats/blob/main/src/lib/themes/themes.ts"
click node_visitsapi "https://github.com/rowkavdev/github-profile-stats/blob/main/src/app/api/visits/route.ts"
click node_badgeapi "https://github.com/rowkavdev/github-profile-stats/blob/main/src/app/api/badge/route.ts"
click node_tracking "https://github.com/rowkavdev/github-profile-stats/blob/main/src/lib/tracking.ts"
click node_statuspage "https://github.com/rowkavdev/github-profile-stats/blob/main/src/app/status/page.tsx"
click node_statusapi "https://github.com/rowkavdev/github-profile-stats/blob/main/src/app/api/status/route.ts"
click node_statuslib "https://github.com/rowkavdev/github-profile-stats/blob/main/src/lib/status.ts"
click node_statusbadge "https://github.com/rowkavdev/github-profile-stats/blob/main/src/app/api/status/badge/route.ts"

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_home,node_profilepage,node_repopage,node_visualbuilder,node_socialbuilder,node_repobuilder,node_cardpreview toneBlue
class node_cardapi,node_miniapi,node_langsapi,node_sparkapi,node_profileapi,node_pngapi,node_githubdata,node_redis toneAmber
class node_svg,node_badge,node_profilecard,node_themes,node_github toneMint
class node_visitsapi,node_badgeapi,node_tracking,node_statuspage,node_statusapi,node_statuslib,node_statusbadge toneRose
class node_embedder toneIndigo
```

## Components

### Web experience

- [Landing page](https://github.com/rowkavdev/github-profile-stats/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Profile page](https://github.com/rowkavdev/github-profile-stats/blob/main/src/app/%5Busername%5D/page.tsx): `src/app/[username]/page.tsx`
- [Repository page](https://github.com/rowkavdev/github-profile-stats/blob/main/src/app/%5Busername%5D/%5Brepo%5D/page.tsx): `src/app/[username]/[repo]/page.tsx`
- [Visual builder](https://github.com/rowkavdev/github-profile-stats/blob/main/src/components/VisualBuilder.tsx): `src/components/VisualBuilder.tsx`
- [Social card builder](https://github.com/rowkavdev/github-profile-stats/blob/main/src/components/ProfilePage/SocialCardBuilder.tsx): `src/components/ProfilePage/SocialCardBuilder.tsx`
- [Repository card builder](https://github.com/rowkavdev/github-profile-stats/blob/main/src/components/RepositoryPage/RepositoryCardBuilder.tsx): `src/components/RepositoryPage/RepositoryCardBuilder.tsx`
- [Card preview](https://github.com/rowkavdev/github-profile-stats/blob/main/src/components/CardPreview/CardPreview.tsx): `src/components/CardPreview/CardPreview.tsx`

### GitHub statistics

- [Stats card API](https://github.com/rowkavdev/github-profile-stats/blob/main/src/app/api/card/route.ts): `src/app/api/card/route.ts`
- [Mini badge API](https://github.com/rowkavdev/github-profile-stats/blob/main/src/app/api/mini/route.ts): `src/app/api/mini/route.ts`
- [Language chart API](https://github.com/rowkavdev/github-profile-stats/blob/main/src/app/api/langs/route.ts): `src/app/api/langs/route.ts`
- [Sparkline API](https://github.com/rowkavdev/github-profile-stats/blob/main/src/app/api/sparkline/route.ts): `src/app/api/sparkline/route.ts`
- [Profile and repo API](https://github.com/rowkavdev/github-profile-stats/blob/main/src/app/api/profile/route.ts): `src/app/api/profile/route.ts`
- [PNG card API](https://github.com/rowkavdev/github-profile-stats/blob/main/src/app/api/profile/png/route.tsx): `src/app/api/profile/png/route.tsx`
- [GitHub data access](https://github.com/rowkavdev/github-profile-stats/blob/main/src/lib/github.ts): `src/lib/github.ts`

### Image rendering

- [SVG renderers](https://github.com/rowkavdev/github-profile-stats/blob/main/src/lib/svg/index.ts): `src/lib/svg/index.ts`
- [Badge renderer](https://github.com/rowkavdev/github-profile-stats/blob/main/src/lib/svg/badge/index.ts): `src/lib/svg/badge/index.ts`
- [Profile card renderer](https://github.com/rowkavdev/github-profile-stats/blob/main/src/lib/profile-card.ts): `src/lib/profile-card.ts`
- [Theme registry](https://github.com/rowkavdev/github-profile-stats/blob/main/src/lib/themes/themes.ts): `src/lib/themes/themes.ts`

### Tracking and status

- [Visit counter API](https://github.com/rowkavdev/github-profile-stats/blob/main/src/app/api/visits/route.ts): `src/app/api/visits/route.ts`
- [User count API](https://github.com/rowkavdev/github-profile-stats/blob/main/src/app/api/badge/route.ts): `src/app/api/badge/route.ts`
- [Visit tracking](https://github.com/rowkavdev/github-profile-stats/blob/main/src/lib/tracking.ts): `src/lib/tracking.ts`
- [Status page](https://github.com/rowkavdev/github-profile-stats/blob/main/src/app/status/page.tsx): `src/app/status/page.tsx`
- [Status report API](https://github.com/rowkavdev/github-profile-stats/blob/main/src/app/api/status/route.ts): `src/app/api/status/route.ts`
- [Status collection](https://github.com/rowkavdev/github-profile-stats/blob/main/src/lib/status.ts): `src/lib/status.ts`
- [Status badge API](https://github.com/rowkavdev/github-profile-stats/blob/main/src/app/api/status/badge/route.ts): `src/app/api/status/badge/route.ts`

### Other components

- **Embed consumer**
- **GitHub API**
- **Redis**

## Connections

- Embed consumer → Stats card API: requests card
- Embed consumer → Mini badge API: requests badge
- Embed consumer → Language chart API: requests chart
- Embed consumer → Sparkline API: requests sparkline
- Embed consumer → Profile and repo API: requests card
- Embed consumer → PNG card API: requests PNG
- Stats card API → GitHub data access: fetches stats
- Mini badge API → GitHub data access: fetches stats
- Language chart API → GitHub data access: fetches languages
- Sparkline API → GitHub data access: fetches stats
- Profile and repo API → GitHub data access: fetches stats
- Profile and repo API → Profile card renderer: renders card
- PNG card API → GitHub data access: fetches stats
- PNG card API → Profile card renderer: renders card
- GitHub data access → GitHub API: queries
- Stats card API → SVG renderers: renders card
- Stats card API → Theme registry: resolves theme
- Mini badge API → Badge renderer: renders badge
- Mini badge API → Theme registry: resolves theme
- Language chart API → SVG renderers: renders chart
- Language chart API → Theme registry: resolves theme
- Sparkline API → SVG renderers: renders sparkline
- Sparkline API → Theme registry: resolves theme
- Visit counter API → Visit tracking: counts views
- Visit counter API → Badge renderer: renders badge
- User count API → Visit tracking: reads count
- User count API → Badge renderer: renders badge
- Visit tracking → Redis: updates counters
- Status page → Status report API: requests report
- Status report API → Status collection: collects report
- Status badge API → Status report API: fetches report
- Status badge API → Badge renderer: renders badge
- Visual builder → Card preview: configures preview
- Social card builder → Profile and repo API: previews card
- Repository card builder → Profile and repo API: previews card
- Repository card builder → PNG card API: downloads PNG
- Landing page → Visual builder: offers builder
- Profile page → Social card builder: offers builder
- Repository page → Repository card builder: offers builder
