Repository navigation
04 Codebase Tour
Vicky Patel edited this page Nov 18, 2026
·
1 revision
A Developer's Architectural Map of the GitVerse Repository
GitVerse maintains a clean separation of concerns between core analytical domain logic (internal/), entrypoint binaries (cmd/), serverless edge API handlers (api/), and user interface assets (site/, internal/webui/).
graph TD
Root[GitVerse Root] --> Cmd[cmd/]
Root --> Internal[internal/]
Root --> Api[api/]
Root --> Site[site/]
Root --> Scripts[scripts/]
Cmd --> CLIBin[cmd/gitverse]
Cmd --> DevServ[cmd/gitverse-devserver]
Internal --> Cat[internal/catalog]
Internal --> Eng[internal/engine]
Internal --> GH[internal/github]
Internal --> UI[internal/webui]
Api --> VercelEndpoints[api/*.go]
-
cmd/gitverse/main.go:- The entrypoint for the terminal command-line interface.
- Parses flags (
--all,--json,--raw,--token,--version). - Automatically queries local
gh auth tokenviaexec.Commandif no token is provided. - Invokes
internal/engineand formats results as either rich ANSI tables or JSON.
-
cmd/gitverse-devserver/main.go:- Standalone local HTTP server used for local web development without needing the full Vercel CLI.
- Mounts routes (
/,/check/,/achievements/,/api/stars, etc.) and re-renders templates dynamically on file save.
-
types.go:- Defines the core data structures:
Badge,Tier,Threshold,Status(earnable,disabled,retired,internal), andProvenance(official,calibrated,counted).
- Defines the core data structures:
-
achievements.go:- The canonical registry of all 15 GitHub achievements.
- Stores exact tier numerical milestones (e.g., Pull Shark: 2, 16, 128, 1024; Starstruck: 16, 128, 512, 4096).
- Holds official SVG asset URLs, titles, and descriptions.
-
engine.go:- Accepts raw contribution records from
internal/githuband reconciles them againstinternal/catalog. - Determines which tier badge has been unlocked.
- Assigns confidence provenance levels to each metric.
- Accepts raw contribution records from
-
deltas.go:- Computes remaining numbers to achieve the next tier:
$$\Delta = \text{NextThreshold} - \text{CurrentCount}$$ - Computes progress percentage for progress bar rendering.
- Computes remaining numbers to achieve the next tier:
-
scraper.go:- Uses Go's
golang.org/x/net/htmlto parse public GitHub profile achievement HTML pages. - Extracts unlock dates, tier numbers, and milestone badges.
- Uses Go's
-
client.go:- Configures an HTTP client with custom user agents, timeouts, connection pooling, and retry logic.
-
oauth.go:- Manages GitHub OAuth 2.0 token exchange, encrypted state validation (
HMAC-SHA256), and instantaneous token revocation calls (POST /applications/{client_id}/grant).
- Manages GitHub OAuth 2.0 token exchange, encrypted state validation (
-
templates/:- Contains Go HTML templates (
base.html,track.html,explore.html,about.html,privacy.html,result.html).
- Contains Go HTML templates (
-
renderer.go:- Compiles and caches HTML templates at startup using
html/template. - Exposes helper functions for formatting numbers, dates, and SVG badges.
- Compiles and caches HTML templates at startup using
-
api/stars/index.go:- Micro-handler that queries the live stargazers count of
TheVicky1/GitVerseusingGH_BOT_TOKEN. - Sets edge CDN headers
Cache-Control: public, s-maxage=60.
- Micro-handler that queries the live stargazers count of
-
api/login/index.go:- Generates secure OAuth authorization redirect URLs with anti-CSRF state tokens.
-
api/callback/index.go:- Receives GitHub's authorization code, exchanges it for an access token, triggers
internal/engine, and redirects to the results view.
- Receives GitHub's authorization code, exchanges it for an access token, triggers
-
api/result/index.go:- Renders the final achievement report page for public handles or verified private sessions.
-
api/markdown/index.go:- Generates dynamic SVG and Markdown badge snippets for profile embedding.
-
main.go:- Reads
internal/catalogand generates static HTML files insite/(e.g.site/explore/index.html,site/about/index.html). - Ensures static SEO pages never drift from the underlying Go codebase.
- Run automatically during CI tests to verify 0-drift.
- Reads
| 🏛️ Project Hub | 🛠️ Developer Docs | 💬 Community & Support |
|---|---|---|
| GitHub Repository | System Architecture | Live Web App |
| Track Any Profile | Achievement Catalog | Open Issues |
| Explore Badge Guides | CLI Reference | Pull Requests |
| Project Roadmap | Testing & QA Matrix | Maintainer Runbook |