Start here

Start here

Set up with an AI agent

Ready-to-copy prompts that let an AI coding agent with shell access install a Postern Hub for you, one per install method, with what it must ask you, what it must never do and how it checks its work.

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

A coding agent with shell access on the Hub's machine (Claude Code, Codex, Gemini CLI, Cursor and similar) can do the setup guide for you. Copy the prompt below into the agent, started on the machine where the Hub should run. The prompt follows the install method chosen in the selector above.

The agent asks you a few questions first, then works through the steps and checks each one. You stay in charge of three things it must not do for you: creating your admin account in the browser, storing the master key backup, and connecting your mailboxes.

Warning

An agent with shell access can change anything your user can change, and with sudo anything at all. Run it on the machine you mean, read the commands it proposes before you approve them, and do not give it passwords, app passwords or tokens. Nothing in this setup needs them.

The prompt #

Docker Compose

You are setting up a Postern Hub on this Linux machine with Docker Compose. Postern is a self-hosted mail client; the Hub is its server. No releases or container images are published yet, so you build the image from source.

Documentation (plain Markdown, read these before you start and follow them over your own assumptions):
- https://docs.posternmail.app/agents.md (rules and facts for agents)
- https://docs.posternmail.app/setup.md (the setup guide; follow the "Docker Compose" variant)
- https://docs.posternmail.app/llms.txt (index of every page)

Before you change anything, ask me in one message:
1. Is this the machine that should run the Hub, and does it stay on?
2. How should my devices reach the Hub: Tailscale (recommended), a reverse proxy with my own domain (which domain?), Cloudflare Tunnel (which hostname?), or my home network only?
3. Which mailboxes do I want to connect (for example Gmail, Outlook, iCloud, an IMAP server)? You only need this to tell me what to prepare; I connect them myself.
Then wait for my answers.

Do the work in this order, and after every step run its "Check" from the guide and show me the result:
1. Check that Docker Engine 23+ and the Compose plugin work (docker compose version) and that Git is installed. If Docker is missing, tell me and point me to https://docs.docker.com/engine/install/ instead of piping a script into a shell.
2. git clone https://github.com/TheOriUHD/postern.git ~/postern-src
3. In ~/postern-src: docker build -f deploy/docker/Dockerfile -t ghcr.io/theoriuhd/postern-hub:local --build-arg VERSION="$(git describe --tags --always)" --build-arg COMMIT="$(git rev-parse HEAD)" .
4. mkdir -p ~/postern, copy deploy/docker/compose.yaml there, write .env with POSTERN_VERSION=local, run docker compose up -d. Check: docker compose ps shows (healthy) and curl -fsS http://127.0.0.1:8080/api/v1/info answers.
5. Set up the access method I chose, following https://docs.posternmail.app/reach.md and its sub-page. Set POSTERN_PUBLIC_URL to the exact address I will use, and POSTERN_TRUST_PROXY=true only if a proxy or tailscale serve sits in front. Variables that compose.yaml does not pass through go in ~/postern/compose.override.yaml. Apply with docker compose up -d.
6. Run: docker compose exec hub postern-hub doctor and fix every problem it reports that is within this setup.
7. Tell me how to open the setup page (the public address, or ssh -L 8080:127.0.0.1:8080 to this machine) and the command that shows the setup code (docker compose exec hub postern-hub setup-code), so I can create my admin account myself.
8. Tell me to back up the master key, with the command (docker compose cp hub:/key/hub.key ./hub.key.backup) and the reminder to move it off this machine and delete the local copy.

Never:
- publish the Hub's plain HTTP port to the internet (no POSTERN_BIND=8080 or 0.0.0.0 on a machine with a public address, no router port forwarding to 8080, no tailscale funnel unless I ask for it);
- print, copy into chat, log or commit secrets: the master key, the setup code, POSTERN_*_SECRET values, tokens, passwords;
- skip or weaken a checksum, signature or TLS verification, or pipe a downloaded script into a shell without showing it to me first;
- set POSTERN_DEV, run postern-hub keygen --force, or delete Docker volumes (postern_postern-data, postern_postern-key);
- create the admin account, choose passwords for me, or enter mailbox credentials.

