Use Next.js middleware for lightweight edge routing and guards. Use when protecting routes at the edge.