# manya-singh7/code-wrapped architecture

> Architecture diagram of the GitHub repository manya-singh7/code-wrapped, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/manya-singh7/code-wrapped
- Repository: https://github.com/manya-singh7/code-wrapped

## Overview

Code Wrapped turns a GitHub user's selected activity period into a narrated, visual retrospective: sign-in and date/timezone context feed server-side collection and analysis, cached results are presented as slides and share cards, and public profiles can serve saved retrospectives without live GitHub access. The README also documents comparison, rankings, achievements, and location inference. Those capabilities are represented even where implementation excerpts were unavailable; their links are documented or left unverified rather than inferred from sibling modules.

Main entry points: [`src/app/page.js`](https://github.com/manya-singh7/code-wrapped/blob/main/src/app/page.js) (Activity collection), [`src/app/compare/page.jsx`](https://github.com/manya-singh7/code-wrapped/blob/main/src/app/compare/page.jsx) (Head-to-head comparison), [`src/app/WrappedSlides.jsx`](https://github.com/manya-singh7/code-wrapped/blob/main/src/app/WrappedSlides.jsx) (Narrated slide story), [`src/auth.js`](https://github.com/manya-singh7/code-wrapped/blob/main/src/auth.js) (GitHub OAuth)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and entry"]
  node_auth["GitHub OAuth<br/>[auth.js]"]
  node_main_page["Wrapped request<br/>[page.js]"]
  node_date_timezone["Period and timezone"]
end

subgraph group_analysis["Activity and insights"]
  node_activity_collection["Activity collection<br/>[page.js]"]
  node_github_helpers["GitHub request handling<br/>[github.js]"]
  node_concurrency["Request limiting<br/>[concurrency.js]"]
  node_insight_generation["AI stories and chapters<br/>[page.js]"]
  node_rankings_achievements["Rankings and achievements<br/>[page.js]"]
  node_location_resolution["Collaborator locations<br/>[userLocations.js]"]
end

subgraph group_presentation["Wrapped experience"]
  node_wrapped_slides["Narrated slide story<br/>[WrappedSlides.jsx]"]
  node_visualizations["Activity visualizations"]
  node_world_map["Collaborator map<br/>[WorldMap.jsx]"]
  node_marker_layout["Map marker layout<br/>[spreadMarkers.js]"]
  node_share_cards["Share card export<br/>[StatsCard.jsx]"]
end

subgraph group_sharing["Profiles and comparison"]
  node_public_profile["Public profile<br/>[page.jsx]"]
  node_comparison["Head-to-head comparison<br/>[page.jsx]"]
  node_comparison_form["Comparison form<br/>[CompareForm.jsx]"]
  node_github_routes["GitHub data routes"]
end

subgraph group_infrastructure["External services and state"]
  node_github_api["GitHub API"]
  node_geocode_cache[("Geocode cache<br/>[geocode_cache.sql]")]
  node_supabase[("Supabase<br/>[supabaseClient.js]")]
  node_geocoder["Geocoding service"]
end

node_visitor(("Visitor"))
node_github_user(("GitHub user"))

node_visitor -->|"signs in"| node_auth
node_github_user -->|"provides activity"| node_github_api
node_auth -->|"supplies session"| node_main_page
node_visitor -->|"requests Wrapped"| node_main_page
node_date_timezone -->|"sets period"| node_main_page
node_main_page -->|"loads activity"| node_activity_collection
node_activity_collection -->|"requests data"| node_github_helpers
node_github_helpers -->|"fetches activity"| node_github_api
node_activity_collection -->|"limits requests"| node_concurrency
node_activity_collection -->|"builds narrative"| node_insight_generation
node_insight_generation -->|"reads and writes cache"| node_supabase
node_activity_collection -->|"derives highlights"| node_rankings_achievements
node_activity_collection -->|"resolves collaborators"| node_location_resolution
node_location_resolution -.->|"uses cached places"| node_geocode_cache
node_location_resolution -.->|"geocodes places"| node_geocoder
node_main_page -->|"reads and writes snapshots"| node_supabase
node_main_page -->|"renders story"| node_wrapped_slides
node_wrapped_slides -->|"renders charts"| node_visualizations
node_wrapped_slides -->|"renders locations"| node_world_map
node_world_map -->|"spreads markers"| node_marker_layout
node_wrapped_slides -->|"renders export cards"| node_share_cards
node_visitor -->|"opens profile"| node_public_profile
node_public_profile -->|"reads public cache"| node_supabase
node_public_profile -->|"renders cached story"| node_wrapped_slides
node_visitor -->|"requests comparison"| node_comparison
node_comparison -->|"renders form"| node_comparison_form
node_comparison -->|"fetches user stats"| node_github_helpers
node_comparison -->|"limits requests"| node_concurrency
node_comparison -->|"checks session"| node_auth
node_visitor -.->|"requests data"| node_github_routes
node_github_routes -->|"checks session"| node_auth
node_github_routes -->|"fetches repositories"| node_github_api

click node_auth "https://github.com/manya-singh7/code-wrapped/blob/main/src/auth.js"
click node_main_page "https://github.com/manya-singh7/code-wrapped/blob/main/src/app/page.js"
click node_date_timezone "https://github.com/manya-singh7/code-wrapped/blob/main/src/app/DateRangePicker.jsx"
click node_activity_collection "https://github.com/manya-singh7/code-wrapped/blob/main/src/app/page.js"
click node_github_helpers "https://github.com/manya-singh7/code-wrapped/blob/main/src/lib/github.js"
click node_concurrency "https://github.com/manya-singh7/code-wrapped/blob/main/src/lib/concurrency.js"
click node_insight_generation "https://github.com/manya-singh7/code-wrapped/blob/main/src/app/page.js"
click node_rankings_achievements "https://github.com/manya-singh7/code-wrapped/blob/main/src/app/page.js"
click node_location_resolution "https://github.com/manya-singh7/code-wrapped/blob/main/src/lib/userLocations.js"
click node_geocode_cache "https://github.com/manya-singh7/code-wrapped/blob/main/supabase/geocode_cache.sql"
click node_supabase "https://github.com/manya-singh7/code-wrapped/blob/main/src/app/supabaseClient.js"
click node_wrapped_slides "https://github.com/manya-singh7/code-wrapped/blob/main/src/app/WrappedSlides.jsx"
click node_visualizations "https://github.com/manya-singh7/code-wrapped/blob/main/src/app/ContributionHeatmap.jsx"
click node_world_map "https://github.com/manya-singh7/code-wrapped/blob/main/src/app/WorldMap.jsx"
click node_marker_layout "https://github.com/manya-singh7/code-wrapped/blob/main/src/lib/spreadMarkers.js"
click node_share_cards "https://github.com/manya-singh7/code-wrapped/blob/main/src/app/StatsCard.jsx"
click node_public_profile "https://github.com/manya-singh7/code-wrapped/blob/main/src/app/u/%5Busername%5D/page.jsx"
click node_comparison "https://github.com/manya-singh7/code-wrapped/blob/main/src/app/compare/page.jsx"
click node_comparison_form "https://github.com/manya-singh7/code-wrapped/blob/main/src/app/compare/CompareForm.jsx"
click node_github_routes "https://github.com/manya-singh7/code-wrapped/tree/main/src/app/api/github"

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_auth,node_main_page,node_date_timezone,node_github_user toneBlue
class node_activity_collection,node_github_helpers,node_concurrency,node_insight_generation,node_rankings_achievements,node_location_resolution toneAmber
class node_wrapped_slides,node_visualizations,node_world_map,node_marker_layout,node_share_cards toneMint
class node_public_profile,node_comparison,node_comparison_form,node_github_routes toneRose
class node_github_api,node_geocode_cache,node_supabase,node_geocoder,node_visitor toneIndigo
```

## Components

### Access and entry

- [GitHub OAuth](https://github.com/manya-singh7/code-wrapped/blob/main/src/auth.js): `src/auth.js`
- [Wrapped request](https://github.com/manya-singh7/code-wrapped/blob/main/src/app/page.js): `src/app/page.js`
- [Period and timezone](https://github.com/manya-singh7/code-wrapped/blob/main/src/app/DateRangePicker.jsx): `src/app/DateRangePicker.jsx`

### Activity and insights

- [Activity collection](https://github.com/manya-singh7/code-wrapped/blob/main/src/app/page.js): `src/app/page.js`
- [GitHub request handling](https://github.com/manya-singh7/code-wrapped/blob/main/src/lib/github.js): `src/lib/github.js`
- [Request limiting](https://github.com/manya-singh7/code-wrapped/blob/main/src/lib/concurrency.js): `src/lib/concurrency.js`
- [AI stories and chapters](https://github.com/manya-singh7/code-wrapped/blob/main/src/app/page.js): `src/app/page.js`
- [Rankings and achievements](https://github.com/manya-singh7/code-wrapped/blob/main/src/app/page.js): `src/app/page.js`
- [Collaborator locations](https://github.com/manya-singh7/code-wrapped/blob/main/src/lib/userLocations.js): `src/lib/userLocations.js`

### Wrapped experience

- [Narrated slide story](https://github.com/manya-singh7/code-wrapped/blob/main/src/app/WrappedSlides.jsx): `src/app/WrappedSlides.jsx`
- [Activity visualizations](https://github.com/manya-singh7/code-wrapped/blob/main/src/app/ContributionHeatmap.jsx): `src/app/ContributionHeatmap.jsx`
- [Collaborator map](https://github.com/manya-singh7/code-wrapped/blob/main/src/app/WorldMap.jsx): `src/app/WorldMap.jsx`
- [Map marker layout](https://github.com/manya-singh7/code-wrapped/blob/main/src/lib/spreadMarkers.js): `src/lib/spreadMarkers.js`
- [Share card export](https://github.com/manya-singh7/code-wrapped/blob/main/src/app/StatsCard.jsx): `src/app/StatsCard.jsx`

### Profiles and comparison

- [Public profile](https://github.com/manya-singh7/code-wrapped/blob/main/src/app/u/%5Busername%5D/page.jsx): `src/app/u/[username]/page.jsx`
- [Head-to-head comparison](https://github.com/manya-singh7/code-wrapped/blob/main/src/app/compare/page.jsx): `src/app/compare/page.jsx`
- [Comparison form](https://github.com/manya-singh7/code-wrapped/blob/main/src/app/compare/CompareForm.jsx): `src/app/compare/CompareForm.jsx`
- [GitHub data routes](https://github.com/manya-singh7/code-wrapped/tree/main/src/app/api/github): `src/app/api/github`

### External services and state

- **GitHub API**
- [Geocode cache](https://github.com/manya-singh7/code-wrapped/blob/main/supabase/geocode_cache.sql): `supabase/geocode_cache.sql`
- [Supabase](https://github.com/manya-singh7/code-wrapped/blob/main/src/app/supabaseClient.js): `src/app/supabaseClient.js`
- **Geocoding service**

### Other components

- **Visitor**
- **GitHub user**

## Connections

- Visitor → GitHub OAuth: signs in (evidence: `README.md`)
- GitHub user → GitHub API: provides activity (evidence: `README.md`)
- GitHub OAuth → Wrapped request: supplies session (evidence: `src/app/page.js`)
- Visitor → Wrapped request: requests Wrapped (evidence: `README.md`)
- Period and timezone → Wrapped request: sets period (evidence: `src/app/page.js`)
- Wrapped request → Activity collection: loads activity (evidence: `src/app/page.js`)
- Activity collection → GitHub request handling: requests data (evidence: `src/app/page.js`)
- GitHub request handling → GitHub API: fetches activity (evidence: `src/lib/github.js`)
- Activity collection → Request limiting: limits requests (evidence: `README.md`)
- Activity collection → AI stories and chapters: builds narrative (evidence: `README.md`)
- AI stories and chapters → Supabase: reads and writes cache (evidence: `src/app/page.js`)
- Activity collection → Rankings and achievements: derives highlights (evidence: `README.md`)
- Activity collection → Collaborator locations: resolves collaborators (evidence: `README.md`)
- Collaborator locations → Geocode cache: uses cached places
- Collaborator locations → Geocoding service: geocodes places
- Wrapped request → Supabase: reads and writes snapshots (evidence: `src/app/page.js`)
- Wrapped request → Narrated slide story: renders story (evidence: `src/app/page.js`)
- Narrated slide story → Activity visualizations: renders charts (evidence: `src/app/WrappedSlides.jsx`)
- Narrated slide story → Collaborator map: renders locations (evidence: `src/app/WrappedSlides.jsx`)
- Collaborator map → Map marker layout: spreads markers (evidence: `src/lib/spreadMarkers.js`)
- Narrated slide story → Share card export: renders export cards (evidence: `src/app/WrappedSlides.jsx`)
- Visitor → Public profile: opens profile (evidence: `README.md`)
- Public profile → Supabase: reads public cache (evidence: `src/app/u/[username]/page.jsx`)
- Public profile → Narrated slide story: renders cached story (evidence: `src/app/u/[username]/page.jsx`)
- Visitor → Head-to-head comparison: requests comparison (evidence: `README.md`)
- Head-to-head comparison → Comparison form: renders form (evidence: `src/app/compare/page.jsx`)
- Head-to-head comparison → GitHub request handling: fetches user stats (evidence: `src/app/compare/page.jsx`)
- Head-to-head comparison → Request limiting: limits requests (evidence: `src/app/compare/page.jsx`)
- Head-to-head comparison → GitHub OAuth: checks session (evidence: `src/app/compare/page.jsx`)
- Visitor → GitHub data routes: requests data
- GitHub data routes → GitHub OAuth: checks session (evidence: `src/app/api/github/commits/route.js`)
- GitHub data routes → GitHub API: fetches repositories (evidence: `src/app/api/github/commits/route.js`)
