116
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill einverne/dotfiles --skill better-auth- SKILL.md15.5 KB
Overview
This skill describes Better Auth, a framework-agnostic authentication and authorization framework for TypeScript. It shows how to add email/password, social OAuth, 2FA, passkeys, magic links, and multi-tenant features with built-in session and plugin support. The guide focuses on practical installation, configuration, and common integration patterns across frameworks.
How this skill works
Better Auth exposes a server instance that handles auth logic, database operations, API routes, and a client instance with hooks and methods for sign-in, session handling, and plugin features. It integrates with direct database drivers or ORM adapters (Drizzle, Prisma, Kysely, MongoDB) and uses a plugin system to add advanced features like 2FA, passkeys, username auth, magic links, and organization/multi-tenancy. Routes are mounted per-framework with small adapter helpers for Next.js, SvelteKit, Nuxt, Hono, Express, and others.
When to use it
- Adding authentication to TypeScript/JavaScript apps regardless of framework
- Implementing email/password, social OAuth, magic links, passkeys, or 2FA
- Building multi-tenant or organization-backed auth flows
- Needing type-safe session management and user APIs
- Replacing or standardizing auth across frontend and backend stacks
Best practices
- Store secrets in environment variables and use HTTPS in production
- Use secure cookies and tune session expiration for your app
- Run migrations after adding plugins or changing schema
- Enable rate limiting and email verification in production
- Leverage TypeScript types and ORM adapters for predictable data models
Example use cases
- Set up email/password sign-up and auto sign-in with post-signup redirect
- Add GitHub and Google OAuth for social sign-on and handle new-user flows
- Enable two-factor authentication with TOTP and trusted devices via plugin
- Implement passkey (WebAuthn) registration and sign-in for passwordless auth
- Create organization CRUD and invitation flows for multi-tenant apps
FAQ
Better Auth supports direct drivers (SQLite, Postgres, MySQL, MongoDB) and adapters for Drizzle, Prisma, Kysely, and MongoDB clients.
How do I mount auth routes in my framework?
Use provided handlers or adapters (toNextJsHandler, svelteKitHandler, toNodeHandler, Hono integration) to map /api/auth/* to the Better Auth server instance.