Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
bobmatnyc avatar

Better Auth Core

  • 238 installs
  • 63 repo stars
  • Updated July 18, 2026
  • bobmatnyc/claude-mpm-skills

Implement Better Auth core flows—sessions, OAuth providers, email magic links, and account linking—in TypeScript backends for secure SaaS login.

About

Claude MPM skill for Better Auth core: configure adapters, define providers, wire session middleware, and implement secure login, logout, and account flows for TypeScript SaaS, API, and mobile-backed products.

  • Better Auth session and cookie setup
  • OAuth and social provider configuration
  • Email and passwordless patterns
  • TypeScript server adapter integration

Better Auth Core by the numbers

  • 238 all-time installs (skills.sh)
  • Ranked #1,585 of 4,347 Backend & APIs skills by installs in the Skillselion catalog
  • Data as of Aug 1, 2026 (Skillselion catalog sync)
npx skills add https://github.com/bobmatnyc/claude-mpm-skills --skill better-auth-core

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs238
repo stars63
Last updatedJuly 18, 2026
Repositorybobmatnyc/claude-mpm-skills

What it does

Implement Better Auth core flows—sessions, OAuth providers, email magic links, and account linking—in TypeScript backends for secure SaaS login.

Files

SKILL.mdMarkdownGitHub ↗

Better Auth Core (TypeScript)

Goals

  • Set up a Better Auth instance with environment variables and data layer wiring.
  • Wire server handlers and a client instance.
  • Use sessions and server-side API methods safely.
  • Keep data-layer choices pluggable (drivers or adapters).

Quick start

1. Install better-auth. 2. Set BETTER_AUTH_SECRET (32+ chars) and BETTER_AUTH_URL. 3. Create auth.ts and export auth. 4. Provide database (driver or adapter) or omit for stateless sessions. 5. Mount a handler (auth.handler or a framework helper). 6. Create a client with createAuthClient.

import { betterAuth } from "better-auth";

export const auth = betterAuth({
  database: myDatabaseOrAdapter, // driver or adapter; omit for stateless mode
  emailAndPassword: { enabled: true },
  socialProviders: {
    github: {
      clientId: process.env.GITHUB_CLIENT_ID as string,
      clientSecret: process.env.GITHUB_CLIENT_SECRET as string,
    },
  },
});

Core setup checklist

  • Export the instance as auth (or default export) so helpers find it.
  • Keep BETTER_AUTH_URL in sync with the public base URL.
  • Pass the full base URL to the client if you change the /api/auth base path.
  • Add database migrations before enabling plugins that require tables.

Server API usage

  • Call server endpoints via auth.api.* with { body, headers, query }.
  • Use asResponse: true if you need a Response object.
  • Use returnHeaders: true to access Set-Cookie headers.
import { auth } from "./auth";

const session = await auth.api.getSession({
  headers: request.headers,
});

const response = await auth.api.signInEmail({
  body: { email, password },
  asResponse: true,
});

Session access

  • Client: authClient.useSession() or authClient.getSession().
  • Server: auth.api.getSession({ headers }).

TypeScript tips

  • Infer types with auth.$Infer and authClient.$Infer.
  • Use inferAdditionalFields on the client when you extend the user schema.

References

  • toolchains/platforms/auth/better-auth/better-auth-core/references/setup-database.md
  • toolchains/platforms/auth/better-auth/better-auth-core/references/client-server.md
  • toolchains/platforms/auth/better-auth/better-auth-core/references/typescript.md

Related skills

Backend & APIsbackendintegrations

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.