better-auth

Configure authentication and authorization for NestJS apps with guards and decorators.

Updated Dec 26, 2025
One-click install
npx skills add https://github.com/JoyanLabs/template-nestjs-dashboard-better_auth --skill better-auth-joyanlabs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: better-auth
Source: https://github.com/JoyanLabs/template-nestjs-dashboard-better_auth/tree/main/skills/better-auth
Command: npx skills add https://github.com/JoyanLabs/template-nestjs-dashboard-better_auth --skill better-auth-joyanlabs

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes assets (resource) components.

What problem does it solve?

Better Auth provides a programmatic API for authentication and authorization in NestJS, eliminating ad-hoc middleware patterns and enabling more predictable control over sessions, roles, and permissions.

Core Features & Use Cases

  • API-driven authentication and session management integrated into NestJS controllers via helper utilities, decorators, and guards.
  • Fine-grained authorization with role-based access and permission checks across resources, enabling scalable security for admin and user workflows.
  • Use Case: build admin dashboards that require strict access control and session handling without embedding security logic in each controller.

Quick Start

Integrate the Better Auth module into your NestJS app and start authenticating users via the API-driven endpoints.

Frequently Asked Questions about better-auth

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

FAQPage Schema
How do I implement role-based access control in NestJS without duplicating middleware?

Authentication and authorization in NestJS can be handled programmatically via an API-first module with reusable guards and decorators. This eliminates ad-hoc middleware patterns and provides predictable control over sessions, roles, and permissions.

What is the best way to manage user sessions and permissions in a NestJS admin dashboard?

The best way to manage sessions and permissions is using fine-grained, role-based authorization integrated into NestJS controllers. This enables scalable security for admin workflows without embedding security logic into each controller.

Does this NestJS authentication approach use decorators and guards for API security?

Yes, this NestJS authentication approach uses decorators and guards to secure API endpoints. It provides an API-driven security layer with testable utilities to ensure consistent practices across controllers.

Can I test authorization logic separately from my NestJS controllers?

Yes, you can test authorization logic separately because the Skill provides modular testable utilities. This ensures consistent security practices across your NestJS application without requiring full controller integration.

When should I use a programmatic API for NestJS authentication over standard middleware?

You should use a programmatic API for NestJS authentication when you need predictable control over sessions, roles, and permissions across multiple controllers. It eliminates ad-hoc middleware patterns and scales security for admin workflows.