[{"data":1,"prerenderedAt":405},["ShallowReactive",2],{"navigation_docs":3,"-getting-started-how-it-works":152,"-getting-started-how-it-works-surround":400},[4,42,68,110,131],{"title":5,"path":6,"stem":7,"children":8,"icon":11},"Getting Started","/getting-started","1.getting-started/0.index",[9,12,17,22,27,32,37],{"title":10,"path":6,"stem":7,"icon":11},"Introduction","i-lucide-sparkles",{"title":13,"path":14,"stem":15,"icon":16},"Installation","/getting-started/installation","1.getting-started/1.installation","i-lucide-download",{"title":18,"path":19,"stem":20,"icon":21},"Configuration","/getting-started/configuration","1.getting-started/2.configuration","i-lucide-settings",{"title":23,"path":24,"stem":25,"icon":26},"Client Setup","/getting-started/client-setup","1.getting-started/3.client-setup","i-lucide-monitor",{"title":28,"path":29,"stem":30,"icon":31},"Type Augmentation","/getting-started/type-augmentation","1.getting-started/4.type-augmentation","i-lucide-type",{"title":33,"path":34,"stem":35,"icon":36},"Schema Generation (NuxtHub)","/getting-started/schema-generation","1.getting-started/5.schema-generation","i-lucide-database",{"title":38,"path":39,"stem":40,"icon":41},"How It Works","/getting-started/how-it-works","1.getting-started/6.how-it-works","i-lucide-workflow",{"title":43,"path":44,"stem":45,"children":46,"page":67},"Core Concepts","/core-concepts","2.core-concepts",[47,51,55,59,63],{"title":48,"path":49,"stem":50},"serverAuth()","/core-concepts/server-auth","2.core-concepts/1.server-auth",{"title":52,"path":53,"stem":54},"Sessions","/core-concepts/sessions","2.core-concepts/2.sessions",{"title":56,"path":57,"stem":58},"Route Protection","/core-concepts/route-protection","2.core-concepts/3.route-protection",{"title":60,"path":61,"stem":62},"Auto‑Imports and Aliases","/core-concepts/auto-imports-aliases","2.core-concepts/4.auto-imports-aliases",{"title":64,"path":65,"stem":66},"Security & Caveats","/core-concepts/security-caveats","2.core-concepts/5.security-caveats",false,{"title":69,"path":70,"stem":71,"children":72,"page":67},"Guides","/guides","3.guides",[73,77,81,85,89,94,98,102,106],{"title":74,"path":75,"stem":76},"Role‑Based Access","/guides/role-based-access","3.guides/1.role-based-access",{"title":78,"path":79,"stem":80},"OAuth Providers","/guides/oauth-providers","3.guides/2.oauth-providers",{"title":82,"path":83,"stem":84},"Custom Database","/guides/custom-database","3.guides/3.custom-database",{"title":86,"path":87,"stem":88},"Database-less Mode","/guides/database-less-mode","3.guides/4.database-less-mode",{"title":90,"path":91,"stem":92,"icon":93},"External Auth Backend","/guides/external-auth-backend","3.guides/5.external-auth-backend","i-lucide-server",{"title":95,"path":96,"stem":97},"Migrating from nuxt-auth-utils","/guides/migrate-from-nuxt-auth-utils","3.guides/6.migrate-from-nuxt-auth-utils",{"title":99,"path":100,"stem":101},"Two-Factor Authentication (TOTP + Backup Codes)","/guides/two-factor-auth","3.guides/7.two-factor-auth",{"title":103,"path":104,"stem":105},"Testing","/guides/testing","3.guides/8.testing",{"title":107,"path":108,"stem":109},"Production Deployment","/guides/production-deployment","3.guides/9.production-deployment",{"title":111,"path":112,"stem":113,"children":114,"page":67},"Integrations","/integrations","4.integrations",[115,119,123,127],{"title":116,"path":117,"stem":118},"NuxtHub","/integrations/nuxthub","4.integrations/1.nuxthub",{"title":120,"path":121,"stem":122},"DevTools","/integrations/devtools","4.integrations/2.devtools",{"title":124,"path":125,"stem":126},"Convex","/integrations/convex","4.integrations/3.convex",{"title":128,"path":129,"stem":130},"i18n","/integrations/i18n","4.integrations/4.i18n",{"title":132,"path":133,"stem":134,"children":135,"page":67},"API Reference","/api","5.api",[136,140,144,148],{"title":137,"path":138,"stem":139},"Composables","/api/composables","5.api/1.composables",{"title":141,"path":142,"stem":143},"Server Utilities","/api/server-utils","5.api/2.server-utils",{"title":145,"path":146,"stem":147},"Components","/api/components","5.api/3.components",{"title":149,"path":150,"stem":151},"Types","/api/types","5.api/4.types",{"id":153,"title":38,"body":154,"description":393,"extension":394,"links":395,"meta":396,"navigation":397,"path":39,"seo":398,"stem":40,"__hash__":399},"docs/1.getting-started/6.how-it-works.md",{"type":155,"value":156,"toc":380},"minimark",[157,161,166,207,211,313,317,355,359],[158,159,160],"p",{},"Use this page after installation. It explains how the module connects Nuxt runtime behavior to Better Auth rather than walking through setup again.",[162,163,165],"h2",{"id":164},"architecture","Architecture",[167,168,169,174,182,186,196,200],"steps",{},[170,171,173],"h3",{"id":172},"initialization","Initialization",[158,175,176,177,181],{},"During build, the module reads ",[178,179,180],"code",{},"server/auth.config.ts"," and generates the auth handler. If using NuxtHub, it also generates the database schema automatically.",[170,183,185],{"id":184},"server-runtime","Server Runtime",[158,187,188,189,192,193,195],{},"The module injects a catch-all API handler at ",[178,190,191],{},"/api/auth/**",". This handler processes all authentication requests (login, logout, session fetching) using the configuration provided in ",[178,194,180],{},".",[170,197,199],{"id":198},"client-runtime","Client Runtime",[158,201,202,203,206],{},"On the client side, ",[178,204,205],{},"useUserSession"," initializes the Better Auth client. It establishes a reactive connection to the session state, ensuring that your UI updates immediately when a user logs in or out.",[162,208,210],{"id":209},"key-responsibilities","Key Responsibilities",[212,213,214,230],"table",{},[215,216,217],"thead",{},[218,219,220,224,227],"tr",{},[221,222,223],"th",{},"Feature",[221,225,226],{},"What it provides",[221,228,229],{},"Side",[231,232,233,248,261,278,295],"tbody",{},[218,234,235,239,245],{},[236,237,238],"td",{},"Server handler",[236,240,241,242],{},"Mounts Better Auth at ",[178,243,244],{},"/api/auth/*",[236,246,247],{},"Server",[218,249,250,252,258],{},[236,251,137],{},[236,253,254,257],{},[178,255,256],{},"useUserSession()"," for reactive state",[236,259,260],{},"Client",[218,262,263,266,276],{},[236,264,265],{},"Server utils",[236,267,268,271,272,275],{},[178,269,270],{},"serverAuth(event?)",", ",[178,273,274],{},"getUserSession(event)",", etc.",[236,277,247],{},[218,279,280,283,292],{},[236,281,282],{},"Route protection",[236,284,285,288,289],{},[178,286,287],{},"routeRules.auth"," and ",[178,290,291],{},"definePageMeta({ auth })",[236,293,294],{},"Both",[218,296,297,300,310],{},[236,298,299],{},"Type augmentation",[236,301,302,303,288,306,309],{},"Inferred ",[178,304,305],{},"AuthUser",[178,307,308],{},"AuthSession"," types",[236,311,312],{},"Build",[162,314,316],{"id":315},"request-flow","Request Flow",[318,319,320,324,335,338,344,347,350],"ol",{},[321,322,323],"li",{},"User visits a protected page",[321,325,326,327,330,331,334],{},"Route middleware checks ",[178,328,329],{},"auth"," rule in ",[178,332,333],{},"routeRules"," or page meta",[321,336,337],{},"If not authenticated, redirects to login page",[321,339,340,341],{},"User submits credentials to ",[178,342,343],{},"/api/auth/sign-in/email",[321,345,346],{},"Better Auth validates credentials and creates session",[321,348,349],{},"Session cookie is set, user redirected to original page",[321,351,352,354],{},[178,353,256],{}," reads session from cookie, updates reactive state",[162,356,358],{"id":357},"what-this-means-in-practice","What this means in practice",[360,361,362,368,374,377],"ul",{},[321,363,364,365,367],{},"client pages use ",[178,366,256],{}," and related composables",[321,369,370,371],{},"protected API routes should still call ",[178,372,373],{},"requireUserSession(event)",[321,375,376],{},"route rules improve navigation UX, but server-side checks remain the real security boundary",[321,378,379],{},"NuxtHub integration and schema generation are build-time concerns, not request-time concerns",{"title":381,"searchDepth":382,"depth":382,"links":383},"",2,[384,390,391,392],{"id":164,"depth":382,"text":165,"children":385},[386,388,389],{"id":172,"depth":387,"text":173},3,{"id":184,"depth":387,"text":185},{"id":198,"depth":387,"text":199},{"id":209,"depth":382,"text":210},{"id":315,"depth":382,"text":316},{"id":357,"depth":382,"text":358},"Understand the architecture after completing setup.","md",null,{},{"icon":41},{"title":38,"description":393},"Fs0g-VZLkoBK_uugLiwDtPGlAE24wcpEB7lAwcM03aQ",[401,403],{"title":33,"path":34,"stem":35,"description":402,"icon":36,"children":-1},"Auto-generate Drizzle ORM schemas for Better Auth tables when using NuxtHub.",{"title":48,"path":49,"stem":50,"description":404,"children":-1},"When to reach for the full Better Auth server instance.",1777450764677]