When something fails, read the logs (docker compose logs hub), look it up in https://docs.posternmail.app/troubleshooting.md, and explain the cause before you try a fix. Finish with a short report: what you installed and where, the Hub's address, the output of doctor, and what I still have to do.

Debian and Ubuntu, Fedora and RHEL and Raspberry Pi OS

You are setting up a Postern Hub on this Linux machine as a systemd service. Postern is a self-hosted mail client; the Hub is its server. No releases or packages are published yet, so you build the Hub from source.

Documentation (plain Markdown, read these before you start and follow them over your own assumptions):
- https://docs.posternmail.app/agents.md (rules and facts for agents)
- https://docs.posternmail.app/setup.md (the setup guide; follow the variant for this distribution: "Debian and Ubuntu", "Fedora and RHEL" or "Raspberry Pi OS")
- https://docs.posternmail.app/llms.txt (index of every page)

Before you change anything, ask me in one message:
1. Is this the machine that should run the Hub, and does it stay on?
2. How should my devices reach the Hub: Tailscale (recommended), a reverse proxy with my own domain (which domain?), Cloudflare Tunnel (which hostname?), or my home network only?
3. Which mailboxes do I want to connect (for example Gmail, Outlook, iCloud, an IMAP server)? You only need this to tell me what to prepare; I connect them myself.
Then wait for my answers.

Do the work in this order, and after every step run its "Check" from the guide and show me the result:
1. Confirm the system: uname -m must be x86_64 or aarch64 (on a Raspberry Pi, a 64-bit OS), systemd must be running.
2. Install git, curl, jq, xz and tar with the system package manager (apt or dnf). Install Go (1.27 or newer) from https://go.dev/dl/ and Node.js 24 from https://nodejs.org/dist/latest-v24.x/ exactly as the guide shows, verifying each download's SHA-256 against the published checksum before unpacking, then enable pnpm with corepack.
3. git clone https://github.com/TheOriUHD/postern.git ~/postern, then in ~/postern: pnpm install --frozen-lockfile --filter "@postern/web..." and scripts/build-hub.sh. Check: hub/bin/postern-hub version.
4. Install it as the guide's step 4 shows: binary to /usr/local/bin/postern-hub, system user and group postern, /etc/postern (root:postern 0750) with hub.env from deploy/systemd/hub.env (0640, only if it does not exist yet), /var/lib/postern and /var/lib/postern-key (postern, 0700), the unit from deploy/systemd/postern-hub.service with ExecStart changed to /usr/local/bin/postern-hub, then systemctl daemon-reload and enable --now. Check: systemctl status and curl -fsS http://127.0.0.1:8080/api/v1/info.
5. Set up the access method I chose, following https://docs.posternmail.app/reach.md and its sub-page. Keep POSTERN_LISTEN=127.0.0.1:8080 unless I chose home network only. Set POSTERN_PUBLIC_URL in /etc/postern/hub.env to the exact address I will use, and POSTERN_TRUST_PROXY=true only if a proxy or tailscale serve sits in front. Restart with systemctl restart postern-hub.
6. Run doctor as the service user: sudo -u postern sh -c 'set -a; . /etc/postern/hub.env; exec /usr/local/bin/postern-hub doctor' and fix every problem it reports that is within this setup.
7. Tell me how to open the setup page (the public address, or ssh -L 8080:127.0.0.1:8080 to this machine) and the command that shows the setup code (the same sudo form with setup-code), so I can create my admin account myself.
8. Tell me to back up the master key /var/lib/postern-key/hub.key: give me the command to copy it to my home folder with mode 0600, and remind me to move it off this machine and delete the local copy.

Never:
- expose the Hub's plain HTTP port to the internet (no POSTERN_LISTEN=0.0.0.0 on a machine with a public address, no firewall rule or router forwarding for 8080, no tailscale funnel unless I ask for it);
- print, copy into chat, log or commit secrets: the master key, the setup code, POSTERN_*_SECRET values, tokens, passwords;
- skip or weaken a checksum, signature or TLS verification, or pipe a downloaded script into a shell without showing it to me first;
- set POSTERN_DEV, run postern-hub keygen --force, or delete /var/lib/postern or /var/lib/postern-key;
- use sudo where it is not needed (building runs as my user), or disable SELinux or the firewall;
- create the admin account, choose passwords for me, or enter mailbox credentials.

