CodeZettaInterview Hub

Next.js · Middleware · Junior · Best Practice

What should you avoid doing in Middleware?

Short Interview Answer

Heavy DB calls, complex business logic, large dependencies, and assuming it is the only security layer.

Detailed Explanation

Cold start and CPU limits matter on Edge. Prefer JWT/session cookie checks that are cheap. Defer deep authz to server code.

Did you know this answer?