Introduction
n8n has become a go-to automation platform for teams looking to build powerful workflows without heavy coding. It’s open source, low cost, self-hosted and comes packed with tools to work with LLMs and AI agents.
At Lynxmind, we quickly recognized its potential and launched several initiatives to bring automation into everyday business processes. One of the first use cases where this combination proved highly valuable was expense tracking and invoice recognition, a task nearly every company faces.
The Problem: Manual Expense Tracking
Our expense-tracking process started like many others. Employees submitted receipts, someone manually entered the data into a system and admins handled approvals. While functional, this workflow came with familiar issues: inconsistent data entry, typos, delays in approvals and no real visibility for employees.
We set out to automate the process to minimize human error, accelerate approvals and make expense tracking more transparent.
System Architecture Overview
To solve this, we built a straightforward but effective architecture: a responsive web application built with Next.js, a backend powered by Supabase (PostgreSQL), orchestration through n8n workflows and on-premises AI models hosted with Ollama using gtp-oss and qwen2.5vl.
The workflow looks like this:
- An employee uploads an invoice (PDF or image) through the web app.
- Supabase inserts a new row in the invoices table.
- A database trigger calls an n8n webhook, which processes the data and returns results to Supabase.
- An admin reviews and resolves any flagged discrepancies.
Workflow Implementation
The automation begins with a Supabase database trigger that activates whenever a new invoice is submitted. This trigger calls an n8n webhook, passing along the new row’s data and file location.
From there, n8n:
- Retrieves the uploaded document.
- Determines whether it’s a PDF or an image.
- Routes the file to the appropriate AI model (gtp-oss for PDFs after text extraction, qwen2.5vl for images).
- Extracts key details such as the store or company name, item descriptions and VAT or IVA values.
The extracted values are then compared against the user’s input using gtp-oss. If any discrepancies are found, they are flagged in a dedicated field on the invoice table for admin validation. If everything matches, the data is automatically verified.
While n8n is a powerful platform, the community self-hosted version has its limitations. We encountered several obstacles, including the lack of workflow or credentials sharing, no native versioning and limited error visibility.
Some of these features exist in the paid version, but we wanted to keep our stack lightweight and cost-effective. To work around these issues, we exported workflows to a GitHub repository for version control and added Checkmk monitoring to better track performance and errors.
We also faced technical challenges such as handling poorly formatted invoices, inconsistent outputs from models on low-quality images and building robust error-handling logic.
Security and Privacy Considerations
Since we work with financial documents, security was a top priority. Self-hosting the AI stack ensures that invoice data never leaves our infrastructure. We maintain complete control over authentication and access and every operation is logged and auditable.
Future Roadmap
This project is just the beginning of our automation journey. Next steps include:
- Full automation of data insertion with no manual entry.
- A RAG (retrieval-augmented generation) system using n8n and Ollama.
- Enhanced monitoring, versioning and error reporting.
- Lead generation and data enrichment capabilities.
- Automated marketing campaigns.
Conclusion
For Lynxmind, combining n8n with local AI models has proven to be a powerful way to bring automation into real business processes without relying on expensive cloud services.
Our invoice recognition workflow is just one example of how AI can simplify routine operations and free up teams for more meaningful work. We’ll continue exploring the potential of on-premises AI and n8n and we hope this inspires others to do the same.
Lynxmind also offers n8n consultation services to help organizations design, implement and scale their automation solutions. If you’re looking to integrate n8n with AI in your business or develop end-to-end solutions, we can help you do it efficiently and securely.