better-auth

Configure Drizzle-backed authentication for Next.js and NestJS monorepos.

2|Updated Jan 8, 2026
One-click install
npx skills add https://github.com/Quanby-IT-Solutions/turbo-template --skill better-auth-quanby-it-solutions
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: better-auth
Source: https://github.com/Quanby-IT-Solutions/turbo-template/tree/main/.ruler/skills/better-auth
Command: npx skills add https://github.com/Quanby-IT-Solutions/turbo-template --skill better-auth-quanby-it-solutions

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Streamlines and standardizes authentication across frontend and backend in the monorepo, reducing setup time and enhancing security practices.

Core Features & Use Cases

  • Shared auth configuration using Drizzle adapter for consistent backend state
  • Frontend client and server-side session management with lazy initialization
  • OAuth integration, login, signup, and protected routes across web and API layers

Quick Start

Enable the Better Auth workflow by wiring the shared config and frontend/backend clients to start login, signup, and session handling.

Frequently Asked Questions about better-auth

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up authentication for a monorepo with Next.js and NestJS?

Authentication for a monorepo with Next.js and NestJS is set up by wiring a shared Drizzle-backed configuration across both layers. This enables unified login, signup, and session management with a lazy-auth initialization pattern.

Can I use Drizzle for session management across web and backend?

Yes, you can use Drizzle for session management across web and backend. The skill provides a shared adapter that maintains consistent backend state and centralizes session handling for frontend and API layers.

What is the best way to add OAuth to a Next.js frontend and NestJS backend?

The best way to add OAuth to Next.js and NestJS is using an environment-driven configuration with shared auth clients. This approach standardizes protected routes and OAuth integration across the frontend and backend layers.

Does this authentication approach require environment variables for configuration?

Yes, environment-driven configuration is required. The authentication workflow relies on environment variables to initialize the shared auth clients and configure OAuth integration for both web and API layers securely.

How does lazy initialization work for authentication clients?

Lazy initialization for authentication clients defers the auth setup until it is actually needed during a user request. This pattern streamlines login and signup flows by preventing unnecessary immediate instantiation across frontend and backend environments.

Why standardize authentication across frontend and backend in a monorepo?

Standardizing authentication across frontend and backend in a monorepo reduces setup time and enhances security practices. It ensures consistent session handling and prevents configuration drift between Next.js and NestJS applications.