better-auth-integrations

better-auth-integrations

Better Auth framework integrations for TypeScript. Use when wiring route handlers in Next.js, SvelteKit, Remix, Express, Hono, or other web frameworks.

9stars
2forks
Updated 1/29/2026
SKILL.md
readonlyread-only
name
better-auth-integrations
description

Better Auth framework integrations for TypeScript. Use when wiring route handlers in Next.js, SvelteKit, Remix, Express, Hono, or other web frameworks.

Better Auth Integrations

Goals

  • Mount the Better Auth handler at /api/auth/* (or a custom base path).
  • Use framework helpers where available.
  • Ensure cookies and headers flow correctly in SSR and server actions.

Quick start

  1. Create an auth instance (see better-auth-core).
  2. Add a catch-all route for /api/auth/*.
  3. Use a framework helper (or auth.handler) to return a Response.

Next.js App Router

import { auth } from "@/lib/auth";
import { toNextJsHandler } from "better-auth/next-js";

export const { GET, POST } = toNextJsHandler(auth);

Next.js Pages Router

import { auth } from "@/lib/auth";
import { toNodeHandler } from "better-auth/node";

export const config = { api: { bodyParser: false } };
export default toNodeHandler(auth.handler);

Cookie handling in Next.js server actions

Use the nextCookies plugin so server actions set cookies correctly.

import { betterAuth } from "better-auth";
import { nextCookies } from "better-auth/next-js";

export const auth = betterAuth({
  // ...config
  plugins: [nextCookies()],
});

Guardrails

  • Keep the base path consistent between server and client.
  • Prefer framework helpers when available.
  • Avoid running custom body parsers before the auth handler.

References

  • toolchains/platforms/auth/better-auth/better-auth-integrations/references/nextjs.md
  • toolchains/platforms/auth/better-auth/better-auth-integrations/references/frameworks.md

You Might Also Like

Related Skills

verify

verify

243K

Use when you want to validate changes before committing, or when you need to check all React contribution requirements.

facebook avatarfacebook
Get
test

test

243K

Use when you need to run tests for React core. Supports source, www, stable, and experimental channels.

facebook avatarfacebook
Get

Use when feature flag tests fail, flags need updating, understanding @gate pragmas, debugging channel-specific test failures, or adding new flags to React.

facebook avatarfacebook
Get

Use when adding new error messages to React, or seeing "unknown error code" warnings.

facebook avatarfacebook
Get
flow

flow

243K

Use when you need to run Flow type checking, or when seeing Flow type errors in React code.

facebook avatarfacebook
Get
flags

flags

243K

Use when you need to check feature flag states, compare channels, or debug why a feature behaves differently across release channels.

facebook avatarfacebook
Get