Middleware
authMiddleware
Protect your routes at the edge. The authMiddleware intercept requests before they reach your application, ensuring unauthorized users are redirected early.
Usage
Create a middleware.ts file in your root directory:
terminal
export default authMiddleware({
publicRoutes: ["/signin", "/signup"]
});Security & Performance
Edge Execution
Runs before React components even begin to render, providing faster redirects and reduced server load.
Bypass Protection
Prevents UI-only authentication bypass by enforcing security rules at the network level.