Skip to content

Simi1612/InvoXtract

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

InvoXtract — AI Invoice Extractor

FastAPI React Supabase Gemini License

Live Demo: https://invoxtract-q0gz.onrender.com/

An AI-powered invoice data extraction platform that turns any invoice — PDF, PNG, or JPG — into structured, exportable data in seconds. Built end-to-end with a FastAPI backend, React frontend, Supabase database, and Google Gemini 2.0 Flash Vision as the AI engine.


What It Does

Most businesses receive invoices in dozens of formats from hundreds of vendors. Manually entering invoice data into spreadsheets or accounting software is slow, error-prone, and expensive. InvoXtract eliminates that entirely.

Upload an invoice → AI reads it → structured data comes out. No templates to configure per vendor. No OCR tuning. No manual entry.


Key Features

AI Extraction

  • Powered by Google Gemini 2.0 Flash Vision
  • Extracts vendor name, invoice number, date, line items, subtotal, tax, total, currency, payment terms, and more
  • Works on any invoice format — printed, handwritten, scanned, digital

Custom Extraction Templates

  • Define exactly which fields to extract for a specific client or use case
  • Templates saved per user, reusable across batch uploads

Batch Processing

  • Upload up to 50 invoices at once
  • Live progress tracking per file
  • Parallel extraction with error handling per invoice

Invoice Consolidation

  • Merge multiple extracted invoices into one unified report
  • Useful for monthly vendor summaries or audit preparation

Multi-format Export

  • CSV — raw data for spreadsheets
  • Excel — formatted workbook with headers and styling
  • JSON — structured data for downstream systems
  • PDF Report — formatted invoice summary document

Analytics Dashboard

  • Spend by vendor (bar chart)
  • Monthly spend trends (line chart)
  • Top vendors by invoice count and total value
  • Summary stats: total invoices, total spend, average invoice value

Invoice History

  • Searchable and filterable log of all past extractions
  • Click any invoice to view full extracted data
  • Inline manual correction — edit any AI-extracted field

Authentication & Security

  • Email + password auth via Supabase Auth
  • Per-user data isolation with Row Level Security (RLS)
  • Users never see each other's invoices or templates

Tech Stack

Layer Technology
Frontend React 18 + Vite + TailwindCSS + shadcn/ui
Backend FastAPI (Python 3.11+)
Database Supabase (PostgreSQL)
Auth Supabase Auth (Email/Password)
AI Engine Google Gemini 2.0 Flash Vision
File Storage Supabase Storage
Export openpyxl (Excel) + reportlab (PDF)
Charts Recharts
Rate Limiting slowapi
Deployment Render (frontend + backend)

Architecture Overview

User Browser
    │
    ▼
React Frontend (Render — Node)
    │  Axios HTTP requests
    ▼
FastAPI Backend (Render — Python)
    ├── /extract     → Gemini Vision API → Supabase DB
    ├── /invoices    → Supabase DB (CRUD)
    ├── /templates   → Supabase DB (CRUD)
    ├── /export      → Generate CSV / Excel / JSON / PDF
    └── /analytics   → Supabase DB (aggregation queries)
         │
         ▼
    Supabase (PostgreSQL + Storage + Auth)

Quick Start

# Clone
git clone https://github.com/your-username/AI_Invoice_Extractor.git
cd AI_Invoice_Extractor

# Backend
cd backend
pip install -r requirements.txt
cp .env.example .env   # fill in your keys
uvicorn main:app --reload

# Frontend (new terminal)
cd frontend
npm install
cp .env.example .env   # fill in your keys
npm run dev

Full setup guide: docs/SETUP_GUIDE.md


Project Structure

AI_Invoice_Extractor/
├── backend/
│   ├── main.py                   # FastAPI app, CORS, middleware
│   ├── config.py                 # Environment config
│   ├── requirements.txt
│   ├── routers/
│   │   ├── extract.py            # Invoice extraction endpoints
│   │   ├── invoices.py           # Invoice CRUD
│   │   ├── templates.py          # Extraction templates
│   │   ├── export.py             # CSV/Excel/JSON/PDF export
│   │   └── analytics.py         # Dashboard analytics
│   └── services/
│       ├── gemini_service.py     # Gemini Vision API integration
│       ├── supabase_service.py   # Supabase client + queries
│       └── export_service.py    # Export file generation
├── frontend/
│   ├── src/
│   │   ├── pages/                # Login, Dashboard, Upload, History, etc.
│   │   ├── components/           # Layout, ProtectedRoute, UI components
│   │   └── lib/                  # Supabase client, AuthContext, axios
│   ├── public/
│   │   └── serve.json            # SPA routing config for serve
│   └── vercel.json               # SPA rewrite rules
└── docs/
    ├── SETUP_GUIDE.md
    ├── ARCHITECTURE.md
    ├── DATABASE_SCHEMA.md
    ├── API_REFERENCE.md
    └── DEPLOYMENT.md

API Endpoints

Method Endpoint Description
POST /extract/single Extract data from one invoice
POST /extract/batch Extract data from multiple invoices
GET /invoices List all invoices (paginated)
GET /invoices/:id Get single invoice
PATCH /invoices/:id Update extracted fields
DELETE /invoices/:id Delete invoice
GET /templates List extraction templates
POST /templates Create template
GET /export/:id Export single invoice
POST /export/batch Export multiple invoices
GET /analytics/summary Dashboard summary stats
GET /analytics/monthly Monthly spend trend
GET /analytics/by-vendor Spend by vendor

Full reference: docs/API_REFERENCE.md


Docs

Document Description
SETUP_GUIDE.md Local development setup
ARCHITECTURE.md System design and decisions
DATABASE_SCHEMA.md Tables, columns, RLS policies
API_REFERENCE.md All endpoints with examples
DEPLOYMENT.md Deploy to Render (frontend + backend)

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors