Bilal Gokdag
Back to Blog

Setting Up Enterprise-Scale Micro-Frontend Architecture with Next.js

A guide to building independently deployable frontend teams for large-scale web projects using Webpack Module Federation and Next.js Multi-Zones.

Setting Up Enterprise-Scale Micro-Frontend Architecture with Next.js

Once a monolithic frontend application reaches a certain size, it starts seriously hurting developer experience (DX) and build times. For teams working on separate domains (e.g., a "Checkout Team," a "Product Catalog Team," and a "User Panel Team" in an e-commerce app) to develop and deploy independently of one another, Micro-Frontend architecture has become the go-to choice for enterprise companies today.

In this article, we'll look at the two most popular ways to set up a Micro-Frontend architecture within the Next.js ecosystem.

1. Next.js Multi-Zones (Built-in Solution)

Next.js's own "Multi-Zones" feature lets you merge multiple separate Next.js applications under a single domain. The applications are connected at the HTTP level, typically via a reverse proxy or Next.js's rewrites feature.

Advantages:

  • Relatively simple to set up.
  • Each application owns its own dependencies, giving maximum isolation.
  • Natively supported on platforms like Vercel.

Disadvantages:

  • Sharing common UI components (e.g., Header, Footer, Buttons) at runtime is difficult; they generally need to be published as an NPM package and pulled in at build time.

Configuration example (main app — next.config.js):

module.exports = {
  async rewrites() {
    return [
      {
        source: "/checkout",
        destination: `https://checkout.yourcompany.com/checkout`,
      },
      {
        source: "/checkout/:path*",
        destination: `https://checkout.yourcompany.com/checkout/:path*`,
      },
    ];
  },
};

Need this kind of work done on your project?

I build production-ready, high-performance web applications — let's talk about what you're building.

Start a Project