Help

Help

For AI agents

Instructions for AI agents that install, configure or troubleshoot a Postern Hub - the facts, paths, commands, checks and rules to follow, and where the Markdown docs are.

This page has instructions for several ways of running the Hub. Each is shown under its name.

This page is written for AI coding agents with shell access that set up or look after a Postern Hub for a person. It is the short, exact version of the docs: facts, commands, checks and rules. People can read it too. For a ready-made prompt, see Set up with an AI agent.

Reading these docs #

  • Every page is plain Markdown at its address with .md instead of the trailing slash: https://docs.posternmail.app/setup.md. Section pages are also at .../index.md (for example /docs/reach/index.md).
  • https://docs.posternmail.app/llms.txt lists every page with a one-line description, in reading order. https://docs.posternmail.app/llms-full.txt is all pages in one file.
  • In the Markdown, a line such as **Debian and Ubuntu, Fedora and RHEL and Raspberry Pi OS:** starts the instructions for those install methods. Follow only the ones for the method in use.
  • The docs are built from the docs/ folder of https://github.com/TheOriUHD/postern. When the docs and the code disagree, the code is right; tell the person.

Facts #

What Postern is A self-hosted mail client: the Hub (one Go binary, postern-hub) plus web, desktop, iOS and Android apps. Not a mail server: it connects to existing mailboxes over IMAP/SMTP, the Gmail API, Microsoft Graph or JMAP.
Status Beta. No releases, packages, container images or signed installers exist yet. Build from source. deploy/install.sh, .deb/.rpm and ghcr.io/theoriuhd/postern-hub are planned and do not work yet.
Server platform Linux, amd64 or arm64. systemd for the binary install; Docker Engine 23+ with Compose for the container.
Build tools Go 1.27+ (hub/go.mod), Node.js 24+, pnpm 11 via corepack enable (package.json). Docker builds need none of these on the host.
Default listen address 127.0.0.1:8080. Never expose plain HTTP publicly.
Health check curl -fsS http://127.0.0.1:8080/api/v1/info returns JSON; "setupRequired":true until the admin account exists.
Configuration Environment variables POSTERN_* (Configuration). Legacy MC_* names are still read.
First admin Created in the browser setup, protected by a one-time setup code (postern-hub setup-code).
Secrets The master key file, the setup code, POSTERN_*_SECRET values, POSTERN_KEY_PASSPHRASE, mailbox passwords and tokens.

Paths and commands for the method in use #

Docker Compose

Source checkout ~/postern-src
Compose project ~/postern with compose.yaml (from deploy/docker/compose.yaml) and .env
Image built locally: docker build -f deploy/docker/Dockerfile -t ghcr.io/theoriuhd/postern-hub:local . in the source checkout; .env has POSTERN_VERSION=local
Variables .env for POSTERN_PUBLIC_URL, POSTERN_TRUST_PROXY, POSTERN_RELAY_URL, POSTERN_LOG_FORMAT, POSTERN_BIND, POSTERN_DOMAIN, POSTERN_VERSION, TZ; anything else in ~/postern/compose.override.yaml under services: hub: environment:
Data, key volumes postern_postern-data (/data) and postern_postern-key (/key/hub.key)
Run a command cd ~/postern && docker compose exec hub postern-hub <command> (docker compose run --rm hub <command> while stopped)
Apply changes docker compose up -d
Logs docker compose logs -f hub
Upgrade git -C ~/postern-src pull, rebuild the image with the same tag, docker compose up -d

Debian and Ubuntu, Fedora and RHEL and Raspberry Pi OS

Source checkout ~/postern
Build pnpm install --frozen-lockfile --filter "@postern/web..." then scripts/build-hub.sh, output hub/bin/postern-hub
Binary /usr/local/bin/postern-hub (installed with sudo install -m 0755)
Service /etc/systemd/system/postern-hub.service, from deploy/systemd/postern-hub.service with ExecStart=/usr/local/bin/postern-hub serve
Variables /etc/postern/hub.env, root:postern, mode 0640, one KEY=value per line, no inline comments
Data, key /var/lib/postern, /var/lib/postern-key/hub.key (user postern, mode 0700)
Run a command sudo -u postern sh -c 'set -a; . /etc/postern/hub.env; exec /usr/local/bin/postern-hub <command>'
Apply changes sudo systemctl restart postern-hub
Logs sudo journalctl -u postern-hub -f
Upgrade git pull, rebuild, sudo install -m 0755 hub/bin/postern-hub /usr/local/bin/postern-hub, sudo systemctl restart postern-hub

