README.md

Effem AppView #

The backend of the Effem podcast apps: an AT Protocol AppView written in Swift on Hummingbird 2.

It reads xyz.effem.* records from Jetstream into Postgres and serves the xyz.effem.* XRPC routes the Effem apps call: the social reads (comments, subscriptions, lists, profiles), podcast search and metadata, notifications, and moderation. It can also send APNs notifications.

It is Effem's own backend and is not offered to other clients. Podcast search and metadata are answered from the service's own cache of Podcast Index data. Every response is rebuilt as Effem's own types with the social counts attached, each caller is rate-limited, and one ceiling caps the calls the whole service may make to Podcast Index.

It runs on Railway as one resident process beside a Postgres database; see Deploying to Railway.

Document What it covers
RUNBOOK.md Day-to-day operations: logs, deploys, health states, Jetstream trouble, token rotation and moderation.
ALERTS.md What to monitor and at what thresholds.
BACKUPS.md Database backups and the restore drill.
learn.md A guided tour of the code for someone new to it.

Layout #

Path What it holds
Sources/App The effem-appview executable: reads configuration, runs the server, and exits with status 1 when it cannot start.
Sources/EffemAppView/Config AppConfig, the database URL parser and the validation rules.
Sources/EffemAppView/Database The PostgresNIO wrapper, the SQL migrator and the statement splitter.
Sources/EffemAppView/Jetstream The Jetstream reader, the ingest lease, the cursor store, host failover and the bounded runs of cron mode.
Sources/EffemAppView/Indexer Record validation, per-collection indexing, stats, notifications, account status, bans and purges, the report webhook, backfill and the watchdog.
Sources/EffemAppView/Catalog The canonical episode and podcast records, their record keys and CIDs.
Sources/EffemAppView/Identity DID document resolution and the handle cache.
Sources/EffemAppView/PodcastIndex The cache in front of Podcast Index: in-flight sharing, budgets and stale copies.
Sources/EffemAppView/Push APNs clients and the push dispatcher.
Sources/EffemAppView/API Request contexts, middleware, the XRPC routes, the did:web documents, the cron routes and the comment WebSocket.
Sources/EffemAppView/Observability Prometheus metrics and the health and liveness reports.
Sources/EffemAppView/Support The error type and its log summary, pagination, the token bucket, the startup gate and the deadline helper the health routes use.
Sources/EffemAppView/Resources Migrations, the lexicon JSON files and the bundled category list.
Tests/EffemAppViewTests Swift Testing suites; the Database suite needs Postgres.
Dockerfile, .dockerignore The image Railway builds and runs.
docker-compose.yml Postgres for local runs and the database-backed tests.
scripts/linux-build.sh, scripts/linux-test.sh The build and the tests inside the swift:6.4-noble image, against the local package checkouts.

The models shared with the clients live in the EffemModels product of EffemKit. AT Protocol syntax, DAG-CBOR, CIDs, the Jetstream frame types and DID resolution come from CoreATProtocol. The Podcast Index client is PodcastIndexKit. Package.swift names all three by URL, and Package.resolved pins the revisions the image is built from.

Running locally #

Requirements: Swift 6.4 and Docker (OrbStack works).

docker compose up -d                       # Postgres 16 on localhost:5433
cat > .env <<'EOF'
EFFEM_DATABASE_URL=postgres://effem:effem@localhost:5433/effem?sslmode=disable
EFFEM_AUTH_READ_TOKENS=dev-read=*
EFFEM_AUTH_ADMIN_TOKENS=dev-admin=*
EOF
swift run effem-appview
curl localhost:8080/_live
curl localhost:8080/_health

The database URL has to be set because the default points at port 5432 and the compose file publishes 5433. .env is ignored by git. On an empty database the server applies the thirteen migrations, starts listening and connects to Jetstream; /_health answers starting with a 503 until the first event arrives, usually within a few seconds.

The routes backed by Podcast Index answer 503 PodcastIndexUnavailable until EFFEM_PI_KEY and EFFEM_PI_SECRET are set. xyz.effem.podcast.getCategories works without them, because the category list is bundled.

Configuration #

