Skip to content

Latest commit

 

History

53 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rückspiegel

Live: https://rueckspiegel.net

A small webapp that visualises prices increases for German gas stations. Currently relevant because of the federal price-transparency rule: one daily price increase at noon (Europe/Berlin).

This project is not meant to accuse anyone of wrongdoing, just a visualization of data

How it works

┌──────────────────┐      ┌────────────────────────────┐      ┌─────────────────────┐
│ tankerkoenig CSV │ ───▶ │ ingestion/ (Bun + TS)       │ ───▶ │ Supabase (Postgres) │
│ (daily snapshot) │      │  load-stations, load-prices │      │  + PostGIS + RLS    │
└──────────────────┘      └────────────────────────────┘      └──────────┬──────────┘
                                                                          │ anon key
                                                                          ▼
                                                              ┌─────────────────────┐
                                                              │ frontend/ (Vite)     │
                                                              │ MapLibre + Supabase  │
                                                              └─────────────────────┘
  • db/ — SQL schema, mock data, and migrations (markdown with embedded SQL blocks; paste into the Supabase SQL editor).
  • ingestion/ — Bun + TypeScript scripts that pull yesterday's tankerkoenig CSVs over HTTPS Basic auth and upsert into Supabase using the service-role key. Designed to run from cron at ~03:00 Europe/Berlin.
  • frontend/ — Vite + TypeScript + MapLibre GL. Loads stations viewport-first via a stations_in_bbox Postgres RPC; the hamburger list view lazy-loads the full set on first open.

Getting started

Prereqs: Bun and a Supabase project.

1. Database

In the Supabase SQL editor, run in order:

  1. CREATE EXTENSION IF NOT EXISTS postgis;
  2. db/gas_station_schema.md
  3. db/migration_001_price_changes_unique.md
  4. db/migration_002_daily_compliance_rollup.md
  5. db/migration_003_stations_in_bbox.md
  6. (Optional) db/mock_data.md for three fictional stations + a day of price events.
  7. Enable RLS on all three tables and add select policies for anon, authenticated using (true). No write policies — ingestion uses the service-role key server-side.

2. Frontend

cd frontend
cp .env.example .env   # fill VITE_SUPABASE_URL and VITE_SUPABASE_ANON_KEY (publishable key, sb_publishable_…)
bun install
bun run dev

3. Ingestion (optional — only if you want fresh data, not just the mock seed)

You'll need credentials for the tankerkoenig data portal (free, request access).

cd ingestion
cp .env.example .env   # fill TK_USER, TK_PASS, SUPABASE_URL, SUPABASE_SERVICE_ROLE_KEY
bun install
bun run daily          # refreshes stations, then ingests yesterday's prices

bun run load-prices -- --date YYYY-MM-DD backfills any past day. See ingestion/README.md for details.

Stack

  • Frontend: Vite, TypeScript, MapLibre GL, OpenFreeMap Positron tiles, @supabase/supabase-js. Bun as package manager.
  • Backend: Supabase (Postgres + PostGIS + PostgREST + anon key model).
  • Ingestion: Bun, TypeScript, streaming CSV via csv-parse.

Data sources & licenses

  • Fuel-price data: Tankerkönig — CC BY 4.0, attribution required.
  • Map data: © OpenStreetMap contributors — ODbL, attribution required.
  • Map tiles & style: OpenFreeMap (Positron, MIT-licensed).

Attribution for all three is shown in-app (corner control + the "Hinweis zu den Daten" section of the info modal).

License

MIT — see LICENSE.

Further reading

CLAUDE.md in the repo root is the long-form architecture doc: data model, the relaxed compliance rule and why, frontend architecture, ingestion pipeline, gotchas. Worth reading before opening a non-trivial PR.

About

The German government passed a rule that restricts gas stations to one price increase per day on midday. This application visualizes price increases of gas stations on a map and gives overview of the amount of increases.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages