Case study

    SG Petrol Prices

    Pump prices from five brands, collected automatically every two hours

    SG Petrol Prices running live at sgpetrol.app

    Collection interval

    Every 2 hours

    Brands tracked

    5

    Grades compared

    92 / 95 / 98 / Diesel

    The problem

    Petrol prices in Singapore move without warning and every brand publishes them differently — some on a marketing page, some buried in an app, none in a format you can compare. Drivers were checking four websites to save a few dollars a tank, and nobody had a reliable record of what a price actually was last Tuesday.

    What we built

    • A scheduled collector that reads each brand's published prices every two hours and writes them to Postgres
    • Change detection, so a silent edit by a brand is recorded as a new data point instead of overwriting history
    • Discount-adjusted comparison: card and membership discounts applied so the ranking reflects what you actually pay
    • Trend charts per grade and brand, served from pre-aggregated queries so the page stays fast

    The part worth knowing

    The hard part was never the front end. Brands occasionally correct a price after publishing it, which quietly rewrites history if you store only the latest value. Every reading is stored as an immutable row with the time it was observed, so the trend line shows what was true at the time — and a correction shows up as a correction, not a rewrite.