Settings are read from command line flags, then the environment, then a .env file in the working directory. Environment names are EFFEM_ plus the key in upper snake case; the flag for the same key is --effem- plus the key in kebab case, for example --effem-database-url. Four platform names are read without the prefix as fallbacks, so a host that provides them needs no renaming: PORT, DATABASE_URL_UNPOOLED, DATABASE_URL and CRON_SECRET.

A setting that fails validation stops the server at start: it logs one critical line that names the problem and exits with status 1.

Environment variable Default Meaning
EFFEM_BIND 0.0.0.0:$PORT, else 0.0.0.0:8080 Listen address as host:port, :port or a bare port.
EFFEM_DATABASE_URL DATABASE_URL_UNPOOLED, then DATABASE_URL, then postgres://effem:effem@localhost:5432/effem?sslmode=disable postgres://user:password@host:port/db?sslmode=.... sslmode follows libpq: disable (no TLS), allow and prefer (TLS when the server offers it; prefer is the default), require (TLS without checking the certificate), verify-ca and verify-full (TLS with the certificate checked). disable is only accepted for localhost, 127.0.0.1, ::1, the names postgres and db, and names ending in .local or .internal. Use a direct connection, not a transaction pooler: the migrator's advisory lock needs a session.
EFFEM_DATABASE_LISTEN_URL DATABASE_URL_UNPOOLED, then the database URL The one connection that LISTENs for comment events. It must not go through a transaction pooler.
EFFEM_DB_MAX_OPEN_CONNS 25 Connection pool size.
EFFEM_DB_MAX_IDLE_CONNS 5 Connections kept open while idle. It may not exceed the pool size.
EFFEM_DB_CONN_MAX_IDLE_TIME 5m How long an idle connection is kept, in Go duration syntax (30s, 5m, 1h30m); a bare number is seconds.
EFFEM_JETSTREAM_HOSTS wss://jetstream.us-east.bsky.network,wss://jetstream.us-west.bsky.network Comma-separated ws:// or wss:// hosts, tried in order.
EFFEM_INGEST_MODE service service: a Jetstream reader runs inside the process for as long as it lives. cron: nothing reads on its own, and each GET /_cron/ingest performs one bounded run. cron is for hosts that cannot keep a process running; no platform selects it automatically.
EFFEM_INGEST_RUN_SECONDS 50 How long one cron run stays connected (5 to 1700).
CRON_SECRET unset Bearer token the /_cron routes require. Without it they answer 503 CronDisabled.
EFFEM_PLC_HOST https://plc.directory PLC directory for DID resolution.
EFFEM_CATALOG_DID did:web:catalog.effem.xyz Authority of the catalog records. Every subscription and comment points at it, so it must not change once users have written records.
EFFEM_LABELER_DID did:web:labeler.effem.xyz Authority of the moderation labels this service applies.
EFFEM_PI_KEY, EFFEM_PI_SECRET unset Podcast Index credentials. The routes backed by Podcast Index answer 503 until both are set.
EFFEM_PI_USER_AGENT effem-appview/1.0 Sent on every Podcast Index call.
EFFEM_AUTH_REQUIRED true When false, callers without a token get read scope and the routes backed by Podcast Index are not registered.
EFFEM_AUTH_READ_TOKENS none Comma-separated token=subject pairs. The subject is a DID for a user's token, or * for a service token with no user behind it.
EFFEM_AUTH_ADMIN_TOKENS none Same format; grants the admin scope as well as read.
EFFEM_ADMIN_DIDS none DIDs whose read tokens also get the admin scope.
EFFEM_CORS_ALLOWED_ORIGINS http://localhost:3000 Exact origins, comma-separated. At least one is required and * is rejected.
EFFEM_RATE_LIMIT_ENABLED true Turns the request limiter and the report limiter on or off.
EFFEM_RATE_LIMIT_RPS, EFFEM_RATE_LIMIT_BURST 20, 200 Request limit per client address.
EFFEM_RATE_LIMIT_SUB_RPS, EFFEM_RATE_LIMIT_SUB_BURST 40, 400 Request limit per token subject, used when no address is known and for admin tokens that carry a DID.
EFFEM_PI_CLIENT_RPS, EFFEM_PI_CLIENT_BURST 1, 120 Podcast Index calls one client may cause.
EFFEM_PI_SERVICE_RPS, EFFEM_PI_SERVICE_BURST 2, 120 Podcast Index calls the whole service may make.
EFFEM_TRUSTED_PROXY_CIDRS none Comma-separated ranges the proxy in front connects from. Loopback, link-local and private ranges are always trusted. On Railway: 100.64.0.0/10.
EFFEM_CLIENT_ADDRESS_HEADER unset Name of a header the proxy in front sets to the caller's address. When set, and only when the socket peer is in a trusted range, its value is the client address and X-Forwarded-For is not consulted. On Railway: X-Real-IP.
EFFEM_REPORT_WEBHOOK_URL unset An http or https URL that gets a short JSON notice when a new report arrives. Slack and Discord incoming webhooks both accept the body.
EFFEM_APNS_KEY_PATH or EFFEM_APNS_KEY, plus EFFEM_APNS_KEY_ID, EFFEM_APNS_TEAM_ID, EFFEM_APNS_BUNDLE_ID unset The .p8 key as a file or as PEM text (\n accepted for newlines). Push delivery is on when the key and all three identifiers are set.
EFFEM_LOG_LEVEL info trace to critical.

