Distribution · 2026
AI invoice and document processing for an ERP
A document pipeline for a distribution company that receives supplier invoices by email, WhatsApp and paper scans. Each invoice is read, matched to its purchase order and goods receipt, and posted to the ERP as a draft bill; anything that doesn’t match lands in a review queue with the reason.
Built by
- Client
- Withheld at the client’s request
- Sources
- Email · WhatsApp · Scans
- Documents
- Invoices · Receipts · Credit notes
- Typical timeline
- 10–12 weeks
- Squad
- 6 people · 5 disciplines
Technologies
- n8n
- Laravel
- LLM APIs
- OCR
- PostgreSQL
- Redis
- Next.js
- S3 storage
- Docker
The product
10 images01
Brief
Three people typed invoices all day.
Context
The finance team receives supplier invoices in every format: PDFs by email, phone photos on WhatsApp and paper at the warehouse.
Problem
Each invoice was typed into the ERP by hand and checked against the order on paper, and errors were found only at month end.
Goals
- Read any invoice format
- Match every line to an order
- People review exceptions only
- Nothing posts without a check
02
Team
The squad behind it.
| Tech leadMatching rules, ERP posting contract and data privacy | ×1 | Matching rules, ERP posting contract and data privacy | Senior | |
|---|---|---|---|---|
| Product designerReview queue and side-by-side document view | ×1 | Review queue and side-by-side document view | Senior | |
| Frontend engineerReview app, supplier settings and reports | ×1 | Review app, supplier settings and reports | Senior | |
| Backend & AI engineerExtraction, validation, matching and ERP posting | ×1 | Extraction, validation, matching and ERP posting | Senior | |
| DevOps engineerDocument storage, queues and monitoring | ×1 | Document storage, queues and monitoring | Senior | |
| QA engineerA labelled invoice set and accuracy checks per release | ×1 | A labelled invoice set and accuracy checks per release | Senior |
03
UI/UX design
Review the exception, not the invoice.
Who worked on it
Reviewers see the document on one side and the extracted fields on the other, with every field that failed a check highlighted and the reason written next to it. Approving a clean invoice takes one key.
- Side by sideThe source document next to what was read from it.
- Reasons, not scores“Unit price differs from the order”, not a confidence number.
- Keyboard firstApprove, correct and move on without the mouse.
04
Frontend
One queue for every exception.
Who worked on it
The review app groups exceptions by reason and supplier, so a reviewer fixes the same problem across many invoices at once. Supplier rules, like a fixed VAT rate or a known bank account, are edited in the same app.
- Grouped by reasonFix a pattern once, not invoice by invoice.
- Supplier rulesEach supplier’s quirks saved as rules.
- Audit trailWho changed which field, and when.
05
Backend & architecture
The model reads. The rules decide.
Who worked on it
n8n collects documents from every inbox and hands them to the pipeline. A model extracts the header and line items into a fixed schema; plain code then validates totals and tax, matches lines to the purchase order and goods receipt, and posts a draft bill to the ERP.
Decision 1
Extraction into a strict schema
Everything after extraction can be checked by ordinary code.
Trade-off · New document types need a schema first.
Decision 2
Totals and tax are recalculated, never trusted
A misread digit must not reach the ledger.
Trade-off · Invoices with unusual rounding go to review.
Decision 3
The ERP receives drafts, not posted bills
Finance keeps the final approval in the system it trusts.
Trade-off · One extra click per invoice in the ERP.
06
DevOps
Every document kept, every step logged.
Who worked on it
Originals are stored encrypted with their extraction results, so any posted bill can be traced back to its source. Queues absorb month-end peaks, and alerts fire if documents wait too long or the ERP stops answering.
- Encrypted originalsKept for the period the auditors require.
- Month-end readyWorkers scale with the queue.
- Cost trackingModel cost per document and per supplier.
07
QA
Accuracy is measured, not assumed.
Who worked on it
A labelled set of real-format invoices, with supplier names replaced, runs on every change to prompts, rules or the model. Field-level accuracy is compared with the last release, and a drop blocks the deploy.
- Labelled invoice setEvery format the team receives, including bad scans.
- Per-field accuracyTotals, tax, dates and lines scored separately.
- ERP sandboxPostings tested end to end before release.
Tell us what you’re building.
A short message is enough. A senior engineer replies within 1 working day.
