Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Invoice RPA System

Full-stack, Dockerized invoice processing system with FastAPI, PostgreSQL, OCR, and a React dashboard.

Features

  • Invoice upload: PDF / PNG / JPG via POST /invoices/upload
  • OCR & parsing: Tesseract + pdfplumber with regex-based field extraction
  • Database: PostgreSQL + SQLAlchemy + Alembic
  • Dashboard: React (Vite) UI for uploads and browsing invoices with pagination
  • Email summary: Daily summary at 18:00 UTC with CSV attachment
  • Dockerized: Backend, frontend, and Postgres in docker-compose

Project structure

  • backend/ – FastAPI app, models, services, Alembic, Dockerfile
  • frontend/ – React (Vite-style) app and Dockerfile
  • docker-compose.yml – Multi-container stack
  • .env.example – Example environment variables

Prerequisites

  • Docker and Docker Compose

Configuration

  1. Copy .env.example to .env in the project root and adjust values:
cp .env.example .env
  1. Ensure your SMTP settings are valid if you want daily summary emails.

Running the stack

From the invoice-rpa directory:

docker compose up --build

Services:

  • Frontend: http://localhost:3000
  • Backend API docs (Swagger): http://localhost:8000/docs
  • Backend health: http://localhost:8000/health

Backend overview

  • Main app: app/main.py
  • Config: app/config.py (reads env vars, upload dir, SMTP, DB URL)
  • DB models: models/invoice.py
  • Schemas: app/schemas.py
  • Routers:
    • routers/invoices.py
      • POST /invoices/upload – multipart upload, saves file, runs OCR, parses fields, stores invoice with VALID / PARTIAL / FAILED status.
      • GET /invoices – paginated list (query params page, page_size).
  • Services:
    • services/ocr_service.py – PDF/image OCR
    • services/invoice_extraction.py – regex-based extraction + status classification
    • services/email_service.py – builds and sends daily summary email + CSV
    • services/scheduler.py – APScheduler daily job at 18:00 UTC

Alembic is configured under backend/alembic with an initial migration to create the invoices table.

Frontend overview

  • Vite-style React app with:
    • Upload form with loading/error states
    • Invoice table with vendor, date, amount, status, created time
    • Pagination (Previous/Next, page count)
  • Uses Axios to call:
    • GET /invoices?page=&page_size=
    • POST /invoices/upload with multipart/form-data
  • API base URL is controlled by:
    • VITE_API_BASE_URL env (Docker sets this to http://backend:8000)

Notes

  • Files are stored under /app/uploads in the backend container, mapped to the uploads volume.
  • Logging is configured with structured output to stdout.
  • Error handling uses FastAPI exceptions and try/except in services.

About

Full-stack invoice processing RPA: upload PDFs/images, OCR with Tesseract, extract fields (vendor, date, amount), store in PostgreSQL. FastAPI backend, React (Vite) dashboard, Docker Compose. Daily email summary with CSV.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages