A self-hosted document system for a small business. Paper from the scanner, attachments from email and files from the desk go into one searchable archive. AI reads the details off each document and files it.

Each document goes through the same steps whichever way it arrives. A person only steps in when the system is unsure.
| Web app | React with Tailwind, served by the API. Works in any modern browser and on a tablet. |
|---|---|
| API and worker | Node.js 22 and TypeScript (Hono). One worker process handles the queue, OCR and intake. |
| Database | PostgreSQL 17, with full-text search and the job queue in the same database. No Redis and no Elasticsearch. |
| OCR | OCRmyPDF with Tesseract, with automatic rotation, straightening and skipping of pages that already have text. |
| AI | Anthropic Claude (Sonnet) through the official API. The model is a setting. |
| Files | Stored once, named by their SHA-256 fingerprint and never modified, so a copy can always be checked against its name. |
| Backups | restic to any S3-compatible store, SFTP or a local disk. |
Four Docker containers on one Linux machine. It can share a server with other services; it needs no GPU and no special hardware.
| Minimum | Recommended | Notes | |
|---|---|---|---|
| CPU | 4 cores (x86-64) | 8 cores | OCR is the only heavy work, and it runs in bursts as scans arrive. More cores means a big batch is searchable sooner. |
| Memory | 8 GB | 16 GB | Uses about 1.2 GB when idle. Limits allow up to 12 GB during heavy OCR. |
| System disk | 20 GB | 40 GB | Docker images about 1.7 GB, plus logs and build space. |
| Data disk | See sizing below. SSD recommended for the database. | Files and database on one volume that can be grown later. | |
| Operating system | Any current 64-bit Linux with Docker Engine and the Compose plugin | Runs on Debian, Ubuntu, Fedora, RHEL and similar, or a small cloud VM. | |
| Container | Image | What it does | Memory limit |
|---|---|---|---|
| db | postgres:17-alpine | Documents, fields, users, search index and the job queue | 4 GB |
| api | Node.js 22 | The web app and API, logins, search, uploads | 2 GB |
| worker | Node.js 22 + OCRmyPDF, Tesseract | OCR, AI reading, email and scanner-folder intake | 6 GB |
| caddy | caddy:2-alpine | Web front door; HTTPS automatically when given a domain name | small |
Measured at a site holding 20,000 documents, mostly multi-page deal packs averaging about 30 pages: 38 GB of files and 1.7 GB of database. Single-page invoices are far smaller. Budget roughly:
| Documents held | Files | Database | With searchable copies kept |
|---|---|---|---|
| 10,000 | 20 GB | 1 GB | about 40 GB |
| 50,000 | 100 GB | 5 GB | about 200 GB |
| 100,000 | 200 GB | 10 GB | about 400 GB |
A separate searchable copy of each PDF is kept by default for faster viewing. It can be switched off to halve the file storage, and search works either way. At about 1,650 documents a month, a typical dealership adds 1 to 2 GB a month.
| Inbound | One web port on the office network (HTTP), or 443 with a domain for HTTPS. Users only need a browser. |
|---|---|
| Outbound | HTTPS to the AI provider (Anthropic) for reading fields. Optional: Google's Gmail API for email intake, and S3-compatible storage for offsite backup. |
| Scanner share | Optional. Read and write access to the Windows share the scanners save to, using an account that can move files. |
| Accounts | An Anthropic API key (pay as you go). For email intake, a Google Workspace service account. For offsite backup, an S3 or Backblaze B2 bucket. |
A nightly job dumps the database, then backs up the dump, the files and the settings with restic (encrypted and deduplicated) to a local repository and an offsite copy in S3. It then restores the dump into a scratch database to prove it works before reporting success. The OCR'd copies are left out because they can be regenerated. Offsite storage for 100 GB costs about US$1.25 a month in S3 Infrequent Access.
Docstore is licensed once per site, with no per-user or monthly charge. Hosting is your own server. The running cost is the AI reading each document, paid to the AI provider per use.
| Item | Cost | Basis |
|---|---|---|
| AI reading of fields and filing | US$0.01–0.05 per document | Claude Sonnet reads only the pages each category allows. Measured at one site: about 4.5 US cents for a supplier invoice batch read at 5 to 6 pages, and 1 to 2 cents for a deal pack read from its cover sheet alone. |
| OCR | nil | Runs locally on the server's CPU. |
| Hosting | nil extra | An existing server. A cloud VM with 4 cores, 8 GB and 250 GB is roughly US$25–45 a month. |
| Offsite backup | US$1–3 / month | S3 Infrequent Access or Backblaze B2, about 100 GB. |
| Example volume | Documents a month | AI cost a month |
|---|---|---|
| Small office | 300 | US$8–12 |
| Dealership (150 deals, 500 invoices, 1,000 other) | 1,650 | US$40–60 |
| Busy multi-site business | 5,000 | US$150–200 |
AI pricing is the provider's list price at the time of writing (November 2026) and is billed in US dollars. Categories with no fields, such as a general "Correspondence" category, are never sent to the AI.
The per-category page limits already keep most of each document on site. Some clients will want no page to leave the building at all. The AI step can be pointed at a model running on a local GPU server instead of the cloud API. That removes the per-document cost and keeps everything on site. In exchange it needs a GPU machine, and field accuracy is usually lower, so more documents land in the review queue.
Open-weight models that can read a page image or OCR text and return the fields. They are listed as of November 2026; this field moves monthly, so test on the client's own documents before choosing.
| Model | Licence | Role | GPU memory (4-bit, approx.) |
|---|---|---|---|
| Qwen3-VL 8B | Apache 2.0 | Reads page images and text. Widely regarded as the best all-round open model that runs on a single consumer GPU. | 12–16 GB |
| Qwen3-VL 32B | Apache 2.0 | The same family, noticeably better on dense or messy pages. | 24–32 GB |
| Gemma 4 12B / 26B MoE / 31B | Apache 2.0 | Google's open family (April and June 2026), with image input across all sizes and strong multilingual text. | 12–16 GB / 24 GB / 24–32 GB |
| PaddleOCR-VL 1.6, GLM-OCR | Apache 2.0, MIT | Small (about 1B) document readers that top current OCR benchmarks. They would replace Tesseract for hard scans; they do not fill fields themselves. | 4–8 GB |
| olmOCR 2 (7B) | Apache 2.0 with responsible-use terms | PDF-to-text specialist built for very large batches. | at least 12 GB |
| Setup | Suits | Expect |
|---|---|---|
| CPU only (the Docstore server itself) | Trying it out | Minutes per document even with a small model. Not practical for daily intake. |
| One 16 GB GPU (for example an RTX 4060 Ti 16 GB or 5070 Ti) | 7–12B models | Workable for a small office's volume. The weakest accuracy of these options. |
| One 24–32 GB GPU (for example an RTX 4090 or 5090) | Up to about 32B models | The sensible tier for a dealership: the stronger models, with room for several pages at once. |
| Apple Mac Studio, 64 GB or more | Up to about 32B models | Quiet and simple to run. Slower than a comparable NVIDIA card, but fine for overnight batches. |
At a dealership's volume the cloud API costs about US$40–60 a month, so a GPU workstation would take several years to pay for itself on cost alone. Choose local for privacy, regulation or very high volume, not to save money. The two can also be mixed: OCR stays local in both cases, and only the field reading needs a choice.
GPU memory figures are for 4-bit quantised weights plus room for a few page images, rounded up to common card sizes. They are estimates, not measurements on this system.