USA Civ

USA Civ clone · Strategy map app · from our videos on X

USA Civ turns the United States into a Civilization-style strategy map built from real public data. Pan and zoom across snowy Rockies, forests and farmland, with a banner on every metro showing its people, GDP and growth. Flip between 19 lenses like income, degrees and population, tap any city to open its City View with its workforce and districts, and light up the 40 biggest freight routes. Hit Tour for a 30-second cinematic flyover of the whole country.

  • iPhone · Swift
  • Built in 1 prompt
  • Free to remix
USA Civ, strategy map app built with Vibecode
Remix this template

Remix copies the working app into your account for free, exactly as we built it. It runs in Vibecode's cloud iOS simulator, in your browser.

Watch the video on X@ios_app_builder · Nov 26, 2026

The prompt that builds it

We built USA Civ in one prompt. Paste it into a new app to build your own copy, or change it first.

Prompt · 1,692 words

[image attached][image attached][image attached][image attached][image attached][image attached][image attached][image attached][image attached][image attached]
Clone this app exactly as a native iPhone app: Andrej Karpathy's "USA Civ", the United States as a Civilization-style strategy map built from real public data. Reference: https://x.com/karpathy/status/2125779541952246039 (the live web version is https://karpathy.ai/usaciv/). The 10 attached screenshots are frames of its 30-second trailer, in order. Inspect every one of them carefully before writing code and match the look: the hex art, the city banners, the gold serif captions, the legend cards, the San Jose panel and the glowing trade arcs.

