ADR-0170 — A bare address is the API's first, and the app's otherwise
Status: Accepted · Date: 2026-10-11 · Track: launch wave 1, api
workstream (contract for web) · Builds on:
ADR-0105 (@slug),
ADR-0115,
ADR-0169
Context
The Overview's addresses are card.site/slug and card.site/@slug. The
product served /l/{slug} (redirect path), /b/{slug} (bio page app route) and
/@{slug}, but nothing at /{slug}. Two things want that path. Short links,
files and static sites must answer with a server redirect or the file itself,
for crawlers and link unfurlers that run no script. Pages the app draws (bio
page, vCard, event, payment) need the SPA. App routes (/login,
/dashboard, …) must keep working, and a user must not be able to claim one.
Decision
- Reserved words.
models.ReservedSlugsholds the app's top-level routes, the public renderers, and the paths the API and web server serve. It is the same list as the web'slib/reservedSlugs.ts; a test holds the two together while they are two files.refuseTakenSlug, the one place a name is taken, refuses a reserved word on create and on rename (409 "That address is reserved"). - The API answers bare addresses:
GET /{slug}and/{slug}/*run the redirect path throughHandleBare. A reserved word is 404 without a lookup. WithX-Cardsite-Spa-Fallback: 1, a page type answers 404 before anything is evaluated or counted. Without that header (a customer domain proxied straight to the API), a bio page is handed to/b/{slug}like the other page types, instead of being answered as JSON. - The web server asks the API first. nginx sends a path whose first
segment has no dot and is not
@…,assets,fontsorbto the API with the fallback header. On 404 (and on 502–504) it servesindex.htmlat the same address. Redirect types are therefore real 30x responses. Pages, unknown slugs and every app route reach the SPA unchanged, and nginx holds no copy of the reserved list. - The app's catch-all resolves with
GET /api/public/resolve/{slug}. It has no side effects (no click, visit or cookie). It resolves by (host, slug) and answers{slug, type, render, page, data_url, handoff_url, card_url}, or 404 for a reserved, unknown, disabled, lapsed or out-of-schedule slug. Audience targeting and gates stay with the door the app uses next. The redirect path honours?host=, so ahandoff_urlfor a custom-domain resource resolves on that domain.
Consequences
- Production behind Caddy needs the same fallback (
handle_responseon 404 → serveindex.html). That change belongs toinfra(hand-off Requests). - A slug created before the list that is now a reserved word still resolves
at
/l/{slug}but not at/{slug}. - The two lists become one data file in
packages/(an ADR-0030 vocabulary read by Go through a parity gate) whenwebcreates it. That is a request toweb.
Source: docs/decisions/0170-a-bare-address-is-the-apis-first-and-the-apps-otherwise.md