ai-setup 5 min read

Documind - Turn Documents into Structured Data with AI

Open-source tool that uses LLMs to extract JSON from PDFs, DOCX, and images. Custom schemas, local model support, and self-hosted.

By
Share: X in
Documind AI document analysis tool

TL;DR

TL;DR: Documind is an open-source document processing tool that uses AI to extract structured JSON data from PDFs, DOCX, images, and other file types — with support for custom schemas, local LLMs, and self-hosted deployment.

Source and Accuracy Notes

⚠️ This section is MANDATORY. All links must be verified from actual source, not guessed.

What Is Documind?

Documind is an open-source document processing platform that converts unstructured documents into structured data using AI. It handles PDFs, DOCX, PNG, JPG, TXT, and HTML files, extracting content and formatting it as JSON according to user-defined schemas.

The project launched on Hacker News in May 2025 and has since accumulated over 1,500 GitHub stars. It supports both OpenAI models and local LLMs (Llama3.2-vision, Llava), making it suitable for teams that need to keep documents on-premises.

Setup Workflow

Prerequisites

Documind requires:

  • Ghostscript — for PDF operations
  • GraphicsMagick — for image processing
  • Node.js v18+ and NPM

Install system dependencies:

# On macOS
brew install ghostscript graphicsmagick

# On Debian/Ubuntu
sudo apt-get update
sudo apt-get install -y ghostscript graphicsmagick

Installation

Install Documind via npm:

npm install documind

Environment Setup

Create a .env file in your project directory with your API key:

OPENAI_API_KEY=your_key_here

For local model usage, configure the custom LLM endpoint in your schema setup.

Basic Usage

Extract structured JSON from a PDF using a custom schema:

npx documind extract --input document.pdf --schema your-schema.json --output result.json

Use a pre-defined template:

npx documind extract --input document.pdf --template invoice --output result.json

Auto-generate a schema from document content:

npx documind schema --input document.pdf --output auto-schema.json

Supported File Types

  • PDF
  • DOCX
  • PNG / JPG (images)
  • TXT
  • HTML

Supported Models

  • OpenAI (GPT-4o, GPT-4o-mini via API)
  • Llama3.2-vision (local)
  • Llava (local)

Deeper Analysis

Architecture

Documind processes documents in two stages. First, it converts input files to a normalized text representation using Ghostscript (for PDFs) and GraphicsMagick (for images). Then, an LLM applies the user-defined schema to extract structured fields.

The core extraction logic lives in core/ directory (MIT-licensed), while the CLI and orchestration layer is AGPLv3.

Schema System

Schemas define the expected output structure. Fields support types like string, number, boolean, enum, and array. The auto-generate feature uses an LLM to propose a schema based on document content, which you can refine manually.

Pre-defined templates cover common use cases: invoices, receipts, contracts, and research papers.

Self-Hosted Options

Since Documind supports local LLMs, you can run the entire pipeline on-premises. This makes it suitable for processing sensitive documents that cannot leave your infrastructure. You’ll need a GPU-equipped server for acceptable throughput with Llama3.2-vision.

Practical Evaluation Checklist

  • [ ] Ghostscript and GraphicsMagick installed correctly
  • [ ] documind --version returns v1.1.2 or later
  • [ ] PDF extraction produces valid JSON matching schema
  • [ ] DOCX support tested (not just PDF)
  • [ ] Schema auto-generation produces reasonable output
  • [ ] Local LLM fallback works without OpenAI API key
  • [ ] Multi-file batch processing tested
  • [ ] Markdown output formatter tested

Security Notes

  • API keys are stored in a local .env file — never committed to version control
  • Documents are processed locally when using self-hosted LLMs — no data leaves your infrastructure
  • The AGPLv3 license on the CLI layer means derivative works must be open-sourced; the core/ extraction library is MIT-licensed for easier integration

FAQ

Q: Can Documind process scanned PDFs (images, not text)? A: Yes. GraphicsMagick handles image extraction, and the LLM vision models (Llava, Llama3.2-vision) can read the resulting images for structured extraction.

Q: What is the difference between the hosted version and self-hosted? A: The hosted version at documind.xyz provides managed APIs with no setup required. The npm package is fully self-hosted — you control the infrastructure, models, and data.

Q: Does it require an OpenAI API key? A: No. You can use local models (Llama3.2-vision, Llava) instead. OpenAI is one option among several LLM backends.

Q: What license is the extracted data? A: The extracted data belongs to you. Documind does not claim any rights over input documents or output JSON.

Conclusion

Documind fills a specific niche: turning messy document PDFs into clean structured JSON without manual data entry. The schema system and local LLM support make it practical for teams processing contracts, invoices, or research papers at scale. The npm package is straightforward to install and the CLI covers the main workflow. For teams already using OpenAI, the hosted beta is the fastest path to results. For data-sensitive environments, the self-hosted route with local models is viable.