Skip to content
BENAA homeالعربية

All work

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

Tech leadUI/UXFrontendBackendDevOpsQA
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 images

01

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×1Senior
Product designerReview queue and side-by-side document view×1Senior
Frontend engineerReview app, supplier settings and reports×1Senior
Backend & AI engineerExtraction, validation, matching and ERP posting×1Senior
DevOps engineerDocument storage, queues and monitoring×1Senior
QA engineerA labelled invoice set and accuracy checks per release×1Senior

Meet the team

03

UI/UX design

Review the exception, not the invoice.

Who worked on it

UI/UXFrontend

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.

Reviewers see the document and the reason side by side
Warehouse staff send paper invoices by WhatsApp and get the result in a minute
  • 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

UI/UXFrontend

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.

Exceptions grouped by reason, fixed in bulk
Supplier profile: tax and bank details, matching rules and learned layout notes
Month-end close: cut-off countdown, ageing and who owns each open exception
  • 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

Tech leadBackend

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.

From inbox to ERP draft, tracked every step
Draft bills in the ERP, with approval status synced back every 2 minutes
The model's output in a fixed schema, next to the 14 checks run on it
  1. 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.

  2. 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.

  3. 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

BackendDevOps

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.

Every intake source has its own n8n workflow, health check and run history
  • 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

BackendQA

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.

Each release is scored on 1,240 labelled invoices before it goes live
  • 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.
AI invoice and document processing for an ERP

Arrow keys or a swipe to move · Esc to close

Tell us what you’re building.

A short message is enough. A senior engineer replies within 1 working day.