Design an Electric-Vehicle Charging Platform
Coordinate charging sessions, energy billing, stall telemetry, and fresh geospatial availability across intermittently connected stations.
Problem statement
Design a vehicle-charging-station platform. The reported interview requires three capabilities: bill a driver from delivered energy, retain long-term stall health and telemetry, and let a screen or in-car client find the nearest currently available station with its price.
Follow-up discussion covers routing, secure station communication, name resolution, local buffering, and synchronous versus asynchronous paths.
For this exercise, assume each station and connector has a registered identity, publishes monotonically sequenced meter and health observations, and can buffer signed observations while disconnected.
A charging session pins a pricing version at authorization, becomes billable only from a validated start and final meter reading, and produces at most one charge. Availability search is a freshness-bounded advisory snapshot; the station must revalidate a connector before starting a session.
Design station enrollment and communication, session state, metering and billing, telemetry retention, geospatial availability, offline buffering, recovery, and observability. Electrical control loops, payment-instrument onboarding, route planning, vehicle firmware, and physical charger design are outside scope.
What to build
- Authorize and track one retry-safe charging session per connector with explicit terminal outcomes.
- Calculate and settle one auditable charge from validated delivered energy and the pinned price version.
- Ingest sequenced health and meter telemetry, retain history, and expose stale or unhealthy connectors.
- Return nearby fresh available connectors with price and freshness metadata for client discovery.
At scale
- For this exercise, assume 50,000 stations, 400,000 connectors, and one health observation per connector every 30 seconds.
- For this exercise, support 5,000 session starts per second at peak and 20,000 nearby-search requests per second.
- For this exercise, healthy availability searches should complete within 500 milliseconds at p95, and observations older than 90 seconds are stale.
- For this exercise, retain raw meter and health evidence for 90 days and hourly health rollups plus billing records for seven years.
- For this exercise, a station reconnecting after at most 24 hours offline should reconcile contiguous buffered evidence and expose authoritative session status within 10 minutes at p95.