Skip to content
All projectsNext: Quorum Research
AI Platforms · Own product — 2025–2026

DocuIntel

A live document extraction platform that I designed, built and deployed alone. Users name the fields they need, or let AI suggest them. The backend compiles those fields into a typed Pydantic model at runtime and hands it to the provider's native structured output, across six LLM providers, using the user's own encrypted key. People review and correct every record before export.

LiveLive at docuintel.gimhara.com
Role
Sole engineer, design to deployment
Team
Solo
Timeline
Nov 2025 – present
Stack
Next.js 16 · FastAPI · LangChain · Pydantic · Supabase · Cloud Run
DocuIntel
ProblemTemplate OCR breaks on new layouts, fixed-category APIs refuse custom fields, and 'return JSON' prompts come back malformed.
ApproachCompile user-defined fields into Pydantic models at runtime and enforce them through each provider's structured output.
TechnologyNext.js 16, FastAPI, LangChain, Pydantic v2, Supabase with RLS, Docker, Cloud Run, Vercel.
OutcomeLive in production: six providers, one LLM call per CSV, database-enforced tenant isolation.

Problem

Finance, legal and HR teams re-type values from invoices, contracts, resumes and tables. Template OCR fails when a vendor changes a layout, big document APIs only know fixed categories, and asking an LLM to 'return JSON' produces fences, missing keys and wrong types. A multi-user AI service also has to keep every user's API key isolated, and should not pay for everyone's inference.

Approach

A schema engine instead of document typesThe first plan was a seven-node LangGraph workflow with a classifier and fixed invoice, contract and report extractors. Once users define their own fields, the classifier is unnecessary: the field list becomes a Pydantic model via create_model(), every field Optional so missing data doesn't fail the call, and LangChain's with_structured_output enforces it.
One extraction path for every formatPDF, Word, text and Markdown go through loaders; images go to a vision model that writes a layout-aware text version, then follow the same path. Blocking parsing and model calls run in worker threads so the async API stays responsive.
Map columns once, transform rows in codeSending thousands of CSV rows through an LLM is slow and expensive. Only the headers and target schema go to the model, once; pandas applies the resulting mapping to every row. Cost no longer grows with row count.
Keys that stay the user'sKeys are stored as AES-256-GCM ciphertext with PBKDF2 (100,000 iterations, random 16-byte salt) in a versioned format, and are passed to the model constructor per request. Early code set them as process-wide environment variables, where two concurrent users could overwrite each other's key.

Architecture

How the system fits together, in two views.

One extraction request
Files + fieldsValidateText loadersVision modelColumn mapperRuntime modelRow transformStructured outputReview grid
Three input routes converge on one structured-output call. Text formats load directly, images are turned into text by a vision model first, and CSVs skip per-row LLM calls entirely.
Where a user's API key lives
Key enteredin settingsEncryptAES-256-GCM, PBKDF2SupabaseRLS on 8 tablesDecryptonly when neededModel clientper request
Row-level security ties every row to its owner, so even an unfiltered query returns only the caller's keys. Decrypted keys are handed to the model per request, never set globally.

Decisions

  1. Runtime schemas over per-document modelsOver: Fixed extractors, free-form JSON promptsEvery user needs different fields. One code path serves any schema, with types enforced by the provider's own tool-calling or JSON-schema mode.Trade-offTypes are enforced, not correctness: a well-typed value can still be wrong, which is why a person reviews every record.
  2. Keys injected per requestOver: Global environment variablesEnvironment variables are process-wide, so concurrent users could overwrite each other's key. Constructor injection isolates each request and made adding providers trivial.
  3. No vector search in extractionOver: Chunk-and-retrieve RAGUsers want every value from the file they just uploaded, not similar chunks. Chunking can split a line item from its total; bounded uploads fit in a long-context window whole.
  4. A direct pipeline over the planned agent graphOver: LangGraph classifier with per-type extractorsUser-defined fields made document-type routing unnecessary, so the shipped system calls the model directly and keeps the human review step in the UI.Trade-offGave up automatic document-type routing and the planned automated confidence gate.
  5. Cloud Run and VercelOver: Render, Fly.io, RailwayCompared on cold starts, card requirements, RAM and cost. Cloud Run's free tier and scale-to-zero suit low, bursty traffic.

Technology

Frontend
Next.js 16, React 19, TypeScript, Tailwind CSS v4, shadcn/ui, Recharts
Backend
FastAPI, Python 3.11, Pydantic v2, pandas, pypdf, slowapi, uv
AI
LangChain across OpenAI, Anthropic, Gemini, Groq, Mistral and Cohere; LangSmith tracing
Data & auth
Supabase PostgreSQL, Auth, Storage, row-level security
Security
AES-256-GCM + PBKDF2 key storage, Cloudflare Turnstile, rate limits, upload sanitising
Delivery
Multi-stage Docker, Cloud Build → Cloud Run, Vercel, Cloudflare DNS, Resend SMTP
Mobile
SwiftUI, MVVM, Core Data

Outcome

Own product · 2025–2026
LLM providers behind one bring-your-own-key interface
LLM call per CSV file, regardless of rows
database tables protected by row-level security
platform-paid LLM inference: users bring their keys

Status

Shipped
  • PDF, Word, CSV, text, Markdown and image ingestion
  • Manual schema builder and AI field suggestions (5–15 fields)
  • Six-provider bring-your-own-key with encrypted storage
  • Review grid with inline editing; CSV, JSON, XML and TXT export
  • Templates, history, analytics and free-tier quotas
  • Companion native iOS client (SwiftUI) on the same backend
Not shipped
  • Salesforce and QuickBooks integrations (roadmap)
  • Automatic document classification (early plan, dropped)
  • Neo4j GraphRAG (experiments only, not user-facing)

My role

Built alone across both repositories, from product design to operations.

  • Both extraction workflows: user-defined and AI-suggested fields
  • FastAPI service, schema engine, loaders and CSV pipeline
  • Next.js 16 app: review grid, export, analytics, landing page
  • Supabase schema, migrations, RLS policies and quotas
  • Key encryption, request isolation, upload hardening
  • Native SwiftUI client
  • Docker, Cloud Build CI/CD, Vercel, DNS and branded email
DocuIntel detail 1
DocuIntel detail 2

Go deeper

Next projectQuorum ResearchA research platform where eight specialised agents plan, gather, fact-check, critique and write, and the interface shows every step while it runs.