Desktop app (built-in Hub)

What it is The desktop app's No server? Run a Hub on this computer. Runs only while the app is open, on 127.0.0.1 only.
Build pnpm install, scripts/build-hub.sh --web-only, pnpm --filter @postern/desktop bundle-hub, pnpm --filter @postern/desktop dist; installers in apps/desktop/release/
Data, key hub-data/ and hub-key/hub.key in the app data folder: ~/Library/Application Support/Postern, %APPDATA%\Postern, ~/.config/Postern
Logs logs/hub.log in the app data folder
Configuration None; the app manages the Hub. Other devices cannot reach it.

Steps for a new Hub #

  1. Ask the person: is this the right machine, how will devices reach the Hub (Tailscale, a domain with a reverse proxy, Cloudflare Tunnel, LAN only), and which mailboxes they plan to connect.
  2. Follow the setup guide for the method, in order. Run every Check and stop at the first one that fails.
  3. Set up access with the matching page under Reaching your Hub. Set POSTERN_PUBLIC_URL to the exact address the person will type, without a trailing slash. Set POSTERN_TRUST_PROXY=true only when a proxy (Caddy, nginx, Traefik, tailscale serve, cloudflared) is the only way in.
  4. Run postern-hub doctor (see above for how) and fix what it reports.
  5. Hand over: the address, how to get the setup code, the reminder to back up the master key, and the next steps (passkey or two-step verification, mailboxes, pairing the phone).

Rules #

Always:

  • verify every download against its published checksum before unpacking or running it;
  • keep the Hub on 127.0.0.1 behind HTTPS (Tailscale, a reverse proxy or Cloudflare) unless the person chose LAN only;
  • keep the master key file outside the data folder, and tell the person to back it up separately;
  • use sudo only for the steps that need root (installing files, managing the service);
  • show the person what you are about to change in /etc/postern/hub.env, .env or compose.override.yaml before you change it.

Never:

  • publish port 8080 (or POSTERN_LISTEN/POSTERN_BIND) on a public address, forward it on a router, or turn on tailscale funnel unless the person asks for it and understands it;
  • print, paste into chat, log or commit any secret listed above; refer to files by path instead;
  • skip TLS or checksum verification, pipe an unread script into a shell, or install toolchains from unofficial sources;
  • set POSTERN_DEV, run postern-hub keygen --force or rotate-key without being asked, or delete the data folder, the key folder or the Docker volumes;
  • create the admin account, choose passwords, or handle mailbox passwords, app passwords or OAuth client secrets for the person;
  • disable SELinux, AppArmor or the firewall to make something work.

Verifying a running Hub #

Docker Compose

cd ~/postern
docker compose ps
curl -fsS http://127.0.0.1:8080/api/v1/info
docker compose exec hub postern-hub doctor

Debian and Ubuntu, Fedora and RHEL and Raspberry Pi OS

systemctl is-active postern-hub
curl -fsS http://127.0.0.1:8080/api/v1/info
sudo -u postern sh -c 'set -a; . /etc/postern/hub.env; exec /usr/local/bin/postern-hub doctor'

Desktop app (built-in Hub)

Open the app; it reports problems with the built-in Hub itself. logs/hub.log in the app data folder has the details.

From another device, open POSTERN_PUBLIC_URL in a browser: the setup page or the sign-in page must load over HTTPS without a certificate warning (unless the person chose LAN only).

Where to look when something fails #

Problem Page
Error messages, by symptom Troubleshooting
What doctor reports Doctor
A variable or its default Configuration
A command or flag Command line
Files, ports, owners Ports and paths
Proxy, HTTPS, Tailscale, Cloudflare Reaching your Hub