Back to list

Heavy Middleware Logic Increases Time to First Byte

6/10 Medium

Middleware that runs on every request with large libraries or poor tree-shaking increases TTFB, which directly affects FCP and LCP metrics.

Category
performance
Workaround
partial
Stage
build
Freshness
persistent
Scope
single_lib
Recurring
Yes

Sources

Collection History

Query: “What are the most common pain points with Next.js in 2025?3/27/2026

Middleware runs on every request. Problems arise when middleware includes: Large libraries. Heavy imports. Poorly tree-shaken dependencies. This increases TTFB, which directly affects both FCP and LCP.

Created: 3/27/2026Updated: 3/27/2026