The configuration reader treats the database URLs, the Podcast Index credentials, the two token maps, the APNs key text, the report webhook URL and the cron secret as secrets and redacts them in its own debug output.

Tokens #

Authentication is by static bearer token, sent as Authorization: Bearer or X-API-Key. There is no per-user sign-in on this service.

  • The token shipped in the iOS app goes in EFFEM_AUTH_READ_TOKENS as <token>=*. The * makes it a service token. A subject such as did:plc:* would be read as one user's DID, and every per-user route would then answer 403.
  • EFFEM_AUTH_ADMIN_TOKENS holds a separate token for operators. The app's token must never be listed there: everyone who has the app has that token. Give an operator's token that operator's DID as its subject, because the subject is what resolved_by, banned_by and the audit log record. A token whose subject is a DID also acts as that account wherever a route depends on the caller: it is the viewer on the reads that take one (see Routes), and the notification routes and backfillSelf act on that account.
  • The routes that act on the caller's own account (the notification routes and xyz.effem.actor.backfillSelf) need a token whose subject is a DID. With the app's service token they answer 401.
  • With the app's service token, a DID the app passes is taken as given: the did parameter of the per-user reads, the did of a report and the viewer of a read. The service checks its form and cannot check that the person using the app is that account, because it does not authenticate individual users yet.

Client address #

The request limiter, the Podcast Index budget and the ip= field of the request log all use the client address, which ClientAddressResolver works out as follows:

  1. A socket peer outside the trusted ranges is the client, whatever any header says.
  2. Otherwise, if EFFEM_CLIENT_ADDRESS_HEADER is set and the request carries that header with an address in it, that address is the client.
  3. Otherwise the resolver walks X-Forwarded-For from the right and takes the first address that is not in a trusted range.
  4. If every address in the list is trusted, the leftmost one is taken. With no list at all, the socket peer is the answer.

Routes #

Outside /xrpc:

Route Access What it answers
GET /_live open Liveness: {"status":"ok","db":true} with 200 when the database answers a SELECT 1 within three seconds, otherwise 503 with "status":"unavailable". It says nothing about Jetstream. Railway's deploy health check uses it.
GET /_health open Health, read from the database so every instance answers the same. 200 ok; 503 starting until the first Jetstream cursor is saved; 503 degraded when the newest event is more than 300 seconds old or the database does not answer within three seconds. For the uptime monitor.
GET /metrics admin token Prometheus text for this process only.
GET /.well-known/did.json open A bare did:web document for the catalog or the labeler identity, each served only to requests whose Host is that identity's host name; 404 for any other host.
GET /_cron/ingest, /_cron/watchdog, /_cron/cache-cleanup CRON_SECRET bearer One pass of the work a service mode process does on its own; see Ingestion.

/_health reports status, db, firehose_up (a reader holds the ingest lease), firehose_seq and firehose_age_s (seconds since the newest event). The firehose_ names date from the Go service this one replaced; monitors read them, so they stay.

Both routes give the database three seconds. When it does not answer in that time, whether it cannot be reached or it accepts a query and stays silent, /_live answers 503 unavailable and /_health answers 503 degraded with "db":false, about three seconds after the request. RUNBOOK.md, "Health states", has what was measured.

