Drel/Docs/Self-host
Deployment · three options

Run Drel on your side.

Pick the option that matches what you want to control. The three are independent — you can start with one and add another later, and your web app never changes.

Choose your option

Option A

Only the push relay

Your own push address on your own hostname. Hosted apps and everything else keep working.

  • One Go binary, or one Docker image
  • The bundled community key covers the stock app — no Apple account needed
  • About 15 minutes
Read option A →
Option B

Only the gateway

A private app market: app identity, strong offline packages, and the native actions you declare.

  • One Go binary or Docker image
  • Needs an Ed25519 signing key
  • About 30 minutes
Read option B →
Option C

Both of them

Fully off the hosted services: your own push and your own app market, on one host or split across two.

  • One host, or two independent deployments
  • Needs both an APNs signer and an Ed25519 key
  • About an hour
Read option C →
Which one? Ask two questions. Do you want to control which apps can be installed on your phone? That means option B. Do you want to control where your notifications come from? That means option A. Both means option C.

What you deploy it with

Pick the runtime that matches your machine. The contract is identical either way, so you can move between them later.

ShapeStackBest forNeeds a server?
Go binary + systemd Go 1.23, static, 6 MB, push + gateway Any machine — recommended for new deployments Yes, one
Go binary + Docker Same binary, scratch image You want Compose but no dependencies Yes, one
Cloudflare Worker Workers + Durable Objects Push only — no server at all Only for the gateway
One 6 MB Go binary covers every option. Since 2026-10-23 the Go binary serves the gateway routes too — /api/v1/gateway and /api/v1/html-apps are built in. The former Swift container was removed on 2026-11-28. A Cloudflare Worker can still host the push half — see infra/cloudflare/drel-api-proxy/.
# Prepare everything in one step: the signing key, the env file,
# the exact start command and the verification command
bash tools/prepare-drel-deployment.sh both --domain push.example.com

Where every key lives

Self-hosting raises the question of which secret sits on which side. The short answer: every private key is generated once and stays where it was created. Nothing in the handshake below sends a private key over the wire.

Drel key and trust sequence. Phase 1: the phone generates its device key and its X25519 encryption key pair, and keeps the private half. Phase 2: the phone asks the relay for a single-use pairing ticket, then registers its APNs token, device key and public encryption key. Phase 3: the sender posts to the address, the relay signs a provider JWT locally with its APNs .p8 key, and Apple APNs delivers over HTTP/2. Phase 4: the gateway serves the signed manifest and the phone verifies it with the Ed25519 public key.
The four secrets, and where each one stays. The X25519 private key never leaves the phone keychain. The APNs .p8 never leaves your relay. The Ed25519 private key never leaves your gateway. The pairing ticket is single use and short lived. The relay stores only your public encryption key.

Two facts that decide the architecture

FactConsequence
Go serves both relay and gateway The Go binary includes /api/v1/html-apps and /api/v1/gateway. A separate server is not required.
Go serves both roles from one process Option C on one host uses one Go process. Split it only when different teams own the two jobs.
Two deployment topologies. A: one host with the Go self-hosted service and APNs. B: separated, with the official Cloudflare Worker on one side and a private Go relay on the other.
Both shapes speak the same contract. Your web app never talks to either of them, so a deployment can move from one shape to the other without touching the app.

Option A · Push relay only

You get an address like https://push.example.com/ that works in any Bark-compatible script. Keep the stock Drel app and pair it with your relay: notifications travel from your relay straight to Apple and never pass through the official push service. Hosted apps and the hosted gateway stay as they are.

# Build the static Linux binary on a development machine
bash tools/build-drel-selfhosted-native.sh
scp Server/native/dist/drel-selfhosted root@server:/usr/local/bin/
scp Server/native/drel-selfhosted.service root@server:/etc/systemd/system/

