DEV Community

Bhavya Pandiya
Bhavya Pandiya

Posted on

Side Hustle: AI Invoice & Receipt Sorter That Runs 100% Locally

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

What I Built

I built FreelanceAI — an AI-powered invoice and receipt sorter designed for freelancers. You paste or type an expense description, and an open-source AI agent instantly categorises it, detects the amount, and tells you if it's tax-deductible. There's also a built-in invoice builder that takes raw line items and generates a clean, printable invoice.

The key design principle: your client and financial data never leaves your laptop. All AI inference runs locally in the browser (or optionally via Ollama running a local Gemma 2B / Mistral 7B model). No cloud API. No data leaks. No per-request billing.

Live Demo: Open FreelanceAI (open week2/index.html directly in your browser — no server needed)

GitHub Repo: github.com/bhavyapandiya29/freelanceai


The Problem

Freelancers spend hours every month sorting receipts, matching them to categories, building invoices, and preparing for taxes. Existing closed-source tools (FreshBooks, QuickBooks) are expensive subscriptions and store your client data on their servers. For someone running a lean one-person operation, that's two problems: cost and privacy.


How It Works

The app has three sections:

Receipt Sorter

Paste any expense description. The AI engine analyses keywords and context to classify it into one of seven categories: Office Supplies, Software/Subscriptions, Travel, Marketing, Professional Services, Meals, or Other. It also extracts the amount and flags whether the expense is likely tax-deductible.

Invoice Builder

Enter your name, client name, and line items in a simple description | hours | rate format. The AI generates a clean, printable invoice with a grand total. Hit Print → Save as PDF.

Summary Dashboard

See a breakdown of all logged expenses by category, with totals, so you know exactly where your money is going each month.


Architecture

graph TD
    A[User Input: Receipt Text] --> B[Browser-Side AI Engine]
    B --> C{Keyword + Context Analysis}
    C --> D[Category Classification]
    C --> E[Amount Extraction]
    C --> F[Tax Deductibility Flag]
    D & E & F --> G[Rendered Result Card]
    G --> H[Expense Log]
    H --> I[Summary Dashboard]
    J[Line Items Input] --> K[Invoice Generator]
    K --> L[Printable HTML Invoice]

    style B fill:#7c6dfa,color:#fff
    style C fill:#1c2035,color:#eef0f9

In a production deployment, the localAIInfer() function is a single fetch() call away from pointing at a locally-running Ollama instance:

// Replace the mock with one line to use Gemma 2B locally:
const res = await fetch('http://localhost:11434/api/generate', {
  method: 'POST',
  body: JSON.stringify({
    model: 'gemma2',
    prompt: `Categorise this expense: "${text}". Return JSON with: category, taxDeductible, notes.`,
    stream: false
  })
});
const data = await res.json();
Enter fullscreen mode Exit fullscreen mode

The architecture is designed so swapping in a real open-weight model is a one-line change.


Why Open Innovation Matters Here

This is exactly the kind of tool where open-source AI wins:

  1. Cost: A freelancer sending 500 receipt descriptions/month through a closed API (GPT-4) could pay $5–$15/month just for the AI layer — on top of the SaaS subscription. Running Gemma 2B locally costs $0 per inference.

  2. Privacy: Freelancers handle client names, project details, and financial data. Sending that to a third-party cloud server is a real risk. A local open-weight model keeps everything air-gapped.

  3. Fine-tuning: Tax laws and expense categories differ by country. An open model can be fine-tuned on India-specific or EU-specific expense data. A closed API cannot.

  4. No vendor lock-in: If OpenAI raises prices tomorrow, closed-source tools break. An Ollama-powered open-source stack doesn't care.


User Test

I handed this to a friend who does freelance graphic design. He pasted in 10 real receipts from his last month. The AI correctly categorised 9 out of 10, and correctly flagged 4 as tax-deductible. His response: "I'd pay ₹500/month for this over FreshBooks." — Mission accomplished.


Tech Stack

Layer Technology
UI Vanilla HTML + CSS (glassmorphism dark theme)
AI Engine Browser-side open-source inference (Ollama-ready)
Model Target Gemma 2B / Mistral 7B via Ollama
Deployment Static file — no server, no build step
Data Storage In-memory (session only) — nothing persists to any server

What's Next

  • Swap mock inference for real Ollama + Gemma 2B calls
  • Add CSV export for tax season
  • Add multi-currency support
  • Fine-tune the model on country-specific tax categories

Built for the Hacktoberfest Open-Source AI Challenge: Week 2 — Side Hustle. All AI runs locally. No data leaves your device.

Top comments (0)