Under /xrpc/, every route needs a token with read scope. Routes are GET unless marked.

Family Routes (xyz.effem. prefix omitted)
A user's own records feed.getSubscriptions, feed.getLists, feed.getBookmarks, feed.getEpisodeStates, feed.getBlocks. With a user's token the did parameter must be that user's DID.
Social reads feed.getSubscribers, feed.getRecommendations, feed.getPopular, feed.getList, actor.getProfile
Comments feed.getComments, feed.getCommentThread, feed.getBoosts, and the WebSocket feed.subscribeComments
Catalog feed.resolveEpisode, feed.resolvePodcast, feed.getEpisodeRecord, feed.getPodcastRecord, feed.describeLexicons
Podcasts search.podcasts, podcast.getPodcast, podcast.getEpisodes, podcast.getEpisode, podcast.getTrending, podcast.getCategories, podcast.getRecentEpisodes
Notifications notification.listNotifications, notification.getPreferences, and by POST: notification.updateSeen, notification.setPreferences, notification.registerDevice, notification.unregisterDevice
Moderation POST moderation.createReport
The caller's account POST actor.backfillSelf
Admin (admin scope) admin.listReports, admin.getReportedContent, admin.listBans, admin.listIndexerErrors, admin.listLabels, and by POST: admin.resolveReport, admin.removeContent, admin.banAccount, admin.unbanAccount, admin.purgeAccount, admin.backfillUser, admin.applyLabel, admin.removeLabel, admin.importLabels

Five reads take an optional viewer parameter, the DID of the person looking: feed.getComments, feed.getCommentThread, feed.getRecommendations, feed.getSubscribers and feed.getBoosts. With a viewer, rows from accounts on either side of a block with that DID are left out, and a thread whose root comment is one of them answers 404. The two comment reads also return the viewer's own like on each comment (viewer_like_uri) and apply the labels of the labelers the viewer's profile subscribes to. A token whose subject is a DID is its own viewer, and the parameter is ignored. With the app's service token the parameter names the viewer; a value that is not a DID is ignored. The count of getSubscribers and the reply_count of a thread do not depend on the viewer. Likes and blocks are public records, so the parameter shows nothing that the repositories do not.

The feed.* lists are paged with limit (50 by default, 100 at most) and cursor. An answer with a non-empty cursor has another page; pass the value back unchanged. The cursor is the record key of the last item, and a list runs from the highest key down, which for comments, recommendations, lists, bookmarks and boosts means newest first. feed.getSubscribers is the exception: every subscription to one podcast has the same record key, so its list runs in DID order and its cursor is the last DID. feed.getPopular is not paged.

JSON responses use snake_case keys, and request bodies are read the same way. The four catalog routes that return records answer with camelCase keys, exactly as each record's CID was computed, and describeLexicons returns the lexicon files in Resources/Lexicons as written. Errors are {"error":"<code>","message":"<text>"}. A request body over 64 KB is answered with 413 PayloadTooLarge, and one that is not valid JSON with 400 InvalidRequest. An error no handler expected is answered with a bare 500 and logged as request failed with a one-line summary of the cause.

Comment updates stream over a WebSocket at /xrpc/xyz.effem.feed.subscribeComments?subject=<episode AT-URI>. The events travel between processes through Postgres NOTIFY, so a stream sees comments whichever instance indexed them. The server does not replay: a client that reconnects reloads the newest page.

Reports, bans and deleted accounts #

POST /xrpc/xyz.effem.moderation.createReport takes a private report:

{"did": "did:plc:reporter", "subject": "at://did:plc:author/xyz.effem.feed.comment/3k...", "reason_type": "harassment", "reason": "optional free text"}

subject is the AT-URI of a record or the DID of an account, reason_type is spam, abuse, harassment or other, and reason is at most 2000 characters. With a service token did is required and names the reporter; with a user's token the reporter is the token's DID. The answer is {"ok":true}. A report made this way is not a record: nothing is written to the reporter's repository and only the admin routes can read it. Repeating a report that is still pending changes nothing; repeating one that was closed opens it again. One reporter, and one client address, may send ten reports at once and then one every thirty seconds.

xyz.effem.moderation.report records are still indexed, for clients that write them. admin.listReports marks each report with source: record or private.

