Skip to content
Back to skills

Better Auth Integrations

ASecurity

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

  • 74 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added June 6, 2026
developmenttypescriptgonextjsnodeexpressrailsapisecurity

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned June 6, 2026

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

Installs into .claude/skills of the current project.

Are you the author of Better Auth Integrations?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Better Auth Integrations
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/bobmatnyc-better-auth-integrations/badge)](https://www.skillsdirectory.com/skills/bobmatnyc-better-auth-integrations)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
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.
user-invocable: false
disable-model-invocation: true
progressive_disclosure:
  entry_point:
    summary: "Better Auth framework integrations for TypeScript. Use when wiring route handlers in Next.js, SvelteKit, Remix, Express, Hono, or other web frameworks."
    when_to_use: "When implementing authentication, authorization, or security."
    quick_start: "1. Review the core concepts below. 2. Apply patterns to your use case. 3. Follow best practices for implementation."
  references:
    - frameworks.md
    - nextjs.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
```ts
import { auth } from "@/lib/auth";
import { toNextJsHandler } from "better-auth/next-js";

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

### Next.js Pages Router
```ts
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.

```ts
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`

Files in this skill

  • SKILL.md2.2 KB
  • references/frameworks.md1.3 KB
  • references/nextjs.md1.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…