DEV Community

Srinjoyee Goswami
Srinjoyee Goswami

Posted on

GhostDocs: an invoice sorter for freelancers that never leaves their laptop

Hacktoberfest Open-Source AI Challenge Week 2: Side Hustle Submission 💸

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 2: Side Hustle

What I Built

GhostDocs turns PDF invoices and receipts into a structured, searchable ledger, using an open-weight model that runs on the freelancer's own laptop. Drop in a document and get the invoice number, vendor or client, dates, currency, subtotal, tax, total, payment terms, and every line item. Everything is saved to a local SQLite ledger and exports to CSV or multi-tab Excel.

Who would pay for it: freelancers, consultants, and small agencies. At tax time they spend hours retyping invoices into spreadsheets, and those invoices contain hourly rates, client names, and NDA-covered project details. Most AI expense tools solve the typing problem by asking them to upload all of that to a cloud service. GhostDocs solves it without the upload. A second group is bookkeepers who handle many freelancers' paperwork and can't send client data to third-party APIs.

The business model I'm aiming for: the core stays free and MIT-licensed. The paid part would be what freelancers actually ask for: scanned-receipt OCR, multi-currency totals, and QuickBooks/Xero export, plus a one-time setup service for non-technical users. I haven't charged anyone yet, so this is my plan rather than a result.

Demo

Live app: https://ghostdocs.streamlit.app/

Code

GhostDocs 👻

100% Offline, On-Device AI Invoice & Receipt Sorter for Freelancers

"Keep client contracts, financial rates, and NDA-covered billing 100% on your laptop."

Python 3.10+ License: MIT Privacy: 100% Offline Engine: Ollama Python SDK Hacktoberfest


🎯 The Mission

Freelancers, consultants, and independent agencies handle confidential client data daily: hourly billing rates, project roadmaps, vendor contracts, and NDA-protected deliverables. Traditional AI expense tools upload this sensitive financial paper trail to third-party cloud APIs.

GhostDocs solves this permanently. It is a lightweight, zero-telemetry document extraction utility that runs entirely on your local machine using the official Ollama Python SDK (ollama.Client) to query open-weight LLMs (llama3.2:3b, qwen2.5:3b, mistral:7b). It turns messy PDF invoices and receipt text files into structured, deterministic accounting records and a persistent SQLite ledger—even with your Wi-Fi completely turned off.

Live Demo


🏗️ Architecture & Data Flow

graph TD
    A["Uploaded Invoice (PDF / TXT)"] --> B["Local Ingestion (pypdf / pdfplumber)"]
    B --> C["Token Normalizer & Sanitizer"]
    C
…

How I Built It

  • Open-weight models via Ollama: the app talks to a local Ollama server through the official Python SDK. llama3.2:3b is the default, and qwen2.5:3b or mistral:7b can be swapped in from the sidebar.
  • Grammar-constrained decoding: I pass a Pydantic model's JSON schema to Ollama's format parameter, so the model can only produce output that fits the invoice schema. Temperature is 0 for repeatable results.
  • Pydantic validation: every response is validated into typed fields before saving, so totals are numbers and currency symbols become codes like USD or INR.
  • Local ingestion: pypdf reads PDFs, with pdfplumber as a fallback, and a normaliser trims the text to keep prompts small enough for 3B-parameter models.
  • Storage and UI: SQLite for the ledger, Streamlit for the interface, pandas and openpyxl for exports.
  • Fallback mode: if Ollama isn't running, a regex-based extractor lets people try the whole pipeline before downloading any model.

Why Does Open Innovation Matter?

Where the open approach beat a closed API for this product:

  • Privacy is the product. A freelancer under an NDA can't send a client's invoice to someone else's server. With a local open-weight model the document never leaves the machine, which a cloud API can't offer.
  • Cost. There are no per-token fees and no API keys. Processing the hundredth invoice costs the same as the first, which matters when the customer is a solo freelancer.
  • No lock-in. Models are swappable, so if a better small model appears, it's a one-line change instead of a migration.
  • Works offline. The whole pipeline runs with Wi-Fi off, which anyone can check using the steps in the README.

The trade-off is that a 3B model on a laptop is slower and less accurate than a frontier model on messy documents, which is why the output is schema-validated and why OCR for scans is the first paid feature on my list.

Top comments (0)