admin.banAccount hides an account from everything other people read: its comments, replies, boosts and recommendations, its place in a podcast's subscriber list, its lists when fetched by URI, and its profile. The counters leave it out as well: the subscriber, comment, recommendation, bookmark, boost and like counts, and the feed.getPopular ranking. Its new records are still indexed but notify nobody and reach no open comment stream. Nothing is deleted, so admin.unbanAccount brings everything back. The reads that take an account's own DID (feed.getSubscriptions, feed.getLists, feed.getBookmarks, feed.getEpisodeStates and feed.getBlocks) are not filtered, because the service cannot tell who is asking. The state lives in account_status next to the relay's own active flag, which follows #account events and never lifts a ban. An account the relay marks inactive is left out of the same reads and counters. RUNBOOK.md has the full list.

When EFFEM_REPORT_WEBHOOK_URL is set, each new report posts {"text": "...", "content": "...", "report": {"id", "subject", "reason_type", "source"}} to it. The notice never includes the reporter or their free text.

A purge removes what the service holds about one account: the rows indexed from its records, its profile and identity cache entry, the notifications to and from it, and its notification settings and device tokens. The affected counters are recomputed. It keeps the account_status row, so a ban or a deleted state persists, and it keeps reports (the ones the account filed and the ones about it), labels and the audit log. It runs by itself when Jetstream delivers an #account event that says the account was deleted; other inactive states only hide the account, because those accounts can come back. An operator runs it with POST /xrpc/xyz.effem.admin.purgeAccount and {"did": "did:plc:..."}, which answers {"ok":true,"removed":<rows>}. The account's own records stay in its repository, so a later backfill indexes them again if they are still there.

Ingestion #

The reader subscribes to the four Jetstream kinds (commit, identity, account and sync) for the twelve xyz.effem.* collections. The position is saved once a second in jetstream_cursor as a sequence number, the host it came from and the event's time. A reconnect to the same host resumes by sequence number. A reconnect to the other host resumes by time, rewound five seconds, because sequence numbers are local to each host. After three failed connections in a row the reader switches host.

Only one reader runs at a time, whichever process it is in: a reader takes the row in ingest_lease before connecting, renews it every five seconds while it reads, and releases it when it stops. A lease that is not renewed for thirty seconds expires and the next reader takes it. A second instance of the service therefore serves requests and waits; it does not ingest.

Accounts waiting for a backfill are rows in backfill_queue. A sync event for a known account queues that account. A cursor the host no longer has queues every known account. A worker claims one account at a time; a claim older than fifteen minutes is handed out again, a failed attempt waits five minutes, and the fifth failure drops the account with backfill abandoned in the log.

Records that fail to index are rows in indexer_errors. The watchdog retries them from the account's PDS when the service starts and then every hour, up to five attempts each. Cache rows that expired more than thirty days ago are deleted when the service starts and then once a day.

In service mode all of this runs inside the process, and this is how the service runs in production. cron mode exists for hosts that only run a process while it serves a request. There, nothing runs on its own and a scheduler calls the routes under /_cron/ with Authorization: Bearer <CRON_SECRET>: ingest reads for EFFEM_INGEST_RUN_SECONDS from the saved cursor and then drains the identity, backfill and push queues; watchdog runs one retry sweep; cache-cleanup runs one cleanup pass. The routes are safe to call while a service mode process also runs: an ingest call finds the lease taken and answers with "status":"skipped".

To try cron mode locally, add EFFEM_INGEST_MODE=cron and CRON_SECRET=dev to .env and call:

curl -H 'Authorization: Bearer dev' localhost:8080/_cron/ingest

Tests #

swift test
EFFEM_TEST_DATABASE_URL='postgres://effem:effem@localhost:5433/effem?sslmode=disable' swift test

swift test runs 71 tests in 14 suites. The Database suite (19 tests) is skipped without EFFEM_TEST_DATABASE_URL. It drops and recreates the public schema before every test, so point it at a throwaway database only. The suite passes on Postgres 16 and 18.

scripts/linux-test.sh runs the same tests, plus the CoreATProtocol and PodcastIndexKit tests and a build of EffemModels, inside the swift:6.4-noble image; scripts/linux-build.sh only builds the server there. Both copy the local checkouts of CoreATProtocol, PodcastIndexKit, EffemKit and NetworkingKit into a Docker volume and point the copied manifests at them, so unpushed changes to those packages are part of the run. The image Railway builds resolves the same packages from their remotes at the revisions in Package.resolved, so push a package change and update the pin before deploying code that needs it.

