Get started
Self-hosting
Engrafo runs from one compose file on any machine with Docker and Docker Compose: a NAS, a home server, a small VPS. It is four containers from published images: Engrafo itself, Postgres, RustFS (the S3-compatible bucket your files live in) and a one-shot job that creates the buckets. Nothing to clone and nothing to build.
Quickstart
Three commands with the docker CLI, or one paste in Portainer or TrueNAS.
-
Make a directory, download the compose file, and write a
.envbeside it with the address you will browse to and three fresh secrets. Then start it:mkdir engrafo && cd engrafo curl -fsSLO https://raw.githubusercontent.com/cubicecho/engrafo/main/docker-compose.quickstart.yml # The three secrets it refuses to start without, plus the address you reach it at. printf 'ENGRAFO_HOST=%s\nBETTER_AUTH_SECRET=%s\nPOSTGRES_PASSWORD=%s\nRUSTFS_PASSWORD=%s\n' \ "$(hostname -f)" "$(openssl rand -hex 32)" "$(openssl rand -hex 24)" "$(openssl rand -hex 24)" > .env docker compose -f docker-compose.quickstart.yml up -d -
Check
ENGRAFO_HOST.hostname -fis a guess. It has to be the hostname or LAN IP you will actually open Engrafo at, with no scheme:truenas.local,192.168.1.50. Edit.envif the guess is wrong. -
Open
http://ENGRAFO_HOST:3004. Migrations run at boot and the job creates both buckets (one for your files, one for the text extracted from them), so there is no setup step.
On Portainer or TrueNAS SCALE
Paste the contents of
docker-compose.quickstart.yml
instead of downloading it: Portainer's Stacks → Add stack → Web
editor, or TrueNAS's Apps → Discover → Custom App → Install via
YAML (Dockge works the same way). Put ENGRAFO_HOST,
BETTER_AUTH_SECRET, POSTGRES_PASSWORD and
RUSTFS_PASSWORD in the stack's environment-variables box, and
TZ (e.g. America/Chicago) if you want it. Make
each secret with openssl rand -hex 32 for
BETTER_AUTH_SECRET and openssl rand -hex 24 for
the two passwords. The stack refuses to start until the three secrets are
set, which is deliberate. The file's header comments are the same
instructions as this page.
Why ENGRAFO_HOST is not localhost
Your browser uploads files straight to RustFS, over a link Engrafo signs,
and the signature covers the hostname and the port. If
ENGRAFO_HOST says localhost while you browse from
another machine, uploads fail with a signature error rather than one that
names the real problem. That is also why RustFS's port has to be reachable
from your browser, not only from Engrafo.
If the ports are taken
If something on the machine already owns 3004, 9000 or 9001 (9000 is
popular), set ENGRAFO_PORT, RUSTFS_PORT or
RUSTFS_CONSOLE_PORT in .env rather than editing
the file. The addresses Engrafo signs its upload links with are built from
these, so changing a port only in the ports: list breaks
uploads.
Keep the .env
BETTER_AUTH_SECRET signs sessions, so changing it signs
everyone out. Your documents and their text live in the
engrafo_rustfs volume and their metadata in
engrafo_pgdata. Both survive docker compose down.
First sign-in
Sign in with any email address. Engrafo sends no mail: the sign-in link is written to the container log, and that is how you get it.
docker logs -f engrafo # or the Logs tab in Portainer
The first account ever created is the admin. The admin is the only one who sees instance settings, such as Settings → Sign-in. Registration is open to anyone who can reach the page, so keep it on a network you trust until you have read Before you expose it.
Fetching a link from the log every time gets tedious on a home network.
SECURE_LOCAL_NET=true skips the link entirely, so entering an
address signs you in. That makes the address the entire credential, so use
it only on a LAN you control. Or set up single sign-on.
Configuration essentials
The variables the quickstart file reads from .env (or
Portainer's environment box). Change one, then run up -d again.
| Variable | Default | What it does |
|---|---|---|
ENGRAFO_HOST | required | The hostname or LAN IP you open Engrafo at, no scheme. Sign-in links and signed upload links are built from it. |
BETTER_AUTH_SECRET | required | Signs sessions and hashes magic-link tokens. At least 32 characters: openssl rand -hex 32. |
POSTGRES_PASSWORD | required | The database password: openssl rand -hex 24. |
RUSTFS_PASSWORD | required | The bucket's secret key, and the RustFS console's root password: openssl rand -hex 24. |
TZ | UTC | Time zone for all four containers, e.g. America/Chicago. |
ENGRAFO_PORT, RUSTFS_PORT, RUSTFS_CONSOLE_PORT | 3004, 9000, 9001 | The published ports. Change them here, never only in the file. |
SECURE_LOCAL_NET | false | true signs you in from an address alone, with no link. A LAN you control only. |
SESSION_STORE | memory | memory signs everyone out when the container restarts; database keeps sessions. |
TRUST_PROXY | false | Behind a reverse proxy, the number of proxies in front (usually 1). |
TRASH_RETENTION_DAYS | 30 | How long a deleted document waits in the Trash, restorable, before it and its files are deleted for good. |
WATCH_OWNER | unset | Turns on the watched folder, filing into this account. |
WATCH_STABLE_SECONDS | 10 | How long a file must stop changing before the watched folder takes it. |
OIDC_ISSUER, OIDC_CLIENT_ID, OIDC_CLIENT_SECRET, OIDC_NAME | unset, SSO | Pins an OpenID Connect provider. See Single sign-on. |
Some settings are written into the file's environment: block
rather than read from .env: OCR is on with
OCR_LANGUAGES=eng and OCR_CONCURRENCY=1 (OCR is
CPU-bound, so raise it only with cores to spare), and
DATE_ORDER=DMY, which reads 03/04/2025 day first.
A US archive wants MDY. Edit those lines under the
engrafo service to change them. Anything else from the full
list, such as MAX_UPLOAD_BYTES (100 MiB by default), has to be
added there too.
The full list, with every default, is in the README's Configuration section.
A scanner's watched folder
Engrafo can file whatever a scanner saves to a network share, then delete it from the share.
-
Sign in once with the account the files should go to. Then set
WATCH_OWNERto its email address, e.g.WATCH_OWNER=you@example.com. Until that account exists, the log says so and nothing is filed. -
Under the
engrafoservice, uncomment the twovolumeslines and put the share's path on this machine before:/consume:volumes: - /mnt/tank/scans:/consume Redeploy (
docker compose -f docker-compose.quickstart.yml up -d).
What to expect:
- Subfolders become folders.
Taxes/2026/receipt.pdfis filed inTaxes→2026, made if missing. A name already taken in a folder is numbered,scan (2). - A file is taken once it stops changing for
WATCH_STABLE_SECONDS(10). Raise it for a slow scanner. The share is polled, because file-change events do not cross a network share. - It is deleted only once it is stored. Engrafo needs permission to delete files in the share; if it cannot, each file is filed once and then stays, and the log says so.
- The same bytes are not filed twice. A file already in the owner's archive is removed without adding a copy.
- A file Engrafo cannot take (a type it does not accept, too big, empty) stays where it is, and the log says why.
- Skipped silently: dotfiles,
~$and*.tmp/*.partfiles, and NAS housekeeping folders such as@eaDirand#recycle.
More detail in the README's The watched folder.
Single sign-on (OIDC)
Sign people in through any OpenID Connect provider, such as heautou, next to magic links.
Pairing from the app (the easy way)
For a provider that supports Dynamic Client Registration. No variables needed.
- In the provider, make a setup URL for Engrafo. It looks like
https://<heautou>/oidc#setup=…&name=heautouand works once, for a short while. - Paste it into Engrafo. On a new instance, before anyone has an account, that is the login page's Set up sign-in tab; after that it is Settings → Sign-in, which only the admin sees.
- The login page shows "Sign in with heautou" straight away, with no restart.
Disconnecting in Settings removes the button and deletes Engrafo's client at the provider. Accounts stay, and can still sign in with a link.
From the environment
For a provider without registration, or to pin the provider so it cannot be changed from the app:
- Register a client at the provider whose redirect URI is exactly
http://ENGRAFO_HOST:3004/api/auth/callback/oidc. - Set
OIDC_ISSUER,OIDC_CLIENT_ID,OIDC_CLIENT_SECRET(leave it unset for a public client) and, for the button,OIDC_NAME. - Redeploy. The login page then shows "Sign in with <OIDC_NAME>", and the server logs the redirect URI it expects.
Set OIDC_ISSUER and OIDC_CLIENT_ID together:
one without the other stops the server at boot. An issuer set in the
environment wins over a pairing, and Settings then shows it read-only.
Someone signing in this way gets the account with the email address the
provider vouches for, or a new one.
Connecting an AI agent over MCP
Engrafo serves one MCP endpoint, /mcp (Streamable HTTP), next to
the app. An agent sees only the folders you share, and cannot change anything.
- Open a folder's ⋯ menu and choose Share with MCP. The folders inside it are shared too. Everything else, including documents at the top level, stays out of reach.
-
In Settings → MCP, make an API key. It is shown once, with the command to paste:
claude mcp add --transport http engrafo http://ENGRAFO_HOST:3004/mcp \ --header "Authorization: Bearer engr_…"
Any other client takes the same URL and header (x-api-key works
too). The tools are engrafo_folders, engrafo_search,
engrafo_list and engrafo_read. Turning a folder off
takes effect on the agent's next call, and revoking a key refuses it from
then on. A key works as its owner, and needs to be there even with
SECURE_LOCAL_NET, so treat it like a password.
Backups
Your archive: export and import
Settings → Backup exports your whole archive as one
.tar: every original you uploaded, the searchable PDF and
extracted text where there are any, and a metadata.json with
titles, folder paths, dates, receipt fields and checksums. It streams
straight from the bucket to your browser. The tree inside reads like your
folders (originals/Taxes/2026/invoice.pdf), so it is useful
without Engrafo too.
The same tab imports one back, into this instance or a new one (a
.tar.gz too, up to 1 GiB by default). A document already in
your archive is skipped, so importing the same export twice adds nothing.
Dates and receipts you corrected by hand are kept, and every document is
processed again like a new upload, so a large import takes a while to
settle. Folder sharing with MCP is not restored.
The whole instance
An export is per account. To back up the instance itself (accounts, API
keys, sign-in settings), back up the engrafo_pgdata and
engrafo_rustfs volumes together, as a database dump plus a
bucket sync. One without the other is not a working archive.
Before you expose it to the internet
Registration is open: any address that completes a sign-in gets an account. That is right for an instance only you can reach, and wrong on the public internet. Before giving Engrafo a domain:
- Put it behind something. A reverse proxy with TLS and, if the instance is yours alone, an allowlist, VPN or auth in front of it. Set
TRUST_PROXYto the number of proxies in front, or every visitor counts as the proxy and shares one sign-in rate limit. - The bucket is reachable too. Browsers upload and download directly, so RustFS's port is published. Terminate TLS in front of it and set
S3_PUBLIC_ENDPOINTto that address. - Drop the RustFS console port (
9001) from the file if you do not want it exposed. It takes the root password. - Never set
SECURE_LOCAL_NET=true(or the olderAUTH_MAGIC_LINK=false) on a reachable instance. Either one lets anyone who can load the login page sign in as anyone. - Never set
EXPOSE_MAGIC_LINK=trueon a reachable instance. It hands the sign-in token to whoever asked for it. - Treat MCP keys like passwords. Anyone with one reads the folders you shared.
- Set a real
BETTER_AUTH_SECRETand keep it. Changing it signs everyone out; leaking it lets anyone mint a session.
Upgrading
docker compose -f docker-compose.quickstart.yml pull && docker compose -f docker-compose.quickstart.yml up -d
Migrations run at boot, and documents that finished before the upgrade get
any new processing step in the background. On Portainer or TrueNAS,
redeploy the stack with the latest image. With the default
SESSION_STORE=memory, the restart signs everyone out.
From a stack older than search: search needs Postgres with
pgvector, so the postgres service's image is now
pgvector/pgvector:pg17 instead of
postgres:17-alpine. Paste the new file again, or change that one
line, before you pull. The data volume is kept as it is. On its first boot
Engrafo rebuilds its database indexes and then indexes every document it
already has, in the background; search answers from what is done so far.
Without the new image, the engrafo container stops at boot and
its log says so.
Coming from MinIO
Earlier versions of the quickstart file ran MinIO. RustFS cannot read a
MinIO data directory, so the new stack starts on an empty
engrafo_rustfs volume and leaves engrafo_minio
untouched beside it. Your files are not lost, but Engrafo lists documents
it cannot open until they are copied across. The README's
Coming from a MinIO install
has the commands: rename the MINIO_ variables to
RUSTFS_, start RustFS alone, run the old MinIO from its volume
and mc mirror both buckets across. Remove the old volume only
once you have opened a few documents from the new stack.
Full documentation lives in the project README: https://github.com/cubicecho/engrafo · Back to the overview