Integrations

Next.js middleware or per-route?

2 replies · 394 views · started Aug 27, 2026
NG
Nathan G
Aug 27, 2026
Question

Where do people put the verify call in a Next app? Middleware feels right but I don't want to add a network round trip to every page.

JM
Jordan M
Aug 27, 2026

Middleware, but cache the answer. The verify response carries an entitlement token that's good for several days — hold that, and you're only calling out when it's near expiry rather than on every request.

That's also what keeps your site up if BuildAPI is unreachable: the remembered answer stands until the token's grace runs out.

NG
Nathan G
Aug 27, 2026

Entitlement token was the piece I'd skipped. That solves both problems at once.