Deploying to Railway #

What runs where #

Piece Value
Project, environment effem-appview, production
Service zonal-charisma: one replica in us-west2, built from the root Dockerfile, no start command
Database The Postgres service in the same project, image postgres-ssl:18, with a volume at /var/lib/postgresql/data. It has no public TCP proxy; the service reaches it over Railway's private network at postgres.railway.internal.
Public names https://appview.effem.xyz (through Cloudflare's proxy) and the Railway domain zonal-charisma-production-608e.up.railway.app, both to port 8080
Health check /_live, timeout 300 seconds

Variables on the service #

Variable Value
EFFEM_BIND :8080, the port both domains target
EFFEM_DATABASE_URL ${{Postgres.DATABASE_URL}}?sslmode=require
EFFEM_AUTH_READ_TOKENS <the token shipped in the iOS app>=*
EFFEM_AUTH_ADMIN_TOKENS <the admin token>=<the owner's DID>, a different token. The DID is what resolved_by, banned_by and the audit log record, and a request made with this token acts as that account (see Tokens).
EFFEM_AUTH_REQUIRED true
EFFEM_PI_KEY, EFFEM_PI_SECRET The Podcast Index pair
EFFEM_CORS_ALLOWED_ORIGINS The web origins allowed to call the service: https://appview.effem.xyz,https://effem.xyz today
EFFEM_TRUSTED_PROXY_CIDRS 100.64.0.0/10
EFFEM_CLIENT_ADDRESS_HEADER X-Real-IP
EFFEM_CATALOG_DID, EFFEM_LABELER_DID Set to the defaults, did:web:catalog.effem.xyz and did:web:labeler.effem.xyz
EFFEM_PLC_HOST, EFFEM_RATE_LIMIT_ENABLED Set to the defaults, https://plc.directory and true
RAILWAY_DEPLOYMENT_DRAINING_SECONDS 20
EFFEM_REPORT_WEBHOOK_URL Optional. Not set as of 2026-11-09, so nothing announces a new report yet.

Left unset on purpose: EFFEM_INGEST_MODE (the default is service), EFFEM_JETSTREAM_HOSTS, CRON_SECRET (the cron routes then answer 503) and the four EFFEM_APNS_* variables (no client registers for push yet, so notifications are stored and listed but nothing is pushed).

Set variables with railway variable set NAME=value --service zonal-charisma. Add --skip-deploys when a deploy follows anyway, and pass a secret through --stdin so it does not land in the shell history:

printf '%s' "$NEW_VALUE" | railway variable set EFFEM_REPORT_WEBHOOK_URL --stdin --service zonal-charisma

Settings that matter #

  • Health check path /_live. Railway calls it only while a deploy starts, and switches traffic to the new deployment when it answers 2xx. It is /_live and not /_health so that a Jetstream outage can never block the deploy that would fix it. Set it in the service's settings in the dashboard or through Railway's API, then confirm it was saved:

    railway status --json | jq '.environments.edges[].node.serviceInstances.edges[].node
      | select(.serviceName == "zonal-charisma")
      | .latestDeployment.meta.serviceManifest.deploy
      | {healthcheckPath, healthcheckTimeout, numReplicas, sleepApplication}'
    

    The values shown are those of the latest deployment, so a change appears there after the next deploy.

  • One replica. A second replica would be safe, because the ingest lease keeps it from reading Jetstream, but the request limiter, the per-client Podcast Index budget and /metrics are per process.

  • Serverless (app sleeping) stays off. The Jetstream reader has to stay resident.

  • RAILWAY_DEPLOYMENT_DRAINING_SECONDS=20. Railway sends SIGTERM to the old deployment and SIGKILL after this many seconds; the default is 0. The service needs about five seconds to stop: it closes the Jetstream connection, hands the ingest lease back and exits.

Client address on Railway #

