Web App · Personal Data Lab

Tesla Fleet Telemetry API, PostgreSQL Pipeline & Live Geospatial Web App

OAuth2 + ECDSA P-256 virtual key pairing, PostGIS time-series ingestion, and real-time vehicle map cockpit

Tesla Fleet Telemetry API, PostgreSQL Pipeline & Live Geospatial Web App
By: Chiyul Song
Tesla Fleet API • PostgreSQL (PostGIS) • Next.js • Mapbox GL
Executive Abstract
Target Ecosystems: IoT Telemetry Engineering • Geospatial Web Applications

End-to-end engineering of a personal vehicle telemetry platform: configuring the Tesla Fleet Telemetry API, streaming sensor ticks into PostgreSQL/PostGIS, and building a Next.js geospatial visualization web app.

2-Part Personal Telemetry Lab · Part 1 of 2 (Engineering & Web App)

Looking for the energy regression models and charging/driving decisions built on top of this pipeline?

Read Part 2: Decision Analytics

The Core Business Problem

Accessing granular real-time vehicle sensor data (GPS coordinates, instantaneous kW power draw, battery pack temperature, elevation, and sleep states) requires navigating Tesla’s strict Fleet API security architecture (OAuth2 + ECDSA P-256 virtual key pairing) and handling high-frequency time-series storage without waking the car when parked.

Engineered Architecture & Solution

Built a 3-stage production architecture: (1) Registered a Tesla Developer application with `.well-known` public key hosting and mTLS/Webhook telemetry streaming, (2) Designed a partitioned PostgreSQL + PostGIS database (`vehicle_telemetry_ticks` & `drive_sessions`) with Haversine elevation-grade enrichment and sleep-aware polling backoff, and (3) Shipped a Next.js + Mapbox GL web application that renders color-coded `Wh/km` route polylines and live vehicle state.

Interactive Web App Preview (Mock Telemetry Dataset)

Tesla Fleet Telemetry — Geospatial Drive & Power Explorer

Route Distance & Time
18.4 km
26 mins (42.5 km/h avg)
Energy Efficiency
129 Wh/km
7.8 km / kWh
Battery SoC Delta
80% ➔ 76%
Regen Recovered: +0.82 kWh
Ambient & Elevation
19°C
Elevation Gain: +48m
Seoul (Gangnam) ➔ Pangyo Tech ValleyPostGIS Polyline Overlay
CruisePower Draw (+kW)Regen Braking (-kW)
Sampled DB Telemetry Tickstesla_telemetry_ticks
08:10Gangnam Station
34 km/h+9.2 kW80%
08:18Yangjae IC Entry
88 km/h+16.4 kW78.8%
08:27Gyeongbu Expressway
98 km/h+14.1 kW77.3%
08:36Pangyo IC Exit (Regen)
45 km/h-18.5 kW76%
System Architecture

From Vehicle Sensor Stream to Next.js Geospatial Web App

Stage 01 • Vehicle Auth & Telemetry Stream

Tesla Fleet Telemetry API & Virtual Key Pairing

Registered a developer application on the Tesla Developer Portal, generated an ECDSA P-256 public/private key pair hosted at /.well-known/appspecific/com.tesla.3p.public-key.pem, and paired the virtual key to the vehicle to stream real-time telemetry fields (Location, DriveState, ChargeState, ClimateState).

Stage 02 • Time-Series & Spatial Persistence

PostgreSQL / Supabase Schema & Trip Segmentation

Raw telemetry packets arrive every 2–5 seconds while driving. An ingestion worker normalizes voltage × current into instantaneous power (kW), detects shift_state transitions (P ➔ D/R ➔ P) to automatically segment discrete trips, and writes spatial coordinates into PostgreSQL.

Stage 03 • Full-Stack Geospatial Web App

Next.js App Router + Interactive Map & Telemetry Cockpit

Built a responsive Next.js dashboard that queries aggregated trip summaries and renders color-coded GPS polylines on a map (green = regenerative braking, blue = optimal cruise, red = high-power acceleration/climb) alongside synchronized speed and battery SoC charts.

Technologies & Protocols

Tesla Fleet Telemetry APIOAuth2 & ECDSA P-256PostgreSQL & PostGISNext.js (App Router)TypeScriptMapbox GL / Deck.gl