Question presented to candidate: "Our Next.js monolith takes 25 minutes to build and three teams keep blocking each other's releases. Someone proposed Multi-Zones. What are they, how do they work, and would you recommend them here?"
What a strong answer should cover:
- A zone is a separate Next.js app serving a set of paths on the same domain (for example
/blog/*); a default zone serves everything else. - Routing by rewrites in the default app's
next.config(or any HTTP proxy, orproxy.tsfor dynamic decisions), andassetPrefixon each non-default zone so/_nextassets do not collide. - Navigation inside a zone is soft; crossing zones is a hard navigation, so links across zones should be plain
<a>tags and pages used together should share a zone. - Benefits: independent builds and deploys, smaller apps, team autonomy, even different frameworks. Costs: full reloads between zones, duplicated framework JavaScript, shared layout and design system drift, cross-zone Server Action origins, coordinated releases via feature flags.
- Alternatives to consider first: route groups and code ownership in one app, monorepo build caching, or splitting only truly separate sections.
Clarifying questions expected:
- "How often do users move between the sections we would split?" β frequent crossings make zones feel slow.
- "Is the pain build time, deploy coupling, or team ownership?" β some of those have cheaper fixes.
Code / implementation expected: Yes β the rewrites in the default zone and the assetPrefix in the other zone.