Table of Contents — scroll spy with animated tree indicator and mobile popover
Open inStatic preview — active: Mount the handler
Interactive — scroll to update the indicator. On mobile widths, a sticky bar shows scroll progress and expands into the full TOC.
Quick Start
Get up and running in minutes. Install the package, configure your environment, and add the handler to your application entry point.
Usage
Learn how to integrate the handler into your stack. The API is designed to stay out of your way while giving you full control over auth flows.
Mount the handler
Place the handler at the root of your app so every route and server action can access the session. This section walks through the exact mount points for Next.js, Remix, and plain Node.
Usage tips
Prefer lazy session reads on static pages, cache session lookups per request, and keep redirect URLs explicit so users land where they expect after sign-in.
Protecting Resources
Once the handler is mounted, you can guard pages, layouts, and server functions with a consistent API. Pick the pattern that matches your routing model.
Protecting Routes
Wrap individual routes with a guard that checks the session before rendering. Redirect unauthenticated users to your sign-in page.
Protecting Multiple Routes (Layout)
Apply protection at the layout level when an entire section of your app requires authentication. Child routes inherit the guard automatically.
Protecting Server Functions
Validate the session inside server actions and route handlers before performing mutations or returning sensitive data.