Question
Re-evaluate whether the auth-service-on-a-subdomain architecture still earns its keep, versus hosting the auth UI in-process on the PDS Core origin (single domain).
Background
The subdomain split (AUTH_HOSTNAME must be a subdomain of PDS_HOSTNAME) was inherited whole from the upstream magic-pds project at the initial commit (de3876e). The rationale was later written down in better-auth-migration-plan.md, section "Considered and rejected: single-domain architecture", and is now also summarised in docs/architecture.md (Key Design Decisions → "Auth Service on a subdomain").
Stated benefits of the split:
- Cookie isolation — the auth-service session cookies (Better Auth
session) are a separate authentication domain from AT Protocol access/refresh tokens; separate origins keep the namespaces from colliding by construction.
- Security-header isolation — the auth-service is a full web app needing its own CSP/headers, independent of PDS Core's stricter policy.
- Independent deployability — separate service/process, deployed and restarted on its own.
The OAuth authorization_endpoint metadata override is the mechanism that redirects clients to the auth service, but not a reason a separate origin is required: PDS Core already wraps upstream heavily (_router.stack surgery, metadata rewriting, middleware injection) and could shadow /oauth/authorize in-process.
Why revisit
The subdomain choice carries costs that have accumulated and were only partly documented at decision time — all in docs/design/pds-white-boxing.md:
- Item 5 —
sec-fetch-site: same-site → same-origin rewrite, needed only because the redirect chain crosses origins within the same registrable domain.
- Items 14–15 — device-session cookie-domain plumbing (
Domain=<parent>) so the sibling subdomain can read the upstream session; host-only cookies wouldn't cross.
These costs are a direct consequence of splitting across subdomains. The three benefits above have never been formally weighed against them, and benefit #3 (independent deployability) may be weak given both packages already share a repo, build, and (per the migration plan) a data volume.
Task
References
docs/architecture.md — Key Design Decisions → "Auth Service on a subdomain, not a single shared domain"
better-auth-migration-plan.md — "Considered and rejected: single-domain architecture"
docs/design/pds-white-boxing.md — items 5, 14, 15 (the costs)
Question
Re-evaluate whether the auth-service-on-a-subdomain architecture still earns its keep, versus hosting the auth UI in-process on the PDS Core origin (single domain).
Background
The subdomain split (
AUTH_HOSTNAMEmust be a subdomain ofPDS_HOSTNAME) was inherited whole from the upstreammagic-pdsproject at the initial commit (de3876e). The rationale was later written down inbetter-auth-migration-plan.md, section "Considered and rejected: single-domain architecture", and is now also summarised indocs/architecture.md(Key Design Decisions → "Auth Service on a subdomain").Stated benefits of the split:
session) are a separate authentication domain from AT Protocol access/refresh tokens; separate origins keep the namespaces from colliding by construction.The OAuth
authorization_endpointmetadata override is the mechanism that redirects clients to the auth service, but not a reason a separate origin is required: PDS Core already wraps upstream heavily (_router.stacksurgery, metadata rewriting, middleware injection) and could shadow/oauth/authorizein-process.Why revisit
The subdomain choice carries costs that have accumulated and were only partly documented at decision time — all in
docs/design/pds-white-boxing.md:sec-fetch-site: same-site→same-originrewrite, needed only because the redirect chain crosses origins within the same registrable domain.Domain=<parent>) so the sibling subdomain can read the upstream session; host-only cookies wouldn't cross.These costs are a direct consequence of splitting across subdomains. The three benefits above have never been formally weighed against them, and benefit #3 (independent deployability) may be weak given both packages already share a repo, build, and (per the migration plan) a data volume.
Task
docs/architecture.md.References
docs/architecture.md— Key Design Decisions → "Auth Service on a subdomain, not a single shared domain"better-auth-migration-plan.md— "Considered and rejected: single-domain architecture"docs/design/pds-white-boxing.md— items 5, 14, 15 (the costs)