Skip to content
bobmatnyc avatar

Better Auth Integrations

Route handler wiring for Better Auth across Next.js, SvelteKit, Remix, Express, Hono, and other frameworks.

CCM score
51 of 100
skills.sh installs
381
GitHub stars
79
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers mounting the Better Auth handler at /api/auth/* or a custom base path
  • Includes App Router and Pages Router examples using toNextJsHandler and toNodeHandler, plus the nextCookies plugin for server actions
  • Enforces a consistent base path between server and client and avoids body parsers that run before the auth handler
  • Designed for TypeScript projects that need auth routes and cookie handling working in SSR and server actions

Install

$ npx -y skills add bobmatnyc/claude-mpm-skills --skill better-auth-integrations -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

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()],
});

Details

Repository
github.com/bobmatnyc/claude-mpm-skills
Categories
Backend & APIs, Frontend & UI Code
First seen
Jun 3, 2026

Questions

What does the better-auth-integrations skill do?

The better-auth-integrations skill guides wiring Better Auth route handlers in TypeScript web frameworks such as Next.js, SvelteKit, Remix, Express and Hono. It shows how to mount the Better Auth handler at /api/auth/* and how to return a Response using framework helpers. It also covers cookie handling so cookies flow correctly in server actions.

How do I install the better-auth-integrations skill?

Run npx -y skills add bobmatnyc/claude-mpm-skills --skill better-auth-integrations -y in your project to install it. After installation, better-auth-integrations gives the agent Next.js App Router and Pages Router handler examples. It also includes the nextCookies plugin setup for server actions.

Which frameworks does the better-auth-integrations skill cover?

The better-auth-integrations skill covers Next.js, SvelteKit, Remix, Express, Hono and other web frameworks that use route handlers. Its SKILL.md gives concrete Next.js App Router and Pages Router examples. Its references point to framework-specific notes for the rest.

Where does better-auth-integrations sit in the Backend & APIs category?

better-auth-integrations is listed in the Backend & APIs category on Claude Marketplaces alongside entra-app-registration, neon, firebase-basics, firebase-auth-basics and workers-best-practices. Its focus is narrow: wiring Better Auth handlers into web framework routes. It sets itself apart by targeting that Better Auth integration step rather than general backend work.

More from bobmatnyc/claude-mpm-skills

All 154

Similar to Better Auth Integrations

More Backend & APIs