Gasolytics: Next.js gas-price map and data case study
Gasolytics uses Next.js and d3-geo to connect dated AAA snapshots to a U.S. gas-price map, state details, and trip estimates. It was built with heavy use of AI coding agents. This case study separates map rendering, snapshot freshness, and unavailable-data behavior.
- My role
- Directed the build with AI coding agents
- Context
- Independent product · Maps and data delivery · 2026
Next.js · React 19 · TypeScript · d3-geo · Vercel Blob · Vercel

- Problem
- Visitors need to move from a national price map to state details or a trip estimate.
- Decision
- Project map geometry on the server and keep source data dates distinct from read times.
- Tradeoff
- Server projection moves geometry work out of the browser but sends SVG paths with the page. A per-process cache can reuse older data; read time is not source freshness.
- Verified behavior
- Local fixtures confirmed stale-cache fallback and an explicit error when a fresh process had no usable data.
From a U.S. gas-price map to a trip estimate
A national map gives a quick comparison, but a visitor may want to inspect one state or estimate fuel for a trip. Gasolytics connects the overview to state and metro details, price history, a trip calculator, and EV comparisons. The map’s selected state opens a panel with the corresponding prices and trend instead of sending the reader through a separate search.
The capture shows California selected with a visible snapshot date. The panel connects its map position to prices and history, so a reader can move from a national pattern to a specific place. State and metro averages describe an area, rather than individual station quotes.
Server-rendered SVG with Next.js and d3-geo
The server uses d3-geo to turn geographic shapes into SVG path strings. The browser receives those shapes and handles the interactive layer: selection, zoom, pan, and metro pins. This keeps map projection separate from the changing price data and from the event-handling code.
Changing a fuel grade updates the displayed prices without rebuilding the geographic projection in the browser. The geometry is imported as a traced asset instead of read from an assumed runtime file location, so the serverless deployment includes the shapes it needs. The tradeoff is sending rendered paths with the page rather than making the browser compute them.
AAA snapshot dates and per-process caching
The separate Databank project publishes AAA snapshots; Gasolytics reads them from Vercel Blob. It does not perform the upstream scraping in the request path. The application shapes the snapshots for its views and uses a short-lived, in-process cache so repeated reads can reuse a result.
The response carries both the source data date and the time it was read. Those have different meanings: a page can be rendered now from an older snapshot. The current cache lasts up to 30 minutes within a process, while page revalidation and the upstream publication schedule are separate concerns. A recent request alone does not prove fresh source data.
Trip-cost assumptions and unavailable data
The trip calculator exposes the assumptions behind its result: distance, fuel economy, selected fuel grade, and the state averages used for price. Visitors can enter their own distance instead of relying on the approximate city-to-city distance. The result is a planning estimate, with the method beside it, rather than an unexplained dollar amount.
Unavailable data needs a separate response. The data reader was tested against local synthetic snapshots with network access disabled. A successful read populated the cache; an expired cache followed by an unreadable input returned the previous result marked stale. A fresh process without usable data raised an explicit error instead of returning an invented price.

Map and calculator captured from the public site on September 5, 2026. Cache and failure checks used local test data.