What this thread does
Consider Better Auth for new SvelteKit login if its supported methods and integration meet your requirements; consider Lucia’s reference if your team wants to maintain its own session implementation.
Do first: check package.json for the SvelteKit major and auth adapter
1. Check the installed SvelteKit major, database adapter and required sign-in methods. For an existing Lucia app, inventory user identifiers, password hashes, sessions and provider account links before changing tables. Consider an explicit session reset at cutover if compatibility review does not establish session continuity. 2. As of November 2026, install Better Auth 1.7.27 with pnpm add better-auth@1.7.27. Create a server-only auth instance, configure the database/adapter, secret and public base URL, and enable only needed methods. Follow Better Auth installation. Generate its schema for review in a disposable development database before applying a reviewed migration; do not assume schema compatibility; compare the existing tables with Better Auth’s generated schema. 3. Mount svelteKitHandler in src/hooks.server.ts. Compose it with existing hooks. Populate event.locals explicitly with the result of auth.api.getSession({ headers: event.request.headers }); the handler does not populate session/user locals by itself. 4. Match imports to the app. Current examples use Kit 3 #lib/... and $app/env; Kit 2 uses $lib/... and $app/environment. For auth calls inside server actions, configure sveltekitCookies(getRequestEvent) last in the plugin list; the documented minimum for getRequestEvent is Kit 2.20.0. See the integration guide. 5. Create the client with createAuthClient from better-auth/svelte. Put authorization checks in the server actions/endpoints that read or change protected data. A hidden login button is not authorization. SvelteKit documents the hook/cookie/locals integration points. 6. Verify signup or provider sign-in, refresh during SSR, direct protected-route access, an unauthorized mutation, logout and expired-session rejection. Test the deployed HTTPS origin and callback path, including any reverse-proxy base path. For an existing app, test that old identities are preserved and that invalidated old sessions cannot regain access.
The problem
Lucia is no longer a maintained auth package to add to a new project. Its official site says it was deprecated in March 2025 and now links a single-file replacement and the Auth Book. SvelteKit's auth page points to Better Auth setup and Pilcrow’s Auth Book as an implementation reference. That distinction decides who owns the ongoing auth code.
Versions, licences and costs — checked 2026-11-15
| Option | Verified status | Cost and limits |
|---|---|---|
| Better Auth, library-managed auth flows in your app | As of November 2026, latest stable 1.7.27; MIT | No core licence fee. Database, email delivery, deployment and engineering are separate costs; no hosted-user allowance is implied. |
| Owned sessions using Lucia's reference | Reference code and book, not a new Lucia package release recommendation | Your team maintains implementation, review and incident response. No subscription price or managed service quota is established by that page. Check reuse terms on the exact reference files you adopt. |
No prerelease is recommended. Neither path removes the need to secure cookies, recovery flows or server authorization.
When to pick which
| Option | Wins when | Loses when | Pick this if |
|---|---|---|---|
| Better Auth | You want a library and adapters rather than owning every auth mechanism | You cannot accept its schema/integration contract or maintain dependency upgrades | Its supported methods cover your product and you can operate its storage and mail dependencies. |
| Owned sessions | A deliberately small session model has an accountable security maintainer | You need many sign-in/recovery features with little maintenance capacity | You will review, test and maintain the entire implementation, not copy a tutorial and leave it. |
Community evidence
- saturnonearth, issue 3211, 2025-06-28: “Followed instructions as stated in 1.3 beta docs”. This closed report concerns prerelease integration packaging. It is a warning against mixing old beta examples with current integration code, not a current stable failure claim.
- Karbik, discussion 8368, 2026-03-04: “I'm having trouble getting better-auth to work on the new base path.” This unanswered report motivates testing the real reverse-proxy origin and paths. A bot reply is not verification of a fix.
Recommendation by constraint
Solo developer adding login: consider Better Auth with minimal methods if its integration meets your requirements. Small team replacing Lucia: consider Better Auth after compatibility review, with an explicit identity mapping and session cutover plan. Enterprise: retain the established identity-provider requirements and evaluate Better Auth's required integration before committing; use owned sessions only with an accountable security owner. These are engineering recommendations, not comparative trial results.
Prompt for the agent
Inspect our Kit major, auth tables, adapter and sign-in methods. Propose Better Auth integration using matching imports. List identity mappings and which sessions must expire. Protect one server action and give tests for SSR, logout, unauthorized access and our real callback path. Keep credentials out of generated code.
Mistakes
Do not apply auth schema generation blindly to existing tables. Do not expect svelteKitHandler to fill locals. Do not use Kit 3 imports in a Kit 2 app or treat a client session store as a server permission check.
Limits
No sign-in flow or identity migration was run. The community reports are integration-specific and do not measure security or reliability. Existing password hashes, provider links and custom Lucia extensions need individual compatibility review. This is an auth replacement recipe, not a complete SvelteKit major-version upgrade guide.
Started from a post by @Better Auth contributors, packaged by the editor. Original post