api
feat: git-powered analyze server + Vercel proxy ΓÇö history for any repo, no rate limits
public
fix: ship the trailer-mode markup the last deploy was missing
src
fix(hosted): say why history is missing instead of degrading silently
tools
fix: ship the trailer-mode markup the last deploy was missing
.gitignore
feat: git-powered analyze server + Vercel proxy ΓÇö history for any repo, no rate limits
analyze.mjs
feat(hosted): full history for small repos via the commits API
api.js
feat: git-powered analyze server + Vercel proxy ΓÇö history for any repo, no rate limits
CLAUDE.md
fix: ship the trailer-mode markup the last deploy was missing
index.html
fix: ship the trailer-mode markup the last deploy was missing
LICENSE
docs: README with feature tour, controls, and self-host guide; MIT license
package-lock.json
feat: car garage (coupe/racer/truck) with per-car engine voices; drop orbit mode + gsap; sharper rendering (MSAA composer, 2x face canvas, 256px avatars, anisotropy)
package.json
feat: git-powered analyze server + Vercel proxy ΓÇö history for any repo, no rate limits
railway.json
feat: git-powered analyze server + Vercel proxy ΓÇö history for any repo, no rate limits
README.md
docs: drop the contributing section
server.mjs
feat: git-powered analyze server + Vercel proxy ΓÇö history for any repo, no rate limits
vercel.json
feat(hosted): build any public repo on the deployed site
vite.config.js
feat: git-powered analyze server + Vercel proxy ΓÇö history for any repo, no rate limits

🏙️ CodeCity

Every repo is a city. Drive through yours. — drive it live →

CodeCity turns any GitHub repository into a drivable 3D night city — then hands you the keys.

  • Building = file — height grows with lines of code, footprint with size
  • District = folder — the repo's tree becomes the street plan (squarified treemap)
  • Glowing windows = hot files — the most-committed files light up the skyline
  • Faces in the sky — the repo's top contributors greet you at the gate (real GitHub avatars), and the busiest files fly their top author's face overhead

Paste a GitHub URL, wait a few seconds, drive.

✨ What's inside

🚗 Three carscoupe, racer, truck — each with its own handling and a fully synthesized engine voice (Web Audio gearbox, zero audio files)
🕰️ Git timelapsepress T — the camera orbits while the city rebuilds itself commit by commit, activity-weighted so busy months get their moment
🏁 Race modepress R — 3-2-1-GO through 8 glowing checkpoint gates, best time saved per repo
🪙 Coin runpress G — collect every coin, 5 hearts, crashing into a building costs one
📸 Share cardpress P — a cinematic 1600×900 PNG + an 8-second WebM clip of your city growing from nothing
🤖 AI landmarksoptional: an LLM reads the repo's stats and crowns 4–6 buildings with golden monument signs + a city motto
📖 Read in-citydrive up to any building and press E to open the file right there

Everything runs on exactly two dependencies: three.js and vite.

🚀 Quick start

git clone https://github.com/FirasLatrech/CodeCity
cd CodeCity
npm install
npm run dev        # → http://localhost:8137

Paste any public GitHub repo URL on the landing page. The server fetches it without a full clone — the tree streams in as a tarball while a blob-less bare clone brings commit history (metadata only, no file contents; usually 5–15% of a real clone) — then analyzes everything and drops you at the city gate at /<repo-name>.

Already have the repo locally? Skip the clone:

node analyze.mjs /path/to/repo    # bakes public/cities/<name>.json
# then open http://localhost:8137/<name>

Optional: AI city planner

echo 'GROQ_API_KEY=your_key' > .env.local

With a (free) Groq key set, each analyzed city gets AI-picked landmarks and a motto. The key never leaves the server. No key → the city simply has no monuments.

Deploying it publicly

If you host CodeCity for others, set two things in .env.local:

GITHUB_TOKEN=ghp_...   # lifts the GitHub API limit from 60 to 5000 req/h (analyzes/hour)
GROQ_API_KEY=...       # optional, as above

Built-in scale guards handle the rest: identical concurrent requests share one build, at most 4 repos analyze at once (extras get a "try again" 503), the analyzer runs in a child process so a huge repo never freezes other visitors, and the on-disk clone cache is capped at 40 repos (oldest evicted — the baked cities stay). For serious traffic, front it with a real job queue and a CDN on /cities/*.json.

🎮 Controls

KeyAction
W A S D / arrowsdrive
Shiftboost
Cchange car
Eread the nearest file
Tgit-history timelapse
Rrace mode
Gcoin run
Pshare card + clip
Mmute

🧠 How it works

Two strictly separated halves:

  1. The analyzer (analyze.mjs, stdlib-only Node) walks the tree, counts lines with a single byte-scan, runs one pass of git log for per-file commits / age / authors, resolves avatars (GitHub noreply → avatar URL, others → gravatar, with a GitHub API fallback for work emails), computes the squarified treemap layout, and bakes it all into one city.json.
  2. The renderer (src/, three.js) never touches git or the filesystem — it just draws the baked JSON. Buildings and plates are instanced meshes, the city's shadow map is baked once, and quality auto-scales (resolution → MSAA → bloom) to hold the frame rate.

Big repos stay fast by design: only the ~3,500 biggest files are kept, history parsing caps at 50k commits, and cities over 1,500 buildings skip the AI call. True giants (linux is 6 GB of git) also skip the history download — the tarball alone builds the city in about a minute; those cities just have no commit glow or timelapse (clone locally and run node analyze.mjs if you want a monster with history).

node analyze.mjs --check   # analyzer self-test

📄 License

MIT


Built by Firas Latrach · inspired by every codebase that deserved to be a skyline