docs(server): restore Better Auth integration guide for v2 - #1992
Conversation
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — a single new doc page apps/content/docs/integrations/better-auth.mdx that restores the Better Auth integration guide for v2. It covers two patterns: resolving the session in a requireSession middleware (headers from initial context, getSession lookup, ORPCError('UNAUTHORIZED') on absence), and reusing a session already resolved outside the oRPC handler (typed as Awaited<ReturnType<typeof auth.api.getSession>>, narrowed by the middleware while public handlers check for it). Both show public plus protected procedures, inferred session types, handler setup with RPCHandler, and the cookie-header-forwarding caveat.
I verified the load-bearing claims against the repo and Better Auth's docs/source:
- The oRPC v2 API usage (
os.$context,base.middleware,base.use,next({ context })merge,RPCHandler.handlewithprefix/context) matches the existingcontext.mdx,middleware.mdx, andfetch-api.mdxdocs. auth.api.getSession({ headers })matches Better Auth's official API, and the returned type{ session, user } | null(confirmed from the better-authget-sessionroute source) lines up with theSessiontyping and both hander narrowings in the examples.- Both external links resolve and their anchors exist.
- The page is auto-discovered by Blume's filesystem content source and its
sidebar.labelmatches sibling integration pages, so no navigation config change is needed.
Technical details below only for the note about the PR description, which is editorial and non-blocking.
ℹ️ PR description says "Draft" while the PR is ready
The description still ends with "Draft while the proposed scope is being discussed.", but the PR is currently marked ready for review (draft: false). Consider updating the description to reflect the current state, e.g. noting the scope decision (docs-first, dedicated package still open per #1892).
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Restores the Better Auth integration guide for v2 with two examples: resolving the session in protected middleware, and reusing a session already loaded into context. Both show public and protected procedures, inferred session types, and the lookup/error-handling tradeoffs.
Related to #1892. This is a documentation-first contribution; the dedicated package remains open for discussion.
Validation:
pnpm docs:validatepnpm --filter @orpc/content buildDraft while the proposed scope is being discussed.