authentication

Configure Better Auth with Drizzle and PostgreSQL for Next.js 15+ legal apps.

1|13|Updated Dec 31, 2025
One-click install
npx skills add https://github.com/CaseMark/casedotdev-starter-app --skill authentication-casemark
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: authentication
Source: https://github.com/CaseMark/casedotdev-starter-app/tree/main/skills/auth
Command: npx skills add https://github.com/CaseMark/casedotdev-starter-app --skill authentication-casemark

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill standardizes and streamlines authentication, authorization, and access control for Next.js 15+ legal applications, ensuring secure user sessions and compliant role management across firms.

Core Features & Use Cases

  • Discovery-driven: guides the team to understand user requirements before implementing auth, including multi-tenant and role-based access patterns.
  • Implementation patterns: provides code templates and runtime patterns for email/password, OAuth, SSO, and two-factor authentication.
  • Use Case: Example: a law firm needs employees and clients to securely sign in, access only their own matters, and rotate access with organization-level permissions.

Quick Start

  • Run through the discovery prompts in the SKILL.md, set up Better Auth with a database, and integrate with existing app code via the provided snippets.

Frequently Asked Questions about authentication

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

FAQPage Schema
How do I set up authentication and role-based access control for a multi-tenant Next.js legal app?

Authentication for multi-tenant Next.js legal apps is established by running discovery prompts to gather requirements, then integrating Better Auth with a PostgreSQL database using Drizzle to enforce organization-level permissions. This provides secure user sessions and compliant role management across firms.

What is the best way to configure OAuth and 2FA login workflows for law firm clients?

Configuring OAuth and 2FA login workflows for law firm clients is achieved using provided code templates and runtime patterns for Better Auth. This supports secure sign-in, allowing employees and clients to access only their own matters with organization-level permissions.

Can I use Better Auth with Drizzle and PostgreSQL for Next.js 15+ applications?

Better Auth works seamlessly with Drizzle and PostgreSQL backends for Next.js 15+ applications. The skill provides specific templates and references to integrate these technologies, ensuring secure user sessions and compliant role management.

Does this authentication approach support organization-level permissions for different firm environments?

This authentication approach fully supports organization-level permissions for different firm environments. It includes optional organizations and discovery-driven requirements gathering to implement compliant role management and multi-tenant access patterns.

How does discovery-driven requirements gathering work before implementing auth?

Discovery-driven requirements gathering works by guiding teams through prompts in the SKILL.md to understand user requirements before implementing auth. This process clarifies multi-tenant and role-based access patterns, ensuring the authentication setup matches specific firm needs.

What are the limitations of using Better Auth for Next.js legal applications?

Better Auth for Next.js legal applications requires a YAML frontmatter with name and description and depends on PostgreSQL with Drizzle. It is specifically tailored for Next.js 15+ legal apps, meaning standard non-legal or older Next.js implementations may not align with its compliant role management templates.