Shahn, Peer-to-Peer EV Charging Marketplace
Streamathon, KFUPM
Peer-to-peer EV charging marketplace turning idle home chargers into income. Hosts list their charger and set hours and price; drivers find them on the map, book, and pay through Stream, all built in under 24 hours.
Streamathon build, private repository

Key Metrics
Problem
Public EV charging works when you live near one, but most people don't, and range anxiety for early adopters in residential neighborhoods is less about battery size and more about not knowing where they'll charge tomorrow morning. Meanwhile homeowners with private chargers have idle capacity most of the day with no way to monetize it or vet who's plugging in.
My Role
Team lead for a 5-person team at KFUPM's Streamathon. I coordinated and divided tasks across the team, and built the frontend pages, the Supabase schema, and the Stream backend integration, including payment link generation and the webhook flow that drives session state.
Approach
Two-sided marketplace on a shared Supabase schema: chargers, slots, sessions, and reviews, with a session state machine (PENDING → AUTHORIZED → CHARGING → BILLED) driven by Stream webhooks rather than any hardware signal. Trust was the product's hardest problem, not a technical one: a weighted score blending charger specs, session history, and reviews surfaces on the map before a driver ever books, since pulling up to a stranger's home takes real confidence. Booking also shows an AI-predicted cost from a physics formula corrected by a small sklearn model for charge taper above 80% SOC. Once a session starts, an asyncio loop writes kWh increments to Supabase every 5 seconds and Realtime pushes them straight to the driver's screen, so the live counter needed no hardware integration to demo convincingly. Hosts get an AI-suggested price by neighborhood and time of day when listing a charger.
Tradeoffs
Stream doesn't support pre-authorization, so drivers pay the predicted amount upfront with no hold/release step, a deliberate simplification for a payments API that doesn't offer the alternative. The kWh loop simulates consumption on a timer instead of reading real charger hardware, the right call for a 24-hour build where the marketplace, trust model, and payment flow were the point, not IoT integration. ZATCA invoicing is a mock JSON modal, not the real government spec, scoped out along with a RAG assistant and premium subscriptions that were pitched but deliberately left unbuilt.
FIG. 10 · SESSION STATE MACHINE
pending to authorized to charging to billed
Book
PENDING
Session row created, Stream payment link generated
Core
Stream webhook
PAYMENT_SUCCEEDED verified server side, never trust the redirect
AUTHORIZED flips the session, generates the access code, and marks the slot booked. A failed attempt releases the slot instead.
Live
CHARGING
Asyncio loop writes kWh every 5s, Realtime pushes to the driver screen
Out
BILLED
Driver stops, final cost and CO2 offset recorded
FAILED
Payment or session error, slot released
FIG. 11 · TRUST SCORE BLEND
specs + history + reviews
Charger specs
0.3
Connector type, kW rating
Session history
0.4
Completed sessions on this charger
Reviews
0.3
Average driver rating
Trust score, 0 to 100
0-59 New · 60-79 Trusted · 80-100 Top Host
Shown on the map pin before a driver books, so a new listing reads as new rather than untrustworthy.
Outcomes
- Built and demoed a complete two-sided marketplace in under 24 hours: map discovery, AI cost prediction, Stream checkout, live kWh billing, host earnings
- An Aramco expert at the demo called the trust-score approach exactly the kind of thinking the Saudi EV market needs
- Five working AI endpoints (compatibility, cost prediction, pricing, trust score, demand heatmap) backing real product decisions, not decoration
- Webhook-verified payment flow with signature checking, never trusting client-side redirect params for money

