Skip to content
RRepody

A simple architecture, built to last

Standard components, each in its place: an interface, an API, workers, a database, storage, an identity provider and a model server you control.

OperatorsBrowser
Your systemsREST · API key
Web interfaceNext.js
APIFastAPI
IdentityKeycloak · OIDC
WorkersHatchet
DatabasePostgreSQL
Object storageS3-compatible
Model servervLLM · Repody VLM

The life of a run

From the file received to the verdict, what happens at each step.

  1. 1

    Intake

    The API checks the key or token, then the number, size and type of the files, stores them in object storage and answers 202.

  2. 2

    Queue

    The run enters the Hatchet queue. When the queue is full, the API answers 503 with Retry-After.

  3. 3

    Claim

    A worker claims it atomically, checks that the model is awake and starts it if needed.

  4. 4

    Extraction

    Each page becomes an image at 170 DPI, or 3 megapixels for small pages and photos; the documents go to the model in parallel, each with its JSON template, and each is read a second time at another size.

  5. 5

    Rules

    The engine evaluates every rule on the extracted values, within a document or across two.

  6. 6

    Report

    Fields, rules and verdict are stored in PostgreSQL; the interface and the API read them.

Components

  • Web interface

    Server-rendered Next.js; every request goes through a proxy that attaches the user's token.

  • API

    FastAPI, typed end to end, separate and enforced layers (API, application, extraction, rules, infrastructure).

  • Workers

    Hatchet queues each run: the API answers at once, workers process runs in the background.

  • PostgreSQL

    Workflows, runs, fields and rule results; Alembic migrations applied by a dedicated service before start-up.

  • Object storage

    Uploaded files, in S3-compatible storage (SeaweedFS included, or your own).

  • Keycloak

    Optimised image, production realm built in, settings injected at start-up.

The extraction model

  • Repody VLM

    A vision model specialised in structured extraction: it receives the page images and a JSON template, and returns the fields.

  • Served by vLLM

    OpenAI-compatible API, speculative decoding, full weights; the model server stays outside the product, on your GPU or a managed one.

  • Every page sharp enough, read twice

    Each page reaches the model at the resolution it expects, and small pages and photos at 3 megapixels at least. Each document is read a second time at another size: a value the two reads disagree on goes to review instead of passing. A document is read in one request, about 40 A4 pages at most; a longer one is refused, with the reason, before it runs.

  • GPU on demand

    In managed mode, the GPU switches off after ten minutes without requests and resumes from a memory snapshot in seconds; one container at most.

  • Start-up announced

    Before extracting, the worker checks whether the model is awake; if not, the run shows “GPU waking up”.

  • Measured

    On a 24 GB GPU: about 1.5 s for a one-page invoice, 6 to 10 s for five pages, 30 to 45 s for twenty; a start from the memory snapshot takes about 15 s.

Scale and resilience

  • Independent workers

    Add workers without touching the API; on Kubernetes, the API and workers autoscale (HPA).

  • Atomic claiming

    A run is processed once, even when several workers receive it.

  • Recovery without a person

    A worker that stops hands its run to another, which starts it over; a database restart is retried; a run past its time limit, or lost by the queue, is failed with the reason and its credits settled.

  • Admission control

    Past the chosen queue depth, the API refuses cleanly (503) instead of collapsing.

  • Bounded concurrency

    Requests to the model and rendered pages in memory are capped, so neither the GPU nor a worker is overloaded, and clients take turns so one bulk upload cannot hold every worker.

  • Highly available PostgreSQL

    On Kubernetes: CloudNativePG with a connection pooler and scheduled backups.

Observability

  • Structured logs

    JSON, each line carrying the id of the run concerned.

  • Traces

    OpenTelemetry from the API to the workers, collected by an OpenTelemetry Collector.

  • Logs, errors and alerts

    Logs searchable in Grafana (Loki, Alloy), errors with their stack trace in Bugsink, alerts on errors and on a missed backup, all on your servers.

  • Query statistics

    Every database query is measured (pg_stat_statements), and slow ones are logged without their values, which can be client data.

  • Health probes

    Separate liveness and readiness, so the orchestrator knows when to restart and when to wait.

  • Operations view

    Live queue status in the interface; runs, workers and schedules in the queue's own dashboard.

Written decisions

Every architecture choice has its record in the repository, with the context and the alternatives set aside.

  1. ADR 011Asynchronous runs with HatchetThe API answers at once; Hatchet hands each run to a worker and enforces its time limits.
  2. ADR 004Cloud and Kubernetes packagingA Helm chart and manifests for customers' clusters.
  3. ADR 005External inferenceThe model server stays outside the chart: your GPU or a managed one.
  4. ADR 009A simple backendOne definition, one queue, one upload path.
  5. ADR 010Explicit lifecyclesEvery state of a workflow and a run, and its transitions, has a name.
  6. ADR 012The hosted service on one serverDocker Compose on a VPS with a staging copy beside it and the model on a managed GPU; Kubernetes stays for client installations.

See Repody on your own documents

A 30-minute demo, then a pilot on your files and your rules.