server/auth.config.ts exports defineServerAuth(...)app/auth.client.ts exports createAppAuthClient(baseURL)The module validates both files exist at build time.
serverAuth() creates and caches a Better Auth instance by calling your config and injecting:
runtimeConfig.betterAuthSecretruntimeConfig.public.siteUrl as baseURL/api/auth/** that forwards to Better Auth./api/** that enforces routeRules.role using requireUserSession(...).useUserSession() (auto-imported) creates a Better Auth client and manages user/session state.definePageMeta({ auth, role }) to redirect/deny access.<BetterAuthState> to render once useUserSession().ready is true.meta.auth / meta.role (can be set per-page or synced from routeRules).routeRules.role is enforced by default.See also:
/core-concepts/route-protection/guides/protecting-api-routes