
Better Auth Integrations
This handles the routing and framework-specific wiring for Better Auth in TypeScript projects. You'll reach for it when mounting authentication endpoints at `/api/auth/*` in Next.js (both App and Pages Router), SvelteKit, Remix, Express, or Hono. The main win is framework-specific helpers like `toNextJsHandler` that abstract away the boilerplate of converting Better Auth's handler into whatever your framework expects. One thing to watch: Next.js server actions need the `nextCookies` plugin or your session cookies won't set properly. The guardrails are simple: keep your base path consistent and don't run custom body parsers before the auth handler.
- skills.sh installs
- 363
- GitHub stars
- 79
- last updated
- Aug 21, 2026
Install
$ npx -y skills add bobmatnyc/claude-mpm-skills --skill better-auth-integrations --agent claude-codeInstalls into .claude/skills of the current project.
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
- Create an
authinstance (seebetter-auth-core). - Add a catch-all route for
/api/auth/*. - 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()],
});
Sponsors
Details
- Repository
- github.com/bobmatnyc/claude-mpm-skills
- Categories
- Frontend Development, Backend & APIs
- First seen
- Jun 3, 2026
More from bobmatnyc/claude-mpm-skills
All 158- Reporting Pipelines363
- Better Auth Plugins362
- Git Worktrees360
- Nextjs Core357
- Fastapi Local Dev356
- Vb Winforms356
- Headlessui355
- Jest Typescript354
- Vercel Networking Domains353
- Svelte352
- Sec Edgar Pipeline351
- Env Manager350
- Mongodb350
- Vb Core350
- Phoenix Api Channels348
- Digitalocean Containers Images347
- Hono Jsx347
- Langgraph346
- Pr Quality Checklist346
- Ecto Patterns345
- Vercel Observability345
- Media Transcoding344
- Clap341
- Phoenix Ops341