Concepts map
Server migration
Next.js App Router
Hono
Database adapter
better-auth supports Prisma, Drizzle, Mongoose, and others. KavachOS uses Drizzle exclusively. A Prisma adapter is on our roadmap; if you are Prisma-only today, that is the main blocker.db instance; pass the connection URL and KavachOS manages its own tables. See data migration below for how to move existing rows.
Client SDK
OAuth providers
GitHub, Google, and Discord side-by-side:Breaking differences
Session tokens
better-auth and KavachOS use different token structures. An existing session token from better-auth will not be accepted by KavachOS and vice versa. To avoid signing everyone out on cutover day, use ourcookieAuth adapter to accept both token formats during a transition window:
cookieAuth adapter.
Cookie defaults
If your better-auth app set
secure: false in a staging environment, check your baseUrl. KavachOS infers Secure from the URL scheme: https:// turns the flag on, plain http:// leaves it off.
@better-auth/agent-auth
If you use @better-auth/agent-auth, none of its config maps 1:1. That package is a thin wrapper; KavachOS replaces it with a native AgentIdentity entity, built-in delegation, ephemeral sessions, and the MCP OAuth server. Start with the agents quickstart rather than trying to adapt your existing agent-auth config.
Data migration
better-auth and KavachOS share a similar base schema, but column names differ in a few places. Run this SQL after you have applied KavachOS migrations to the same database (adjust the schema name if needed):Rollback
Keep better-auth running behind a feature flag while you roll out KavachOS to a percentage of traffic.KAVACHOS_ROLLOUT=10 to start at 10%, then raise it over days as you validate sessions in the KavachOS tables. The cookieAuth adapter described above keeps existing users signed in during the overlap.
FAQ
Does KavachOS support all the OAuth providers better-auth has? No. As of 2026-04 we ship 17 first-class providers: Apple, Atlassian, Discord, Dropbox, Figma, GitHub, GitLab, Google, LinkedIn, Microsoft, Notion, Reddit, Slack, Spotify, Twitch, Twitter/X, Zoom. Any provider with a standard OAuth 2.0 authorization code flow works via the generic provider factory, but you write the config by hand. If a specific provider matters to you, open an issue. Is Prisma supported? Yes. Install@kavachos/prisma and pass a PrismaClient as the database backend. See the Prisma adapter docs for the setup.
Do I need to install an MCP plugin?
No. MCP OAuth 2.1 is built into KavachOS core. Pass a mcp config block to createKavach and enable it in your adapter.
Can I run better-auth and KavachOS side by side?
Yes. Use the cookieAuth adapter to accept better-auth sessions inside KavachOS, and route traffic with a feature flag as shown above.
Will my users have to sign in again?
With the cookieAuth adapter, no. KavachOS will accept existing better-auth sessions and issue new KavachOS tokens on the next request. Without the adapter, yes, existing tokens will be rejected.