When something fails, read the logs (sudo journalctl -u postern-hub -n 100 --no-pager), look it up in https://docs.posternmail.app/troubleshooting.md, and explain the cause before you try a fix. Finish with a short report: what you installed and where, the Hub's address, the output of doctor, and what I still have to do.

Desktop app (built-in Hub)

You are building the Postern desktop app from source on this computer, so that I can use its built-in Hub ("No server? Run a Hub on this computer"). Postern is a self-hosted mail client. No signed installers are published yet.

Documentation (plain Markdown, read these before you start and follow them over your own assumptions):
- https://docs.posternmail.app/agents.md (rules and facts for agents)
- https://docs.posternmail.app/setup.md (the setup guide; follow the "Desktop app (built-in Hub)" variant)
- https://docs.posternmail.app/apps/desktop.md (building and installing the desktop app)

Before you change anything, tell me in one message what the built-in Hub can and cannot do (it runs only while the app is open, only this computer can reach it, phones cannot connect to it) and ask whether that is what I want, or whether I would rather run the Hub on a server. Then wait for my answer.

Then:
1. Check the tools: git, Go 1.27 or newer, Node.js 24, pnpm 11 (via corepack enable). On Windows use Git Bash. If something is missing, tell me which official installer to use (git-scm.com, go.dev/dl, nodejs.org); do not install toolchains from unofficial sources.
2. git clone https://github.com/TheOriUHD/postern.git and, inside it: pnpm install, scripts/build-hub.sh --web-only, pnpm --filter @postern/desktop bundle-hub, pnpm --filter @postern/desktop dist.
3. Check that apps/desktop/release/ holds the installer for this system, and tell me which file to open and what macOS or Windows will say about an unsigned app.
4. Tell me to open Postern, choose "No server? Run a Hub on this computer", create my account, and then copy hub-key/hub.key from the app's data folder to a safe place.

Never:
- print, copy into chat, log or commit secrets: the master key, tokens, passwords;
- skip or weaken a checksum, signature or TLS verification, or pipe a downloaded script into a shell without showing it to me first;
- use sudo or administrator rights except where the documentation says so;
- create my account, choose passwords for me, or enter mailbox credentials.

When something fails, explain the cause before you try a fix. Finish with a short report: what you built, where the installer is, and what I still have to do.

What the agent will ask you #

Question Why
Is this the right machine? The Hub should run on a machine that stays on.
How do your devices reach the Hub? Decides between Tailscale, a reverse proxy, Cloudflare Tunnel and LAN only, and with that POSTERN_PUBLIC_URL. See Reaching your Hub.
Which mailboxes? Some providers need preparation, such as an app password or your own OAuth app. See Connect mailboxes.

What stays with you #

  • Creating the admin account. You open the setup page, enter the setup code and choose your password. The agent only tells you where.
  • The master key backup. The agent gives you the command; you move the copy somewhere safe, apart from your data backups.
  • Mailboxes and devices. You connect mailboxes and pair your phone in the apps.

After the agent is done #

Read its report, then check the result yourself:

Docker Compose

cd ~/postern
docker compose ps
docker compose exec hub postern-hub doctor

Debian and Ubuntu, Fedora and RHEL and Raspberry Pi OS

systemctl status postern-hub --no-pager
sudo -u postern sh -c 'set -a; . /etc/postern/hub.env; exec postern-hub doctor'

Desktop app (built-in Hub)

Open Postern and choose No server? Run a Hub on this computer. The setup page opens in the app window.

Then continue with step 5 of the setup guide.

Writing your own prompt #

If you adapt the prompt, keep its three parts: what to ask first, the order of steps with a check after each, and the list of things never to do. For AI agents has the facts an agent needs (paths, commands, invariants) in one page, and every page of these docs is available as Markdown at its address with .md, so an agent can read exactly what you read.