[{"data":1,"prerenderedAt":327},["ShallowReactive",2],{"navigation_docs":3,"-core-concepts-how-it-works":129,"-core-concepts-how-it-works-surround":322},[4,34,63,80,101,110],{"title":5,"path":6,"stem":7,"children":8,"page":33},"Getting Started","/getting-started","1.getting-started",[9,13,17,21,25,29],{"title":10,"path":11,"stem":12},"Quickstart","/getting-started/quickstart","1.getting-started/0.quickstart",{"title":14,"path":15,"stem":16},"Installation","/getting-started/installation","1.getting-started/1.installation",{"title":18,"path":19,"stem":20},"Server Configuration","/getting-started/configuration","1.getting-started/2.configuration",{"title":22,"path":23,"stem":24},"Client Setup","/getting-started/client-setup","1.getting-started/3.client-setup",{"title":26,"path":27,"stem":28},"Type Augmentation","/getting-started/type-augmentation","1.getting-started/4.type-augmentation",{"title":30,"path":31,"stem":32},"Schema Generation","/getting-started/schema-generation","1.getting-started/5.schema-generation",false,{"title":35,"path":36,"stem":37,"children":38,"page":33},"Core Concepts","/core-concepts","2.core-concepts",[39,43,47,51,55,59],{"title":40,"path":41,"stem":42},"How It Works","/core-concepts/how-it-works","2.core-concepts/0.how-it-works",{"title":44,"path":45,"stem":46},"`serverAuth()`","/core-concepts/server-auth","2.core-concepts/1.server-auth",{"title":48,"path":49,"stem":50},"Sessions","/core-concepts/sessions","2.core-concepts/2.sessions",{"title":52,"path":53,"stem":54},"Route Protection","/core-concepts/route-protection","2.core-concepts/3.route-protection",{"title":56,"path":57,"stem":58},"Auto‑Imports and Aliases","/core-concepts/auto-imports-aliases","2.core-concepts/4.auto-imports-aliases",{"title":60,"path":61,"stem":62},"Security & Caveats","/core-concepts/security-caveats","2.core-concepts/5.security-caveats",{"title":64,"path":65,"stem":66,"children":67,"page":33},"Guides","/guides","3.guides",[68,72,76],{"title":69,"path":70,"stem":71},"Role‑Based Access","/guides/role-based-access","3.guides/1.role-based-access",{"title":73,"path":74,"stem":75},"Protecting API Routes","/guides/api-protection","3.guides/2.api-protection",{"title":77,"path":78,"stem":79},"Database Dialects","/guides/custom-dialects","3.guides/3.custom-dialects",{"title":81,"path":82,"stem":83,"children":84,"page":33},"API Reference","/api","4.api",[85,89,93,97],{"title":86,"path":87,"stem":88},"Composables","/api/composables","4.api/1.composables",{"title":90,"path":91,"stem":92},"Server Utilities","/api/server-utils","4.api/2.server-utils",{"title":94,"path":95,"stem":96},"Components","/api/components","4.api/3.components",{"title":98,"path":99,"stem":100},"Types","/api/types","4.api/4.types",{"title":102,"path":103,"stem":104,"children":105,"page":33},"Troubleshooting","/troubleshooting","5.troubleshooting",[106],{"title":107,"path":108,"stem":109},"FAQ","/troubleshooting/faq","5.troubleshooting/1.faq",{"title":111,"path":112,"stem":113,"children":114},"Better Auth","/better-auth","6.better-auth",[115,117,121,125],{"title":111,"path":112,"stem":116},"6.better-auth/index",{"title":118,"path":119,"stem":120},"OAuth & Social Providers","/better-auth/oauth","6.better-auth/1.oauth",{"title":122,"path":123,"stem":124},"Plugins","/better-auth/plugins","6.better-auth/2.plugins",{"title":126,"path":127,"stem":128},"Client Plugins (Exports)","/better-auth/client-plugins","6.better-auth/3.client-plugins",{"id":130,"title":40,"body":131,"description":315,"extension":316,"links":317,"meta":318,"navigation":319,"path":41,"seo":320,"stem":42,"__hash__":321},"docs/2.core-concepts/0.how-it-works.md",{"type":132,"value":133,"toc":304},"minimark",[134,139,161,165,169,174,223,227,256,260,290,293],[135,136,138],"h2",{"id":137},"what-you-provide","What you provide",[140,141,142,153],"ul",{},[143,144,145,149,150],"li",{},[146,147,148],"code",{},"server/auth.config.ts"," exports ",[146,151,152],{},"defineServerAuth(...)",[143,154,155,149,158],{},[146,156,157],{},"app/auth.client.ts",[146,159,160],{},"createAppAuthClient(baseURL)",[162,163,164],"p",{},"The module validates both files exist at build time.",[135,166,168],{"id":167},"what-the-module-adds","What the module adds",[170,171,173],"h3",{"id":172},"server","Server",[140,175,176,201,208],{},[143,177,178,181,182],{},[146,179,180],{},"serverAuth()"," creates and caches a Better Auth instance by calling your config and injecting:\n",[140,183,184,187,192],{},[143,185,186],{},"NuxtHub database via the Drizzle adapter",[143,188,189],{},[146,190,191],{},"runtimeConfig.betterAuthSecret",[143,193,194,197,198],{},[146,195,196],{},"runtimeConfig.public.siteUrl"," as ",[146,199,200],{},"baseURL",[143,202,203,204,207],{},"A catch-all API handler at ",[146,205,206],{},"/api/auth/**"," that forwards to Better Auth.",[143,209,210,211,214,215,218,219,222],{},"Nitro middleware for ",[146,212,213],{},"/api/**"," that enforces ",[146,216,217],{},"routeRules.role"," using ",[146,220,221],{},"requireUserSession(...)",".",[170,224,226],{"id":225},"client","Client",[140,228,229,239,246],{},[143,230,231,234,235,238],{},[146,232,233],{},"useUserSession()"," (auto-imported) creates a Better Auth client and manages ",[146,236,237],{},"user/session"," state.",[143,240,241,242,245],{},"A global route middleware that reads ",[146,243,244],{},"definePageMeta({ auth, role })"," to redirect/deny access.",[143,247,248,251,252,255],{},[146,249,250],{},"\u003CBetterAuthState>"," to render once ",[146,253,254],{},"useUserSession().ready"," is true.",[135,257,259],{"id":258},"route-protection-layers","Route protection layers",[140,261,262,281],{},[143,263,264,268,269,272,273,276,277,280],{},[265,266,267],"strong",{},"Pages",": driven by ",[146,270,271],{},"meta.auth"," / ",[146,274,275],{},"meta.role"," (can be set per-page or synced from ",[146,278,279],{},"routeRules",").",[143,282,283,286,287,289],{},[265,284,285],{},"API routes",": only ",[146,288,217],{}," is enforced by default.",[162,291,292],{},"See also:",[140,294,295,299],{},[143,296,297],{},[146,298,53],{},[143,300,301],{},[146,302,303],{},"/guides/protecting-api-routes",{"title":305,"searchDepth":306,"depth":306,"links":307},"",2,[308,309,314],{"id":137,"depth":306,"text":138},{"id":167,"depth":306,"text":168,"children":310},[311,313],{"id":172,"depth":312,"text":173},3,{"id":225,"depth":312,"text":226},{"id":258,"depth":306,"text":259},"What this module wires up for you.","md",null,{},true,{"title":40,"description":315},"yeYAMwgIJl_D7raCxISy2IFn-Q-TgKXl4ctM3loQ1OU",[323,325],{"title":30,"path":31,"stem":32,"description":324,"children":-1},"Auto-generate Drizzle tables from Better Auth plugins.",{"title":44,"path":45,"stem":46,"description":326,"children":-1},"How the server Better Auth instance is created.",1765664060950]