Repository navigation
03 Architecture
Vicky Patel edited this page Nov 18, 2026
·
1 revision
Dual-Engine Technical Architecture, Package Boundaries & Data Flow
GitVerse is engineered in Go 1.25+ as a dual-engine architecture: a single analytical core compiled into both a high-performance command-line binary (cmd/gitverse) and lightweight serverless HTTP handlers running on Vercel's Edge Network (api/*).
graph TD
subgraph Client Layer
WebUser[Web Browser Client]
TermUser[Terminal CLI Client]
end
subgraph Entrypoints
VercelFuncs["Vercel Go Serverless Handlers (api/*)"]
CLIMain["CLI Entrypoint (cmd/gitverse/main.go)"]
end
subgraph GitVerse Core Engine
Engine["internal/engine (Calculation & Delta Math)"]
Catalog["internal/catalog (15 Badges, Tiers, Metadata)"]
GHClient["internal/github (Scraping, OAuth, GraphQL/REST)"]
WebUI["internal/webui (HTML Templates & Asset Pipeline)"]
end
subgraph External Boundaries
GHWeb["GitHub Public HTML (Profile Modals)"]
GHAPI["GitHub REST & GraphQL API"]
GHOAuth["GitHub OAuth Consent Server"]
end
WebUser -->|HTTPS| VercelFuncs
TermUser -->|Exec| CLIMain
VercelFuncs --> Engine
VercelFuncs --> WebUI
CLIMain --> Engine
Engine --> Catalog
Engine --> GHClient
GHClient -->|Scrape /achievements| GHWeb
GHClient -->|Fetch Milestones & PRs| GHAPI
GHClient -->|Token Exchange| GHOAuth
The codebase strictly adheres to standard Go project conventions:
GitVerse/
โโโ api/ # Vercel Serverless Go entrypoints
โ โโโ index.go # Root redirect / landing proxy
โ โโโ login/index.go # Initiates GitHub OAuth handshake
โ โโโ callback/index.go # Handles OAuth code exchange
โ โโโ result/index.go # Serves public/private achievement reports
โ โโโ private/index.go # Processes direct PAT authentication
โ โโโ stars/index.go # Edge-cached repository stargazers proxy
โ โโโ markdown/index.go # Generates dynamic markdown badge snippets
โโโ cmd/
โ โโโ gitverse/ # Main terminal CLI entrypoint
โ โ โโโ main.go
โ โโโ gitverse-devserver/ # Local development HTTP server
โ โโโ main.go
โโโ internal/
โ โโโ catalog/ # Canonical achievement specifications
โ โ โโโ achievements.go # Definitions of all 15 badges and tiers
โ โ โโโ types.go # Badge, Tier, and Status domain types
โ โโโ engine/ # Core calculation & reconciliation unit
โ โ โโโ engine.go # Evaluates badges against contribution events
โ โ โโโ deltas.go # Computes exact next-tier gap metrics
โ โโโ github/ # GitHub communication layer
โ โ โโโ client.go # Resilient HTTP client with retry & backoff
โ โ โโโ scraper.go # High-precision HTML parser for badge modals
โ โ โโโ oauth.go # OAuth 2.0 flow & ephemeral token management
โ โโโ webui/ # Presentation layer
โ โโโ templates/ # Embedded HTML5 templates
โ โโโ renderer.go # Go html/template execution
โ โโโ assets/ # Static CSS, SVG, and branding assets
โโโ scripts/
โ โโโ gendocs/ # Static page pre-rendering & drift checker
โโโ site/ # Prerendered static pages (Explore, About, Privacy)
โโโ vercel.json # Vercel routing, rewrites, and headers
โโโ go.mod # Go module definition (Go 1.25+)
sequenceDiagram
participant User as Web/CLI User
participant App as GitVerse Engine
participant Scraper as internal/github Scraper
participant GH as GitHub Web & API
User->>App: Request analysis for username
App->>Scraper: Fetch profile achievements HTML
Scraper->>GH: GET https://github.com/username?tab=achievements
GH-->>Scraper: HTML Response with badge tokens
Scraper->>GH: GET https://github.com/users/username/achievements/{badge} (Detail Modal)
GH-->>Scraper: HTML Response with unlock timestamps & tier milestones
Scraper-->>App: Raw Achievement Records
App->>App: Reconcile with internal/catalog rules
App->>App: Calculate Next-Tier Deltas & Provenance
App-->>User: Rendered Web Report or ANSI CLI Table
sequenceDiagram
participant User as Developer
participant App as GitVerse Serverless
participant GH as GitHub OAuth / API
User->>App: Initiate Private Scan (OAuth or PAT)
App->>GH: Request repo-scoped token exchange
GH-->>App: Ephemeral Access Token (In-Memory Only)
App->>GH: Query GraphQL for private PRs, reviews & discussions
GH-->>App: Private Contribution Milestones
App->>App: Calculate Aggregated Achievements & Deltas
App->>GH: POST /applications/{client_id}/grant (Revoke Token Immediately)
GH-->>App: 204 Revocation Confirmed
App-->>User: Rendered Private Achievement Report (Zero Token Retained)
-
Exponential Backoff:
internal/githubimplements jittered exponential backoff when encountering HTTP 429 (Too Many Requests) or secondary GitHub rate limits. -
Edge CDN Caching: Endpoints that serve aggregated or public metrics (such as
/api/stars) setCache-Control: s-maxage=60, stale-while-revalidate=120, offloading 99% of requests directly to Vercel's global edge network. -
Bot Token Fallback: If an unauthenticated user query triggers a GitHub rate limit, GitVerse can seamlessly fall back to an internal pooled GitHub App / Bot token (
GH_BOT_TOKEN) to guarantee high availability for public queries.
| ๐๏ธ 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 |