Stacja Neapol: supplier invoices straight into stock

The pizzeria gets invoices from dozens of suppliers, as PDFs and photos. I built a flow in n8n that reads them, splits them into line items and saves them in the stock database. AI reads, code enforces the rules, a person decides on the exceptions.

Stacja Neapol

2026 · Digital product

Scope

  • n8n automation
  • AI and OCR
  • Stock database
  • Tests and audit
Invoices pass through the system in the background — fictional data

The challenge

Every invoice had to be retyped: supplier, products, quantities and prices. The same item has a different name at each supplier, and invoices arrive as scans, corrections and duplicates. Without this there is no stock level and no basis for orders.

Goals

  • An invoice from a PDF or a photo reaches the database without retyping.
  • The same invoice never goes in twice.
  • Unclear cases wait for a person instead of being guessed.
  • An error stops the write and sends an alert — the database is not silently left half-done.

How it works

  1. Input

    A form accepts invoice PDFs (I convert photos to PDF on import). A file fingerprint makes sure the same file never goes in twice.

  2. Reading two ways

    Text from the PDF and OCR for scans, merged into one text. The original stays in the database.

  3. AI and rules in code

    A language model extracts the header and line items, and rules in code check corrections, prices, VAT totals and tax IDs. Anything unclear goes to review, with no guessing.

  4. Dictionaries

    Supplier and products: existing or new. I also match products by meaning — the same item under a different name at another supplier.

  5. Safe write

    Old line items are removed only after the new ones are saved. The final status appears after reading back from the database.

  6. Further in the system

    Invoices feed the rest of the venue’s automations: sales import, weekly forecast, order proposal and kitchen calendar.

Error guard

A hard error, e.g. an AI model outage: nothing is saved, an alert email goes out and the import retries the batch.

Scope of work

The flow in n8n

  • 47 nodes: input, reading, extraction, dictionaries, write and alerts.
  • OCR for scans and photos, a language model for extraction.
  • About 400 lines of rules in code: corrections, gross prices, VAT totals, tax IDs.

Data and quality

  • Stock database: invoices, line items, products and suppliers.
  • The 5.09.2026 audit caught 67 duplicate invoices and wrong tax IDs. I fixed them with a script that has a dry-run mode, after a backup.
  • Offline regression tests — I change the flow under tests.

Results

  • 110 of the last 114 runs succeeded (5–6.10.2026). Safeguards stopped the rest, with nothing saved.
  • After the 5.09.2026 audit the database held 143 invoices, 506 line items, 417 products and 57 suppliers.

Contact

Tell me about the idea

Describe your idea in one sentence. I will reply within two business days and suggest a first step.

Book a 20-minute call