• ShipSaaSDocumentation
  • Introduction
  • Getting Started
    • Installation
    • Environment Setup
    • Database Setup
    • Development Guide
  • Database
    • Repository Pattern
    • Drizzle Queries
    • Migration Workflow
    • Drizzle Studio
    • Best Practices
  • File Management
    • File Upload Component
    • Server Actions
    • Storage Configuration
  • Authentication Methods
    • Credentials Authentication
    • Magic Link Authentication
    • Two-Factor Authentication (2FA)
    • Social Authentication
    • API Keys & Bearer Tokens
    • Organizations (Multi-tenant)
  • Authorization & Permissions
    • Roles & Hierarchy
    • Route Protection
    • API Protection
    • CASL Permissions
  • Email & Notifications
    • Resend Setup
    • React Email Templates
    • Notification System
    • Email Workflows
    • Customization & Extension
  • Stripe & Payments
    • Stripe Setup
    • Better Auth Integration
    • Checkout Methods
    • Subscription Management
    • Admin Dashboard
    • Webhook Events
  • Architecture & Development
    • Presentation Layer
    • Service Layer
    • Persistence Layer
    • Helpers Architecture
    • Project Structure
    • Development Workflow
  • Testing
    • General Testing
    • Unit Testing
    • UI Component Testing
    • Repository Testing
    • Service Testing
    • End-to-End Testing
  • Deployment
    • Vercel Deployment
    • GitHub Actions CI/CD
    • Database Backup & Restore
    • Database Migrations
    • Troubleshooting Deployment
  • AI Agents Integration
  • Blog Management
    • Blog Setup
    • MDX Blog
    • Database Blog
  • Async Tasks
    • Setup
    • Email Workflows
    • Payment Processing
    • Maintenance Jobs
  1. Documentation
  2. Authorization & Permissions
Buydocschangelogsdemocommunity

Authorization & Permissions

PreviousOrganizations (Multi-tenant)NextRoles & Hierarchy
On this page
Authentication vs AuthorizationAuthorization Topics

Authorization controls what authenticated users can access in your application. The boilerplate includes a comprehensive role-based access control (RBAC) system with hierarchical permissions.

Perfect for: Multi-role applications, admin panels, permission-based features, and enterprise security requirements.

Authentication vs Authorization

"Who are you?"

  • Login with email/password
  • Verify user identity
  • Create secure session
  • Handled by Better Auth

Result: User is logged in or not

"What can you do?"

  • Check user permissions
  • Validate role-based access
  • Control feature visibility
  • Handled by CASL + custom logic

Result: User can or cannot access specific resources

Key concept: Authentication gets you in the door. Authorization decides which rooms you can enter.

Authorization Topics

👑

Roles & Hierarchy

User roles from GUEST to SUPER_ADMIN with inheritance system

🛡️

Route Protection

Protect pages with withAuth HOC and middleware

🔒

API Protection

Secure API routes with role and permission checks

⚖️

CASL Permissions

Fine-grained permissions with CASL integration

Complete security system! Your SaaS application has enterprise-grade authorization protecting every resource based on user roles and permissions.