Skip to main content
Auto Protect automatically enforces access control on pages matching configured URL patterns, without requiring code changes on each page.

Quick Setup

Configuration

Basic Configuration

Pattern Options

URL Patterns

Usage Examples

Protect Dashboard

Plan-Based Protection

Multiple Plans

React Integration

With Router

Protected Route Component

Event Handlers

Loading States

Show Loading While Checking

Custom Loading UI

Caching

Access checks are cached to improve performance:
To clear cache:

Server-Side Rendering

For SSR frameworks, check access on the server:

Debugging

Enable debug mode:
This logs:
  • Pattern matching results
  • Access check outcomes
  • Redirect decisions

Best Practices

More specific patterns should come before general ones.
Ensure your login and upgrade URLs are consistent across patterns.
Consider what happens when users navigate directly to protected URLs.
Test all patterns with different user states (logged out, free, pro, etc.).