Measured against the deployed service on 2026-11-09:

  • Railway's edge connects to the service from 100.64.0.0/10 and sets X-Real-IP to the caller's address. It replaces an X-Real-IP the caller sent. A forged X-Real-IP, X-Forwarded-For, CF-Connecting-IP or True-Client-IP sent straight to the *.up.railway.app domain did not change the resolved address.
  • appview.effem.xyz is proxied by Cloudflare. Railway detects Cloudflare in front of a custom domain and still reports the real caller in X-Real-IP, for IPv4 and IPv6 callers alike, and forged headers sent through Cloudflare did not change it either. The Cloudflare proxy can therefore stay on: the request limiter and the Podcast Index budget key on the real caller either way.
  • Requests that do not come through the edge, such as Railway's deploy health check, carry no X-Real-IP. The resolver then falls back to the forwarded list and finally to the peer, so the health check is logged with an address in 100.64.0.0/10.

Both variables are needed. Without EFFEM_TRUSTED_PROXY_CIDRS the edge itself would be taken for the client, and every caller would share one rate limit bucket and one Podcast Index budget.

Deploy #

From this directory:

railway up --service zonal-charisma

railway up uploads the directory, leaving out what .gitignore lists, and Railway builds the image from the Dockerfile. The build passes --build-system native to every swift build: on Swift 6.4 the default build system cannot link Foundation statically and names resource bundles .bundle. The image build fails if the resource bundle with the migrations is missing. To check a change to the Dockerfile before deploying, build and run the image locally against the compose Postgres:

docker build -t effem-appview .
docker run --rm -p 8080:8080 \
  -e EFFEM_DATABASE_URL='postgres://effem:effem@host.docker.internal:5433/effem?sslmode=disable' \
  -e EFFEM_AUTH_READ_TOKENS='dev-read=*' \
  effem-appview

A healthy start prints these lines, in this order (timestamps left out):

info effem-appview: mode=service [EffemAppView] ingestion mode
info effem-appview: name=0001_initial.sql [EffemAppView] applying migration
info effem-appview: enabled=false [EffemAppView] push dispatcher starting
info effem-appview: [HummingbirdCore] Server started and listening on 0.0.0.0:8080
info effem-appview: cursor=live host=wss://jetstream.us-east.bsky.network [EffemAppView] connecting to jetstream
info effem-appview: ip=100.64.0.3 method=GET ms=2 path=/_live status=200 [EffemAppView] request

On an empty database there are thirteen applying migration lines, one per file. On a migrated one there is a single database schema is current line instead, and connecting to jetstream shows the saved sequence number in place of cursor=live. The /_live line from an address in 100.64.0.0/10 is Railway's health check. During a deploy the new instance waits for the old one to hand the ingest lease back, so connecting to jetstream follows the health check by ten to fifteen seconds (10, 14 and 14 on three deploys of 2026-11-09). Railway shows lines that share a second in any order, and on two deploys of 2026-11-09 it did not show the lines before the health check at all, although the service had started normally. Judge a deploy by the checks below, not by the absence of a line.

If a setting is wrong, the process logs one critical line, the service could not start or stopped with an error, with the reason in error=, and exits with status 1. If the database cannot be reached, it logs Connection creation failed lines for about a minute without listening, and then exits the same way with connectionCreationCircuitBreakerTripped as the reason. In both cases the new deployment never answers /_live, the deploy fails, and the previous deployment keeps serving.

Checks after a deploy #

curl -s https://appview.effem.xyz/_live          # {"status":"ok","db":true}
curl -s https://appview.effem.xyz/_health        # "status":"ok"; "starting" with a 503 for the first seconds on an empty database
  • xyz.effem.podcast.getCategories with the app's token answers 200. This proves the token and the resource bundle.
  • xyz.effem.podcast.getTrending with the app's token answers 200. This proves the Podcast Index credentials.
  • xyz.effem.admin.listLabels answers 403 with the app's token and 200 with the admin token.
  • The ip= field on your own request's log line (railway logs --service zonal-charisma --lines 20) is your public address, not one in 100.64.0.0/10.

The did:web identities #

The catalog and labeler DIDs resolve only when https://catalog.effem.xyz/.well-known/did.json and https://labeler.effem.xyz/.well-known/did.json reach this service with their own host names. As of 2026-11-09 neither name exists in DNS and the service's only custom domain is appview.effem.xyz, so the two DIDs do not resolve yet. Railway's Hobby plan, which this project is on, allows two custom domains per service, so the service can take one more name, not both.