Work / Web app · 2026
InvoiceAI
InvoiceAI is a False Logics product for accountants and bookkeepers: they upload an invoice or receipt, and a background worker extracts structured fields with Azure AI Document Intelligence and OpenAI for them to review and correct. I built all of it, from the Fastify and PostgreSQL API and the BullMQ worker to the Next.js dashboard, CSV export and QuickBooks Online bill sync. It is a prototype and has not been deployed yet.
- case study
- own product
- web app
- prototype
- Type
- Web app · Applied AI: document extraction SaaS
- Built with
- JavaScript, Node.js, Fastify, Drizzle ORM, PostgreSQL, Supabase, BullMQ, Redis (Upstash), AWS S3, Azure AI Document Intelligence, OpenAI API, QuickBooks Online API, Next.js, React, Tailwind CSS
- Also uses
- Render, Vercel
- Last active
- 2026
Overview
InvoiceAI is a SaaS for accountants and bookkeepers: they upload invoices and receipts, AI extracts the structured fields, and they review and correct them, export CSV, or sync the result to QuickBooks Online as a bill.
It is a False Logics product that I built. It is a prototype and has not been deployed yet.
Context and problem
The users are accountants and bookkeepers, and the product appears to target the manual step of typing invoice and receipt data into their accounting system.
My role
I founded False Logics and am the only developer on InvoiceAI. All six commits are mine, covering the Fastify API, the extraction worker, the QuickBooks integration and the Next.js dashboard.
The code was written over two days in April 2026, after the stack and the build phases had been planned.
Constraints and requirements
- Fixed stack: the plan fixes the stack in a context block reused in every build session: Fastify, Drizzle on Supabase Postgres, BullMQ on Upstash Redis, S3, Azure Document Intelligence with GPT-4o-mini, and Next.js 14.
- Hosting: Render for the API and Vercel for the frontend are planned; the repo holds the configuration, not a running deployment.
- Data scoping: every document belongs to a workspace, and workspaces carry plan and usage limits.
Research and planning
I planned the build as four sessions: the scaffold, Drizzle schema and auth; the document pipeline; the Next.js frontend; and deployment to Render, Supabase and Vercel.
The planning notes record why Drizzle was chosen over Prisma (no separate query-engine process, leaner SQL), and the choice of open-source BullMQ over the Pro tier, with Redis from Upstash rather than run on Render.
Solution and user experience
A user drags a file onto the dashboard; the API stores it in S3 and queues an extraction job.
When the worker finishes, the document shows its extracted fields, each with a colour-coded confidence badge. Any field can be corrected inline, and is then marked as corrected.
From a finished document the user can export CSV, for one document or several at once, or sync it to QuickBooks Online once the workspace is connected.
Key features
- Accounts and workspaces: bcrypt and JWT sign-in, with workspace scoping and plan and usage limits.
- Extraction pipeline: upload to S3, a queued job, and structured JSON with a confidence score.
- Review: a document table, a detail view with field correction, and drag-and-drop upload.
- CSV export: single documents, or a capped bulk export of finished ones.
- QuickBooks Online: OAuth connect with a state table, token refresh, find-or-create vendor and Bill creation.
- Admin: an admin bootstrap and a promote-admin script.
Architecture and stack
A Next.js dashboard calls a Fastify REST API backed by PostgreSQL on Supabase; files go to S3, and extraction runs asynchronously in a BullMQ worker that can be switched off with an environment flag.
- API: Node.js ESM on Fastify 5, with JWT, multipart upload and CORS plugins.
- Data: PostgreSQL on Supabase through Drizzle ORM, with three SQL migrations.
- Queue: BullMQ on Upstash Redis via ioredis.
- Storage: AWS S3, with presigned download URLs.
- Document AI: Azure AI Document Intelligence for layout and text, then OpenAI GPT-4o-mini to normalise it into a fixed schema.
- Accounting: QuickBooks Online through intuit-oauth and node-quickbooks.
- Dashboard: Next.js 14 App Router, React 18, Tailwind, shadcn/Radix and Sonner.
Implementation details
Extraction runs in two stages, so the language model gets recognised text instead of a raw image: Azure's prebuilt invoice model reads the file, and GPT-4o-mini turns its text into a fixed JSON shape. If Azure is unavailable or fails, the file goes to GPT-4o-mini as an image instead.
The result is then checked arithmetically: line items against the subtotal and subtotal plus tax against the total, each within 1%, and the invoice date against the due date. Every failed check lowers the confidence score.
The worker marks each document as processing, then done, or failed with the error message. It stores scalar fields as separate rows so they can be corrected one by one, and upserts the vendor for the workspace.
QuickBooks tokens are refreshed shortly before they expire, and a Bill is built from the extracted line items, or from the total when there are none.
Workspace routes check the workspace in the JWT and a membership row; document routes also check that the document belongs to that workspace.
There are no automated tests in the repository yet.
Challenges
- Getting the worker to connect reliably to managed Redis and Postgres took two fixes: a shared Upstash connection module, and IPv4-first DNS, because Supabase resolved to IPv6 first on Render and Node failed with ENETUNREACH.
Trade-offs
- Running extraction in a queue worker likely keeps uploads fast and tolerates slow OCR and LLM calls, at the cost of running Redis and a second process.
- The worker can be switched off, for example in development to save Upstash commands; uploads then wait in the queue until it is back on.
- Drizzle was chosen over Prisma for a lighter data layer with no separate query-engine process.
Links
Skills demonstrated
- Document AI pipelines that combine OCR, LLM extraction and validation checks.
- Background job queues with BullMQ and Redis.
- Accounting API integration: QuickBooks Online OAuth and bill creation.
- Node.js API development with Fastify and Drizzle.
- Cloud storage with S3 presigned URLs.
- Next.js dashboards with review and correction flows.

