[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-108946":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":15,"stars7d":15,"stars30d":16,"stars90d":15,"forks30d":15,"starsTrendScore":15,"compositeScore":17,"rankGlobal":10,"rankLanguage":10,"license":18,"archived":19,"fork":19,"defaultBranch":20,"hasWiki":21,"hasPages":19,"topics":22,"createdAt":10,"pushedAt":30,"updatedAt":31,"readmeContent":32,"aiSummary":33,"trendingCount":15,"starSnapshotCount":15,"syncStatus":34,"lastSyncTime":35,"discoverSource":36},108946,"transmilenio-live","croma-labs\u002Ftransmilenio-live","croma-labs","Every TransMilenio bus in Bogotá, moving on one live map. Built on the Croma API.","https:\u002F\u002Ftransmi.usecroma.com",null,"TypeScript",68,8,1,0,12,44.06,"MIT License",false,"main",true,[23,24,25,26,27,28,29],"bogota","croma","gtfs-realtime","maplibre","nextjs","shadcn","transmilenio","2026-11-11 19:55:48","2026-11-14 08:45:31","\u003Cdiv align=\"center\">\n\n\u003Cpicture>\n  \u003Csource media=\"(prefers-color-scheme: dark)\" srcset=\"public\u002Fcroma_brand_white.svg\">\n  \u003Cimg alt=\"Croma\" src=\"public\u002Fcroma_brand_black.svg\" height=\"26\">\n\u003C\u002Fpicture>\n\n# TransMilenio en vivo\n\n**Every bus in Bogotá, moving on one map, right now.**\n\nA live map of Bogotá's public transport built on the [Croma API](https:\u002F\u002Fdocs.usecroma.com\u002Fguides\u002Fcolombia\u002Ftransmilenio): the whole TransMilenio fleet gliding across the city, the next buses at any station, and the path of any route, from four endpoints and one API key.\n\n**[Open the live map →](https:\u002F\u002Ftransmi.usecroma.com)**\n\n[![Deploy with Vercel](https:\u002F\u002Fvercel.com\u002Fbutton)](https:\u002F\u002Fvercel.com\u002Fnew\u002Fclone?project-name=transmilenio-live&repository-name=transmilenio-live&repository-url=https%3A%2F%2Fgithub.com%2Fcroma-labs%2Ftransmilenio-live&env=CROMA_API_KEY&envDescription=CROMA_API_KEY+reads+TransMilenio+through+Croma+%28free+to+get%29.&envLink=https%3A%2F%2Fplatform.usecroma.com%2Fsign-up)\n&nbsp;\n[![Get your Croma API key](public\u002Fcroma-api-key-badge.svg)](https:\u002F\u002Fplatform.usecroma.com\u002Fsign-up)\n\n\u003Cbr \u002F>\n\n\u003Cimg alt=\"Every TransMilenio bus on the map of Bogotá\" src=\"public\u002Fscreenshot.jpg\" width=\"100%\">\n\n\u003C\u002Fdiv>\n\n---\n\n## What's inside\n\n- **The whole fleet, live**: every bus on the network, from about 1,500 late at night to close to 8,000 at rush hour, read from `vehicles` and drawn on the map. A new snapshot lands every 15 seconds and each bus glides from its last reported position to the new one instead of jumping.\n- **Trails**: the last six positions of each bus, so the city's corridors draw themselves as the fleet moves.\n- **Any route**: type a code (`L18`, `B10`, `H710`) and its buses light up while the rest of the fleet dims. The route's path comes from `route` with `include_geometry`, and the map flies to it.\n- **Any station**: click one for the next buses from `stop-arrivals`, with minutes away and how late or early each one runs, refreshed every 20 seconds.\n- **Any bus**: click one for its route, the stop it is heading to, its plate and its last report. **Seguir bus** keeps the camera on it as it moves.\n- **Time slider**: switch to **Horario programado** and drag through the day, or press play to watch it run at two minutes a second. Every bus is placed where TransMilenio's published timetable says it should be at that minute, on weekdays, Saturdays or Sundays and holidays. It is labeled as the timetable, never as live, and it keeps working when the live feed stops.\n- **Recording mode**: press `R`. The panels go, the camera tilts and turns slowly over the city, and a large live counter takes the corner. Built for screen recordings and social posts.\n- **A live API inspector**: every call the server makes, its status and latency, and a ready-to-run cURL.\n- **One snapshot for everyone**: the server reads the fleet once every 15 seconds and every visitor shares it, so the API is called the same number of times whether one person watches or a thousand. The API key never reaches the browser.\n- **Validated end to end**: Zod checks every query parameter before it reaches the API and every API response before it reaches the map.\n- **Crafted UI**: [shadcn\u002Fui](https:\u002F\u002Fui.shadcn.com) on the same ruled-sheet design system as the [Croma Chat Template](https:\u002F\u002Fgithub.com\u002Fcroma-labs\u002Fcroma-chat-template): hairline rails, mono eyebrow labels, square surfaces, Croma blue. The map is [MapLibre](https:\u002F\u002Fmaplibre.org) on CARTO basemaps, in dark and light, on desktop and mobile.\n\n## One-click deploy\n\n1. Click **Deploy with Vercel** above.\n2. Grab a free API key with the **Get your Croma API key** button (sign-up takes a minute).\n3. Paste your `CROMA_API_KEY` when Vercel asks for env vars.\n4. Done. Your map is live.\n\n## Running locally\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fcroma-labs\u002Ftransmilenio-live\ncd transmilenio-live\nnpm install\n\ncp .env.example .env.local\n# fill in CROMA_API_KEY\n\nnpm run dev\n```\n\nOpen [http:\u002F\u002Flocalhost:3000](http:\u002F\u002Flocalhost:3000), type `L18` in the route search, then press `R`.\n\n## Environment variables\n\n| Variable                   | Required | Description                                                                              |\n| -------------------------- | -------- | ---------------------------------------------------------------------------------------- |\n| `CROMA_API_KEY`            | ✅       | Reads TransMilenio through Croma. [Get one free →](https:\u002F\u002Fplatform.usecroma.com\u002Fsign-up) |\n| `CROMA_API_URL`            | optional | API base override. Defaults to `https:\u002F\u002Fapi.croma.run`.                                  |\n| `UPSTASH_REDIS_REST_URL`   | optional | Limits station and route lookups per IP. [Upstash Console →](https:\u002F\u002Fconsole.upstash.com\u002F) |\n| `UPSTASH_REDIS_REST_TOKEN` | optional | Pairs with the URL above.                                                                |\n\n## How it works\n\n```\napp\u002Fapi\u002Ffleet\u002Froute.ts       The shared fleet snapshot (every page of vehicles, merged)\napp\u002Fapi\u002Fstations\u002Froute.ts    The stations on the map, kept for six hours\napp\u002Fapi\u002Farrivals\u002Froute.ts    The next buses at one station\napp\u002Fapi\u002Froute\u002Froute.ts       One route's path and stops\napp\u002Fapi\u002Fschedule\u002Froute.ts    Every bus at one minute of the published timetable\nlib\u002Fschedule.ts              Reads the compiled timetable and places each trip between its stops\nscripts\u002Fbuild-timetable.ts   Compiles TransMilenio's GTFS.zip into data\u002Ftimetable\nlib\u002Ftransit.ts               The calls to Croma, and the snapshots every visitor shares\nlib\u002Fcroma.ts                 POST to Croma, validate with Zod, record a trace for the inspector\nlib\u002Fschemas.ts               Zod schemas for every response and query parameter\ncomponents\u002Fbus-map.tsx       The map: layers, the glide between snapshots, trails, clicks, camera\ncomponents\u002Flive-app.tsx      Page state: route focus, selection, recording mode, mobile layout\ncomponents\u002Fpanels.tsx        Live counter, route search, legend, bus card, inspector\ncomponents\u002Fstation-sheet.tsx Next buses at a station\n```\n\nEvery 15 seconds:\n\n1. The browser asks `\u002Fapi\u002Ffleet`. If this server read the fleet in the last 15 seconds, every visitor gets that same snapshot; a request already in flight is joined, not repeated.\n2. Otherwise the server reads page 1 of `POST \u002Fco\u002Ftransmilenio\u002Fvehicles\u002Fv1` (500 buses a page), then every other page in parallel, and merges them into one compact list, with each route's code, name and system listed once.\n3. The map starts a glide from where every bus is drawn now to its new position, and appends that position to the bus's trail.\n\nThe calls behind it:\n\n| Endpoint                                 | Used for                                       |\n| ---------------------------------------- | ---------------------------------------------- |\n| `POST \u002Fco\u002Ftransmilenio\u002Fvehicles\u002Fv1`      | Every bus on the network, 500 per page         |\n| `POST \u002Fco\u002Ftransmilenio\u002Fstops-search\u002Fv1`  | The stations on the map, with `kind: \"station\"` |\n| `POST \u002Fco\u002Ftransmilenio\u002Fstop-arrivals\u002Fv1` | The next buses at a station                    |\n| `POST \u002Fco\u002Ftransmilenio\u002Froute\u002Fv1`         | A route's path, with `include_geometry: true`  |\n\n```bash\ncurl https:\u002F\u002Fapi.croma.run\u002Fco\u002Ftransmilenio\u002Fvehicles\u002Fv1 \\\n  -H \"Authorization: Bearer $CROMA_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"route\": \"L18\"}'\n```\n\n### The timetable\n\nThe time slider does not call the API. `npm run timetable` downloads TransMilenio's public GTFS feed (`GTFS.zip`, about 190 MB, nine million stop times) and compiles it into `data\u002Ftimetable`: one gzipped binary per day type with each trip's route, its stops and the seconds between them, plus a `meta.json` with routes, stops and the holidays that run Sunday's timetable. That is about 15 MB, committed so a deploy needs no build step. Rebuild it when TransMilenio publishes a new timetable.\n\n`\u002Fapi\u002Fschedule?minute=450&day=weekday` loads the day once per server instance, then for each trip running at that minute finds the two stops it is scheduled between and places the bus on the straight line between them. Trips that run past midnight count for the early hours. Answers are cached for an hour, since the timetable is the same every week. TransMiCable cabins, which the feed lists by frequency instead of by trip, are left out.\n\n## Customization\n\n- **Refresh rate**: the snapshot lifetime in `lib\u002Ftransit.ts` and the poll in `components\u002Flive-app.tsx`. The network itself refreshes positions about every 20 seconds, so faster polling only repeats the same positions.\n- **Colors and labels per system**: `lib\u002Fsystems.ts`.\n- **The glide, trails and camera**: `GLIDE_MS`, `TRAIL_POINTS` and the recording-mode orbit in `components\u002Fbus-map.tsx`.\n- **Basemap**: the two style URLs at the top of `components\u002Fbus-map.tsx`. Any MapLibre style works.\n- **Look & feel**: design tokens in `app\u002Fglobals.css` (`--line` hairlines, `--agent` accent, square radius; shadcn\u002FTailwind v4).\n\n## Production notes\n\n- The fleet is never rate limited: it is one shared snapshot, so traffic does not change how often the API is called. Station and route lookups each cost a call, so with Upstash set they are limited to 60 per 10 minutes per IP.\n- The snapshot lives in each server instance's memory. On Vercel's Fluid Compute instances are reused, so a busy deploy still reads the fleet about once every 15 seconds per instance.\n- Polling pauses while the tab is hidden and resumes the moment it is visible again.\n- Arrivals are estimated from the last stop each bus reported plus the scheduled running time from there; each one says whether it is `estimated` or `predicted`.\n\n## Learn more\n\n- [TransMilenio on Croma](https:\u002F\u002Fdocs.usecroma.com\u002Fguides\u002Fcolombia\u002Ftransmilenio): all eight endpoints, schedule and live, with schemas\n- [Croma docs](https:\u002F\u002Fdocs.usecroma.com): every source, with schemas\n- [Croma MCP](https:\u002F\u002Fplatform.usecroma.com\u002Fmcp): ask Claude, ChatGPT or Cursor when the next bus comes\n- [Croma Chat Template](https:\u002F\u002Fgithub.com\u002Fcroma-labs\u002Fcroma-chat-template) · [DIAN Playground](https:\u002F\u002Fgithub.com\u002Fcroma-labs\u002Fdian-facturacion-example)\n\n## License\n\n[MIT](LICENSE). Transit data from TransMilenio S.A. via Croma. Basemap © [CARTO](https:\u002F\u002Fcarto.com\u002Fattributions), © [OpenStreetMap](https:\u002F\u002Fwww.openstreetmap.org\u002Fcopyright) contributors.\n","这是一个实时可视化哥伦比亚波哥大TransMilenio快速公交系统（BRT）全车队运行状态的Web应用。项目基于Croma API接入GTFS-realtime数据流，实现每15秒更新一次的车辆位置平滑动画、历史轨迹绘制、线路高亮、站点到站预测、单辆巴士追踪、时刻表模拟回放及录屏优化模式；前端采用Next.js与Maplibre构建高性能交互地图。适用于本地通勤者实时查车、交通研究者分析客流动态、城市规划人员评估路网效率，以及公众媒体制作交通可视化内容。",2,"2026-11-24 04:35:23","CREATED_QUERY"]