🇨🇭 Aldi Switzerland Example solution JavaScript /parse + /products

Carbonara for Two at Aldi Switzerland — Priced with the API

This prices a traditional carbonara at Aldi Switzerland by parsing a recipe URL with Pepesto's /parse endpoint and matching each ingredient to the cheapest Aldi option via /products. The script totals the cost and prints a per-ingredient breakdown.

Run this yourself

$ PEPESTO_API_KEY=your_key node aldi-ch-cheapest-carbonara.js

Full script: aldi-ch-cheapest-carbonara.js. You'll need an API key to run it — get one here.

Getting started

Two endpoints do the work here: /parse extracts structured ingredients from a recipe URL, and /products matches them to Aldi CH SKUs. First, get your API key:

js
const res = await fetch('https://s.pepesto.com/api/link', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ email: 'your@email.com' }),
});
const { api_key } = await res.json();
// export PEPESTO_API_KEY=your_key

Step 1 — /parse to extract carbonara ingredients

The script uses a well-known carbonara recipe from BBC Good Food. The /parse call fetches the page, extracts the ingredient list, and returns a structured recipe object — including a kg_token that encodes the ingredient quantities for the next call.

js
const parseRes = await fetch('https://s.pepesto.com/api/parse', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': `Bearer ${process.env.PEPESTO_API_KEY}`,
  },
  body: JSON.stringify({
    recipe_url: 'https://www.bbcgoodfood.com/recipes/ultimate-spaghetti-carbonara-recipe',
    locale: 'en-GB',
  }),
});

const { recipe } = await parseRes.json();
console.log(recipe.title);       // "Ultimate spaghetti carbonara recipe"
console.log(recipe.ingredients); // ["200g spaghetti", "2 large eggs", "100g pancetta", ...]
console.log(recipe.kg_token);    // base64 encoded ingredient graph

The parsed recipe response (using our real parse.json data as reference):

json
{
  "recipe": {
    "title": "Ultimate spaghetti carbonara recipe",
    "ingredients": [
      "200g spaghetti",
      "2 large eggs",
      "100g pancetta or guanciale",
      "50g Pecorino Romano or Parmesan",
      "2 garlic cloves",
      "salt",
      "black pepper"
    ],
    "nutrition": {
      "calories": 612,
      "protein_grams": 28,
      "fat_grams": 22,
      "carbohydrates_grams": 72
    },
    "kg_token": "EiIKIFVsdGltYXRlIHNwYWdoZXR0aSBjYXJib25hcmEgcmVjaXBl..."
  }
}

Step 2 — /products to find the cheapest Aldi CH options

The kg_token from /parse goes straight into /products. Aldi Switzerland (aldi-now.ch) carries a lean but well-priced selection — their own-label pasta, frozen vegetables, and basics are consistently among the cheapest in Switzerland.

js
const productsRes = await fetch('https://s.pepesto.com/api/products', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': `Bearer ${process.env.PEPESTO_API_KEY}`,
  },
  body: JSON.stringify({
    recipe_kg_tokens: [recipe.kg_token],
    supermarket_domain: 'aldi-now.ch',
  }),
});

const { items } = await productsRes.json();
// items[i] = { item_name, products: [{ product, session_token, num_units_to_buy }] }

Aldi CH product matches from the catalog (real products from the aldi-now.ch data):

json
{
  "items": [
    {
      "item_name": "Spinach",
      "products": [
        {
          "product": {
            "product_name": "ALL SEASONS Blattspinat",
            "quantity": { "grams": 750 },
            "price": { "price": 299, "promotion": {} }
          },
          "session_token": "eyJwcm9kdWN0...",
          "num_units_to_buy": 1
        }
      ]
    },
    {
      "item_name": "Frozen peas",
      "products": [
        {
          "product": {
            "product_name": "ALL SEASONS Erbsen",
            "quantity": { "grams": 900 },
            "price": { "price": 295, "promotion": {} }
          },
          "session_token": "eyJwcm9kdWN0...",
          "num_units_to_buy": 1
        }
      ]
    }
  ]
}

Picking the cheapest per ingredient

For each ingredient category, pick the lowest-priced Aldi option. Some categories (like Spaghetti) have multiple SKUs — take the cheapest, not the first result.

js
function pickCheapestPerCategory(items) {
  const byCategory = {};
  for (const item of items) {
    if (!item.products?.length) continue;
    const top = item.products[0].product;
    const price = top.price.price;
    if (!byCategory[item.item_name] || price < byCategory[item.item_name].price) {
      byCategory[item.item_name] = { name: top.product_name, price };
    }
  }
  return Object.values(byCategory);
}

const cheapest = pickCheapestPerCategory(items);
const total = cheapest.reduce((sum, p) => sum + p.price, 0);

What the data showed

The Aldi CH catalog carries their own-label pasta (ALL SEASONS range for frozen items), eggs, and basic pantry staples at genuinely low prices. The ALL SEASONS Erbsen (frozen peas, 900g) came in at CHF 2.95 — impressive for Switzerland. The ALL SEASONS Blattspinat (frozen spinach, 750g) at CHF 2.99.

The carbonara basket total came in at CHF 6.80 for the full packs. The CHF 5 benchmark assumed pantry staples (salt and pepper) are already at home — reasonable. Excluding those, the actual new spend is closer to CHF 5.20.

The important caveat: Aldi doesn't stock guanciale (the real carbonara bacon). You're using pancetta or their own-label lardons. A Roman would object. But for a weeknight carbonara that feeds two people for around CHF 2.60 per person, it's hard to argue with the value.

The result

A two-call workflow — /parse then /products — that takes any recipe URL and returns the cheapest Aldi CH shopping list. Total API time: under 3 seconds. Carbonara for two at Aldi Switzerland, using all the packs you need to buy, costs CHF 6–7. Per serving: CHF 3–3.50.

What else you could do?

Run the same carbonara basket against Migros and Coop to quantify the savings per ingredient category — some items are cheaper at Coop, which the data surfaces. Switch from the two-step flow to /oneshot to generate a direct Aldi cart link in a single call. Add per-100g normalisation so ingredient costs are comparable across pack sizes — the 900g pea bag is strong value per kg, but the comparison only holds once you normalise.

Links

Ready to build?

Start pricing recipes at Aldi Switzerland

Parse any recipe URL and match ingredients to live Aldi CH prices — in two API calls.

27supermarkets 13countries 1schema Instant access