A navigation web app optimized for Tesla's in-car browser. Built with Next.js 16 (App Router), React 19, TypeScript 5, and Tailwind CSS 4.
Live at teslanav.com
License: Free for personal, non-commercial use. See LICENSE for details.
# Clone the repository
git clone https://github.com/your-username/teslanav.com.git
cd teslanav.com
# Install dependencies
bun install
# Copy environment variables
cp .env.example .env.local
# Fill in the required values in .env.local
# Start the development server
bun run dev
Open http://localhost:3000 in your browser.
Add ?dev=true to the URL to enable tile bounds debug overlay and verbose logging.
bun run dev # Start dev server (http://localhost:3000)
bun run build # Production build
bun run start # Start production server
bun run lint # Run ESLint
bunx tsc --noEmit # Type check
Create a .env.local file with the following:
# Mapbox — map rendering + directions API
# Get your token at https://account.mapbox.com
NEXT_PUBLIC_MAPBOX_TOKEN=pk.eyJ1...
# Upstash Redis — server-side caching and rate limiting
# Create a database at https://console.upstash.com
UPSTASH_REDIS_REST_URL=https://...upstash.io
UPSTASH_REDIS_REST_TOKEN=...
# PostHog — analytics (optional)
# https://posthog.com
NEXT_PUBLIC_POSTHOG_KEY=phc_...
NEXT_PUBLIC_POSTHOG_HOST=https://us.posthog.com
# Vercel Blob — GPX recording storage
# https://vercel.com/docs/storage/vercel-blob
BLOB_READ_WRITE_TOKEN=vercel_blob_...
# LocationIQ — geocoding/search
# Get a free key at https://locationiq.com
LOCATIONIQ_API_KEY=pk....
# Inbound — feedback emails and admin alerts (optional)
# https://inbound.new
INBOUND_API_KEY=...
# Admin dashboard — protects /api/admin/* routes
ADMIN_API_KEY=your-secret-key
Only NEXT_PUBLIC_MAPBOX_TOKEN is strictly required to run the map. Other services degrade gracefully when keys are absent (search, alerts, and recording will not function).
bun run build
bun run start # Runs on port 3000
Set PORT to override the default port. All environment variables must be available at runtime.
/api/tiles and are cached in Vercel Blob. If you are not on Vercel, you can skip BLOB_READ_WRITE_TOKEN — tiles will fall back to direct Mapbox requests without caching./admin with the ADMIN_API_KEY header (or use the UI) to monitor API usage against monthly limits.app/api/ # Server-side API routes (Next.js Route Handlers)
directions/ # Mapbox Directions (multi-route)
geocode/ # LocationIQ forward + reverse geocoding
waze/ # Waze alerts proxy with Redis cache
speedcameras/ # OSM Overpass speed camera data
tiles/ # Mapbox tile proxy with Blob cache
recording/ # GPX file storage via Vercel Blob
feedback/ # User feedback emails via Inbound
admin/usage/ # API usage stats + threshold alerts
components/ # React UI components
hooks/ # Custom React hooks (data fetching, GPS, GPX)
lib/ # Shared utilities (Redis, PostHog, GPX, cn())
types/ # TypeScript interfaces
public/sw.js # Service worker — offline tile cache
All external API calls go through server-side route handlers to keep API keys off the client. Results are cached in Redis (60 s – 24 h depending on data type) to minimize upstream usage.
Pull requests are welcome. Please run bun run lint and bunx tsc --noEmit before submitting. There is no automated test suite — validate changes manually in the browser, ideally in a Tesla browser or a Chromium-based mobile browser in touch emulation mode.
This project is licensed under the PolyForm Noncommercial License 1.0.0.
You are free to fork, modify, and use this software for personal, non-commercial purposes (hobby projects, self-hosting for personal use, learning, experimentation). You may not use it to build a competing product, offer it as a service, or use it in any commercial context.
$ claude mcp add teslanav.com \
-- python -m otcore.mcp_server <graph>