askill
better-auth-integrations

better-auth-integrationsSafety 85Repository

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

13 stars
1.2k downloads
Updated 2/12/2026

Package Files

Loading files...
SKILL.md

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

Install

Download ZIP
Requires askill CLI v1.0+

AI Quality Score

72/100Analyzed 2/20/2026

A well-structured technical reference skill for Better Auth framework integrations in TypeScript, covering Next.js App Router, Pages Router, and cookie handling with practical code examples. Has clear when_to_use guidance, structured steps, guardrails, and reference files. The deep path nesting (R9) suggests internal project context but the content itself is broadly applicable to anyone using Better Auth with Next.js. Missing examples for some mentioned frameworks (SvelteKit, Remix, Express, Hono) but covers the most common use case thoroughly."

85
85
60
70
80

Metadata

Licenseunknown
Version-
Updated2/12/2026
Publisherbobmatnyc

Tags

apisecurity