JP paixao.dev
All projects

Case study

PoupeX: where does a whole basket cost less?

PoupeX reads Portuguese supermarket prices every day, matches the same product across stores, and shows where your shopping costs less. I built it and I run it.

My role
Owner: product, architecture, code, infrastructure and operations
Built with
Go, Nuxt, TypeScript, PostgreSQL, Redis, Terraform
Runs on
Railway, managed with Terraform
Started
May 2026, through Kickoff Works
The PoupeX home page, in Portuguese. A search box sits beside a card showing that 20 everyday products cost €46.50 at Continente in October, €37.10 less than at the most expensive store.
The home page on 15 November 2026. PoupeX is in Portuguese.
products with a current price
127,337
supermarket chains read every day
12
before an unconfirmed price leaves the comparison
48 h

From the PoupeX about page, 15 November 2026. The catalogue changes daily.

The problem

Portuguese supermarkets each publish prices on their own sites, with their own pack sizes, promotions and loyalty-card prices. Checking one product is easy.

Working out where a whole weekly shop costs less, or whether it's worth splitting it between two stores, means comparing dozens of products across a dozen sites. That's the question PoupeX answers.

Constraints

  • Every store is different

    Some prices can only be read through a real browser. Names differ too, so the same item is matched by barcode, or by brand, pack size and quantity.

  • Old prices mislead

    A price that isn't seen again within 48 hours leaves the comparison and stays in the history.

  • Heavy writes, mostly reads

    Ingestion writes a lot for part of the day. The rest of the time the site only reads, so it shouldn't need an always-on catalogue database.

  • Things restart

    Workers crash and deploys roll. A half-finished run must never leave half-published prices.

Architecture

Three paths that share data but run on their own schedules: collecting prices, publishing them, and serving them to visitors.

Collect

Every day
  1. Scheduler Go

    Queues a run for each store.

  2. Job queue Postgres

    Decision 1

    Versioned jobs with leases and heartbeats.

  3. Workers Go

    Read stores, clean data, match products.

    Browser service

    Only reaches allowed sites.

    Decision 4
  4. Catalogue database Postgres

    Decision 2

    Prices, products and matches. Can sleep when idle.

Publish

After each successful run
  1. Catalogue database Postgres

    The source of truth.

  2. Snapshot build Go

    Decision 3

    Compressed product batches and search indexes.

  3. Read model Redis

    Decision 3

    A manifest switches to the new generation once it's complete.

Serve

Every request
  1. Site and apps Nuxt

    Pages plus a backend-for-frontend. ChatGPT connects through its own service.

  2. Private API Go

    Decision 3

    Serves public catalogue reads from Redis only.

  3. App database Postgres

    Decision 2

    Accounts, lists and alerts. Small and always on.

How a price gets from a store's website to your screen. Simplified: logins (Clerk), the bill-splitting app, fuel imports and observability are left out. Numbers match the decisions below.

Decisions

  1. A job queue in Postgres, not calls between services

    Every ingestion stage, from reading a store to matching products, is a versioned job in one Postgres table. Go workers claim a job with a lease and a heartbeat, and their writes are fenced by that claim, so a worker that stalls can't overwrite newer work. This replaced HTTP calls from the ingestion runtime into the web app.

    Why: Retries and crash recovery come from one place, and every run leaves a record of what happened.

  2. Two databases, split by lifecycle

    Catalogue data (prices, products, matches) lives in a Postgres database that can sleep between runs. Accounts, lists and alerts live in a small one that stays on. Nothing joins across them: a saved list keeps a product's ID and a snapshot of what it needs to show.

    Why: User data stays relational and safe, and the large database only runs when there's work for it.

  3. Publish the catalogue whole, serve it from Redis

    After a successful run, the pipeline writes compressed product batches and search indexes to Redis, then switches a manifest to the new generation. Public catalogue reads come from Redis only.

    Why: Visitors see the old catalogue or the new one, never a mix, and browsing doesn't wake the catalogue database.

  4. Treat the edges as untrusted

    The browser service only reaches allowed destinations on public addresses. Output from the AI shopping assistant is treated as untrusted input, and anything it saves needs authorisation and review.

    Why: Scraping and AI are where outside input enters the system, so that's where the checks sit.

What's live

  • Product search and whole-basket comparison, in one store or split between two
  • A monthly basket of 20 everyday products, compared store by store
  • Price history and price alerts
  • Fuel prices station by station, from DGEG, and trip costs
  • Rents, house prices and utility tariffs, from INE, ERSE and ERSAR
  • Bill splitting at dividir.poupex.pt, with receipt reading
  • Mobile apps, a browser extension for Chrome, Edge and Safari, and a ChatGPT app

As listed on poupex.pt, 15 November 2026.

The PoupeX monthly basket page for October 2026. Continente is cheapest at €46.50, followed by Auchan, Pingo Doce, Froiz, El Corte Inglés and Apolónia, with each product's price listed on the right.
The monthly basket: 20 products at six chains.
The PoupeX home page on a phone, with the search box above October's cheapest basket.
On a phone.

Need something like this built, or untangled?

I take on a few projects at a time through Kickoff Works: cloud platforms, .NET and web products, and technical leadership.