# /etc/drel-selfhosted/drel-selfhosted.env
DREL_LISTEN_ADDR=127.0.0.1:8080
DREL_SELF_HOSTED_PUBLIC_BASE_URL=https://push.example.com
DREL_DATA_DIR=/var/lib/drel-selfhosted
APNS_ENVIRONMENT=production
APNS_TOPIC=com.webbridgekit.superapp
APNS_KEY_ID=4M53447M36
APNS_TEAM_ID=B45VZCNYU3
APNS_KEY_PATH=/etc/drel-selfhosted/secrets/AuthKey_4M53447M36.p8
# copy Server/community-apns/AuthKey_4M53447M36.p8 there, mode 0640

systemctl daemon-reload && systemctl enable --now drel-selfhosted
curl https://push.example.com/health   # apnsReady must be true
Prefer a Cloudflare Tunnel. The service listens on 127.0.0.1 only, so you never open port 443 or 8080 to the internet. If the host already runs a reverse proxy, forward its public HTTPS traffic to http://127.0.0.1:8080.
The APNs authority boundary. Direct APNs delivery needs a signer authorized for the app's topic. The repository ships one on purpose: Server/community-apns/AuthKey_4M53447M36.p8 is registered to the stock Drel app only and to the production environment only, so it reaches TestFlight and App Store builds but no other app and no debug build. Whoever runs your relay can send notifications to the devices that paired with it — nothing more. The key can be revoked at any time. Running your own signed Drel build? Its bundle ID is yours, so create your own topic-specific .p8. Without a valid key the relay reports apnsReady: false and refuses pairing, which is the correct behaviour.

Option B · Gateway only

You keep using any compatible push relay, but you control app identity, strong offline packages and native action declarations. The phone then trusts only the manifests you signed.

# Generate the signing key
openssl genpkey -algorithm ed25519 -out gateway-ed25519.pem
openssl pkey -in gateway-ed25519.pem -outform DER 2>/dev/null \
  | tail -c 32 | base64 | tr '+/' '-_' | tr -d '='
# -> GATEWAY_PRIVATE_KEY

bash tools/prepare-drel-deployment.sh gateway --domain hub.example.com
# Copy build/deployment/drel.env and the generated key seed to your Go service.

curl https://hub.example.com/api/v1/gateway
# -> { "publicKeyId": "gw-2026-10-23", "publicKey": "..." }

Register an app, then import the gateway on the phone. The client verifies the health endpoint, the response origin, every manifest, the origin restrictions, the key id and the signature — and saves nothing until you confirm.

Option C · Both

C1 · One host

Because the Go service registers the gateway routes and push routes together, this is one process with one hostname.

bash tools/prepare-drel-deployment.sh both --domain hub.example.com
# Fill build/deployment/drel.env, install the Go binary, then start it with
# the generated gateway and APNs settings.

That one hostname then serves the push address, the app manifests and the health check. The optional Node admin console adds a graphical push console at /admin-push with a device list.

C2 · Split hosts

A separated deployment runs the Go gateway on one host and the Go relay for push on another. The phone imports each address separately, so an outage in one does not affect the other. Use this when different teams own the two jobs.

Pair the phone

For each deployment, open Drel → Settings and import the address. The client validates it and shows a report before anything is saved.

What you deployedWhere to import itWhat you get
Option ASettings → Self-hosted pushA push address on your own hostname
Option BSettings → GatewayYour own signed app list
Option CBoth screensTwo independent trust relationships
Changing a gateway drops the old grants. Switching the origin or the public key identity clears the capability grants of the apps verified under the previous gateway, so a permission never follows to a new identity.

Let an agent do it

The Drel skill includes the full deployment procedure — the environment variables, the compose files, the pairing flow and the safety boundaries.

npx skills add dyyz1993/Drel --skill drel-app-development

Then tell the agent which option you want, for example “help me deploy option C on one host”. Read the skill page for the manual import path.

Safety boundaries

MaterialAllowsDoes not allow
Device push addressAlert that one Drel installationRead message history, fetch an APNs token, or reach the phone
Topic-scoped APNs signerAuthenticate delivery for one bundleRead notifications or address arbitrary apps
iPhone private keyDecrypt encrypted envelopes on that deviceSend APNs notifications or be exported by the server

Never publish the APNs .p8. A gateway configuration carries public endpoints and a public key only — never an APNs token, device key, API secret, admin token or password.