Build a native SwiftUI iOS app named USA Civ using Opus 5.5. LANDSCAPE ONLY (landscape left and right in Info.plist / the target's supported orientations, no portrait), full screen, status bar hidden, dark. Do NOT put a fake device frame inside the app. Do not publish externally.

REAL DATA (do this first). The original's data is public JSON. Download these into the app bundle (e.g. workspace ios/.../Resources/Data/) with curl and parse them with Codable at launch, off the main thread:
https://karpathy.ai/usaciv/data/world.json (hex grid: grid.radius 25, cols 117, rows 90, width 5002, height 3301.7, margin 200; per-cell arrays of 10,530: owner = state index or -1, county, elev, elev_max, water, relief, cover, pct.{forest,crop,pasture,grass,shrub,wetland,developed}; tables.{water,relief,cover} name the codes)
https://karpathy.ai/usaciv/data/cities.json (id, name, full, states, metro, capital, x, y, cell, population, yields{food,production,gold,science,culture}, jobs{...}, employed, median_income, ...)
https://karpathy.ai/usaciv/data/lenses.json (19 lenses: id, group, name, unit, format, scale, ramp, description, values[10530], domain)
https://karpathy.ai/usaciv/data/states.json, trade.json (40 routes with rank, value_musd, dist_km, path; zones), infrastructure.json, military.json, wonders.json, resources.json, nation.json
The site's renderer is plain JS you can read for exact hex geometry, colours, terrain glyphs, banner layout and lens ramps: https://karpathy.ai/usaciv/js/main.js and the modules it imports (js/world.js, js/terrain.js, js/color.js, js/camera.js, js/render/map.js, js/render/banners.js, js/render/art/terrain.js, js/render/art/city.js, js/render/art/water.js, js/render/art/lod.js, js/render/overlays.js, js/ui/lenses.js, js/ui/cityPanel.js, js/ext/layers/index.js, js/ext/cityView/index.js) and https://karpathy.ai/usaciv/css/style.css. Port the drawing faithfully to Swift (Core Graphics / SwiftUI Canvas). The label font is Palatino (bold, small caps for city names); body text is the system sans.

THE MAP (the core, make it beautiful and smooth):
- Pointy/flat hexes exactly as world.js lays them out, on a deep navy ocean (#0d2a4a to #123a63, with a lighter shallow-water band and faint wave marks along coasts), Canada/Mexico land dimmed dark grey, the Great Lakes blue.
- Terrain from the real data, Civ style: snowy white-capped mountain glyph clusters in the Rockies, Sierra and Cascades; dark green conifer and round deciduous tree glyphs in forests; tan desert/shrub hexes with small rock and mesa glyphs; light-green grassland; checkerboard farmland (yellow/green/brown patches) in crop hexes; hills as soft mounds; rivers as thin blue lines. State borders as thin coloured edge lines (each state's own colour, like the red/teal borders in the screenshots).
- Cities: isometric little city-block glyphs (grey/white/red/blue buildings) on each metro hex, bigger for bigger metros (New York's hex is a dense tall cluster). City banners exactly like the screenshots: a dark navy rounded pill with a coloured population chip on the left ("20M" with a small up-chevron), the name in Palatino small caps ("New York"), a growth % in green ("+2.1%") and a round emblem on the right; big metros get a second row of yields with tiny icons: green wheat (food) 15.5K · orange gear (production) 1.1M · gold coins (gold) 2.44T · blue flask (science) 1.5M · purple mask (culture) 252K; and a small tag tab above the pill ("FINANCE CAPITAL", "TECH CITY", "KNOWLEDGE CITY", "MILITARY TOWN", "FINANCE CITY"). Smaller cities get the one-row pill only. Show banners by zoom level so they never pile up.
- PERFORMANCE: pre-render the terrain into cached bitmap tiles at 3-4 zoom levels (in a background task at launch, show a short loading state), then pan/zoom by compositing tiles so pinch, pan, and programmatic camera flights run at 60 fps. Draw banners, highlights, arcs and HUD live on top.
- Gestures: one-finger pan, pinch zoom (whole US down to ~8 hexes across the screen), double-tap to zoom in, tap a city banner or city hex to open the City View.

LENSES: a compact lens dock at the bottom (icons for the 19 lenses in their groups; tap to apply, tap again for Terrain). Applying a lens recolours every land hex by that lens's values and ramp with a quick cross-fade, keeping state outlines and city dots. A legend card at top right like the screenshots: dark navy card with a thin gold border, round gold-ringed icon, the lens name in Palatino caps, its unit line, a gradient bar and the min/max labels. Exact cards for the three the trailer shows:
- INCOME, "median household income, $", ramp dark brown -> gold -> pale cream, "≤ $41K" ... "≥ $110K"
- DEGREES, "adults 25+ with a bachelor's degree or higher", ramp deep navy -> blue -> white, "≤ 12%" ... "≥ 51%"
- POPULATION, "people / km²", ramp black-purple -> magenta -> orange -> pale yellow (plasma), "0 /km²" ... "≥ 390 /km²"

CITY VIEW (tap a city): the camera centres the city on the left half, its metro hexes get a glowing green outline and lighter fill, district medallions sit on their hexes (a blue circle with a graduation cap labelled "Campus ×2.8", a brown circle with a factory labelled "Industry ×1.4", plus "≈748K ● 69%" style chips), and a right-side panel slides in. For San Jose it reads exactly: "SAN JOSE" (big gold Palatino caps) with a blue "TECH CITY" pill; "San Jose-Sunnyvale-Santa Clara, CA Metro Area"; three stats "1.98M PEOPLE", "$442B GDP 2024", "$166,364 MEDIAN INCOME"; "CITIZENS · WORKFORCE", "Glowing: engineers, coders & scientists"; a row of 20 grey person icons for "San Jose  1 in 4 workers" with 5 of them glowing teal/gold, and a row for "United States  1 in 14 workers" with 1 glowing; "DISTRICTS": "Campus  ≥2.8× the U.S. share of jobs · led by computer services" and "Industrial zone  1.4× the U.S. share of jobs · led by semiconductors"; footer "Census ACS 2025 1-year · BEA GDP · BLS QCEW 2025 annual averages". Build the same panel for every city from its data. A close button returns to the map.

LAYERS: a layers button toggles Interstates & railroads (thin tan double lines and dotted rail), ports and airports (small round icons), military sites, wonders, and Trade routes: the 40 largest freight flows from trade.json drawn as glowing cream/gold arcs with small light dots flowing along them, thickness by value.

TOUR (the trailer, played live in the app; this matters most). A "▶ Tour" button (top right, small) plays this exact 30-second cinematic sequence, with all other UI hidden, smooth eased camera flights, and captions bottom-left in the trailer's style: a short gold rule + a tracked small-caps gold label, a large gold-gradient Palatino headline, a white bold sans line, a grey source line, over a soft dark gradient. Times in seconds:
0.0-3.2 Title card over the whole US (map dimmed, vignette, slow push-in): a small round navy medallion with a white star, "THE UNITED STATES" in large gold Palatino caps with wide tracking, a thin gold rule with a diamond, then italic "as a strategy game — built from real public data". Fades out 3.0-3.4.
3.3-5.5 Fly to the Colorado Rockies (Denver, Colorado Springs, Grand Junction, Cheyenne, Fort Collins, Greeley, Pueblo, Salt Lake City, Provo in view, about 16 hexes across the screen), slow drift right. Caption: TERRAIN / Every hex from real data / Elevation and land cover paint the map / NOAA ETOPO1 · USGS NLCD 2021
5.6-10.2 Cut to the Northeast (Scranton, Allentown, Philadelphia, New York, Bridgeport, New Haven), zooming in from ~26 to ~14 hexes across onto New York; at 7.3 a gold ring pulses around New York and the caption appears: CITIES / New York / $2.44 trillion GDP · 20.1 million people / Metro GDP: BEA 2024 · population: Census ACS 2025 1-year
10.3-15.5 Cross-fade to the whole contiguous US filling the screen. Lenses with the legend card top right: INCOME 10.3-11.9, DEGREES 12.0-13.5, POPULATION 13.5-15.5, each a quick cross-fade. Caption: LENSES / 19 lenses / Colour the map by income, degrees, broadband, faith… / Income: Census ACS 5-year 2024 (the source line follows the lens: "Degrees: Census ACS 5-year 2024", "Population: Census ACS 5-year 2024").
15.6-19.6 Dissolve to the Pacific Northwest (Seattle, Tacoma, Olympia, Portland, ~18 hexes across) with interstates and railroads drawn. Four badges stack at top left, one at a time at 16.6, 17.3, 18.0 and 18.7 (dark navy pills with a gold ring, round icon, gold Palatino title, small white subtitle): "Interstates & railroads" / "Natural Earth v5.1.2"; "U.S.: 136 ports · 368 airports" / "Ranked by USACE tonnage and FAA boardings"; "660 military sites nationwide" / "DoD MIRTA FY2025"; "52 wonders nationwide" / "Top parks by visits, R&D universities, landmarks". They fade out at 19.4.
19.6-21.3 Pan south down the West Coast (Oregon to Northern California).
21.3-24.5 San Jose City View exactly as above, panel on the right.
24.5-25.0 Fast whip pan east with motion blur.
25.0-27.3 Trade routes over the eastern US, zooming out to the whole country: glowing arcs with flowing dots. Caption: TRADE ROUTES / 40 largest interstate freight flows / #1: New York ↔ Boston (306 km), $61.9 billion a year / Between states, 250 km+ apart · Freight Analysis Framework FAF5.7.1, 2024
27.4-30.0 End card over the whole map with the arcs: medallion, "THE UNITED STATES", rule, "as a strategy game — built from real public data", then gold sans "31 public data sources · every number traceable" and white bold "data: karpathy.ai/usaciv". Then the UI returns.
The app also opens on the title card for 2 seconds, then fades into the interactive map showing the whole US.

Keep every file you create inside /home/user/workspace (data, fonts, scripts): tool access to /tmp and other paths outside the workspace is denied in this sandbox.

Work in small steps so progress lands incrementally: data download + Codable models, then the hex map renderer with tiles and gestures, then banners, then lenses + legend, then City View, then layers + trade arcs, then the Tour. Keep SwiftUI view bodies small. Build, run compile validation, resolve every error, and launch it in the simulator. Deliver the complete implementation, not a plan.
All templates