How snehaghoshbarsha444/git-city works
Purpose and Runtime
Git City is a Next.js 16 App Router application that turns GitHub profiles into customizable 3D buildings in an explorable city. It runs React/TypeScript on Vercel, renders Three.js through React Three Fiber, and serves both UI routes and server API route handlers. Primary entry points are src/app/page.tsx, src/app/layout.tsx, and src/middleware.ts.
City Rendering and Exploration
The landing experience composes a 3D city scene, instanced building rendering, effects, navigation, and activity-driven overlays. City geometry maps GitHub-derived developer metrics into building dimensions and visual properties; rendering uses detail tiers for scale. Core paths: src/components/CityScene.tsx, src/components/CityCanvas.tsx, src/components/InstancedBuildings.tsx.
Developer Profile and GitHub Ingestion
Developer pages resolve a username, obtain developer/GitHub data through APIs, and present the generated building, stats, achievements, sharing, and interaction affordances. GitHub is an external source boundary; Supabase persists application state and profile-related data. Core paths: src/app/dev/[username]/page.tsx, src/app/api/github/[username]/route.ts, src/app/api/dev/[username]/route.ts.
Persistence, Authentication, and Domain Rules
Supabase provides PostgreSQL, GitHub OAuth, and RLS-backed storage. Database migrations define the evolving domain: developer claims, customizations/items, social feed and achievements, ads, streaks, raids, districts, notifications, themes, and votes. Server/client database access is separated in src/lib/supabase-server.ts and src/lib/supabase.ts; OAuth returns through src/app/auth/callback/route.ts. Schema authority is supabase/migrations/001_initial_schema.sql through supabase/migrations/025_fly_scores.sql.
Engagement Systems
The application’s progression and social layer includes check-ins/streaks, achievements, items/loadouts, kudos and profile visits, districts, a live feed, leaderboard placement, raids, and rabbit/flying activities. UI/game sequences call narrowly scoped API handlers, which apply domain logic and persist results. Core paths: src/app/api/checkin/route.ts, src/app/api/raid/execute/route.ts, src/lib/achievements.ts.
Commerce and Advertising
Two monetization flows exist: user support/item purchasing and self-service “Sky Ads.” Checkout and provider webhooks form the payment boundary; ad setup, delivery/tracking, analytics, expiration, and administration are separate from the city renderer. Stripe, NOWPayments, and AbacatePay integrations are present. Core paths: src/app/api/checkout/route.ts, src/app/api/sky-ads/checkout/route.ts, src/app/api/webhooks/stripe/route.ts.
Background Delivery and Operations
Scheduled API endpoints handle ad expiry, batch flushing, digests, re-engagement, and streak reminders; Vercel configuration is the likely scheduler/deployment integration point. Email delivery is abstracted behind Resend and notification sender modules. Operational scripts seed data, backfill achievements, and report analytics. Core paths: src/app/api/cron/weekly-digest/route.ts, src/lib/resend.ts, vercel.json.
Main entry points: supabase-server.ts Supabase server · page.tsx Developer page · checkin/route.ts Engagement APIs · weekly-digest/route.ts Weekly digest job
Components 25
Next.js App
App Router UI, middleware, and route handlers.
- Landing page
src/app/page.tsx - Root layout
src/app/layout.tsx - Middleware
src/middleware.ts
3D City
Interactive Three.js city rendering.
- City scene
src/components/CityScene.tsx - City canvas
src/components/CityCanvas.tsx - Instanced buildings · Renders metric-derived buildings at scalable detail tiers.
src/components/InstancedBuildings.tsx
Profiles & Engagement
GitHub-derived profiles and game-like social systems.
- Developer page
src/app/dev/[username]/page.tsx - GitHub profile API
src/app/api/github/[username]/route.ts - Developer API
src/app/api/dev/[username]/route.ts - GitHub · Source for public developer profile and activity data.
- Engagement APIs · Check-ins, raids, items, kudos, districts, feed, and leaderboard actions.
src/app/api/checkin/route.ts - Raid execution
src/app/api/raid/execute/route.ts - Achievement rules
src/lib/achievements.ts
Platform Services
Persistence, payments, delivery, and operations.
- Supabase client
src/lib/supabase.ts - Supabase server
src/lib/supabase-server.ts - Supabase · Persistent application state and GitHub authentication.
- Database migrations · Defines profile, social, progression, ads, district, and vote domains.
supabase/migrations/001_initial_schema.sql - OAuth callback
src/app/auth/callback/route.ts - Support checkout
src/app/api/checkout/route.ts - Sky Ads checkout
src/app/api/sky-ads/checkout/route.ts - Payment providers · Stripe, NOWPayments, and AbacatePay payment boundary.
- Stripe webhook
src/app/api/webhooks/stripe/route.ts - Weekly digest job
src/app/api/cron/weekly-digest/route.ts - Email delivery
src/lib/resend.ts - Vercel scheduler
vercel.json
Connections 25
- Root layout → Landing page: wraps
- Middleware → Developer page: intercepts requests
- Landing page → City scene: composes
- City scene → City canvas: renders in
- City canvas → Instanced buildings: hosts
- Developer page → Developer API: loads profile
- Developer page → GitHub profile API: loads GitHub data
- Developer page → City scene: presents building
- GitHub profile API → GitHub: fetches
- Developer API → Supabase server: reads and writes
- Supabase server → Supabase: accesses
- Supabase client → Supabase: accesses
- Database migrations → Supabase: defines schema
- OAuth callback → Supabase: completes OAuth
- Engagement APIs → Supabase server: persists outcomes
- Engagement APIs → Achievement rules: evaluates progression
- Raid execution → Supabase server: applies raid results
- Developer page → Engagement APIs: triggers interactions
- Support checkout → Payment providers: creates checkout
- Sky Ads checkout → Payment providers: creates ad checkout
- Stripe webhook → Payment providers: receives events
- Stripe webhook → Supabase server: records payment state
- Weekly digest job → Supabase server: queries recipients
- Weekly digest job → Email delivery: sends digest
- Vercel scheduler → Weekly digest job: schedules