Skip to content

evanzyang91/transit-planner

Repository files navigation

Transit Planner

Design smarter cities, one route at a time.

66FE219B-B97C-4352-A529-20B388656D78_1_201_a


Overview

Transit Planner is an AI-powered urban transit design tool for city planners. Draw proposed subway, LRT, or bus routes on a live map of Toronto β€” then watch a council of six Claude agents debate your route in real time, stress-testing it for cost, ridership, community impact, and political risk.

No spreadsheets. No guesswork. Just a map, your cursor, and six AIs arguing about your decisions.

Features

  • Interactive map β€” draw, edit, and delete transit lines on a live Mapbox map of Toronto's full TTC network
  • AI route generation β€” describe a corridor and the AI assistant proposes a route, snapping to real TTC stops
  • AI map assistant β€” ask spatial questions ("where are the network gaps?") and get answers drawn directly on the map
  • 6-agent council β€” structured multi-turn deliberation streams live via SSE as agents debate, rebut, and vote
  • Transit simulation β€” ridership gravity model, travel time scoring, and equity metrics for any proposed network
  • Population & traffic layers β€” PostGIS-backed heatmaps of density, ridership demand, and road congestion
  • Street view β€” preview any proposed stop location at street level
  • Timetable view β€” schedule visualisation for planned routes
  • Agent voice β€” ElevenLabs TTS reads agent quotes aloud during deliberation

How the Council Works

Each council run is a structured 6-turn debate:

Agent Role Model
Alex Chen Ridership Planner β€” advocates for equity and high-density corridors Sonnet
Jordan Park Infrastructure Analyst β€” scrutinises cost and construction feasibility Sonnet
Margaret Thompson NIMBY Resident β€” raises community and neighbourhood concerns Haiku
Devon Walsh PR Director β€” evaluates political risk and public perception Haiku
Alex & Jordan Joint Rebuttal β€” synthesised response to critique Sonnet
Planning Commission Final verdict with binding route modifications Sonnet

Agents use tool calls to query real TTC stop data and enforce planning rules: 800m minimum station spacing, no gaps over 1500m, and transfer stations must justify connections to existing lines.

Tech Stack

Layer Technology
Framework Next.js 15 (App Router), React 19, TypeScript
Styling Tailwind CSS 4
Mapping Mapbox GL, Mapbox GL Draw
3D Three.js / React Three Fiber
AI Anthropic Claude (Haiku 4.5 + Sonnet) Β· Gemini (optional)
Auth Auth0 via NextAuth v5
Database Supabase + PostGIS
Voice ElevenLabs TTS
Deployment Docker, Vercel

Local Development

Prerequisites

Setup

git clone https://github.com/evanzyang91/transit-planner.git
cd transit-planner
npm install

# Copy and fill in environment variables
cp .env.example web/.env.local

# Start the dev server (from repo root or web/)
npm run dev

App runs at http://localhost:3000. Navigate to /map for the planner.

Scripts

All commands can be run from the repo root or web/:

npm run dev            # Next.js + Turbopack
npm run build          # Production build
npm run lint           # ESLint
npm run typecheck      # TypeScript
npm run format:write   # Prettier

Environment Variables

Set these in web/.env.local:

# Required
NEXT_PUBLIC_MAPBOX_TOKEN=pk.ey...
ANTHROPIC_API_KEY=sk-ant-...
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_anon_key
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_KEY=your_service_role_key
AUTH_SECRET=                        # openssl rand -base64 32

# Optional
ELEVENLABS_KEY=                     # agent voice TTS
GEMINI_API_KEY=                     # alternative AI provider
AI_PROVIDER=anthropic               # "anthropic" (default) or "gemini"
DISCORD_WEBHOOK_URL=                # fallback/general Discord notifications
DISCORD_REGULAR_VISITS_WEBHOOK_URL= # regular visit notifications
DISCORD_REFERRAL_VISITS_WEBHOOK_URL= # referral visit notifications
DISCORD_BUG_REPORTS_WEBHOOK_URL=    # bug report feedback notifications

Project Structure

transit-planner/
β”œβ”€β”€ web/
β”‚   └── src/
β”‚       β”œβ”€β”€ app/
β”‚       β”‚   β”œβ”€β”€ map/                # Main planner page
β”‚       β”‚   β”œβ”€β”€ timetable/          # Route schedule view
β”‚       β”‚   β”œβ”€β”€ docs/               # Documentation + AI chat
β”‚       β”‚   └── api/                # API routes (council, simulation, AI, data)
β”‚       β”œβ”€β”€ server/                 # Council orchestration, AI providers, Supabase
β”‚       └── lib/                    # Shared utilities
β”œβ”€β”€ can_pop.geojson                 # Canadian population dataset (90MB)
β”œβ”€β”€ Dockerfile.web
β”œβ”€β”€ docker-compose.yml
└── vercel.json

Contributing

PRs are welcome. For anything beyond small fixes, open an issue first.

License

MIT

About

πŸš‡ Build your own transit infrastructure with AI insights and comprehensive data

Resources

Stars

22 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages