Next.js monorepo build process optimization

This page summarizes the projects mentioned and recommended in the original post on /r/nextjs

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • nextjs-monorepo-example

    Collection of monorepo tips & tricks

  • - If you're using yarn 1, go yarn 3+ with "node_linker: node_modules", eventually "nmMode: hardlinks-local" and yarn workspace plugin (example of .yarnrc.yml config). You'll get some speed up and the update should not be too long to do. Note: this gives comparable speed of pnpm in my experience (whatever benchmark I read).

  • Next.js

    The React Framework

  • - If you're relying on package builds, note than nextjs 11.1+ have an experimental feature that comes handy: https://github.com/vercel/next.js/discussions/26420. In combination with tsconfig paths, it removes the need of building packages. The app will consume files it needs inside the monorepo (a bit what Nx does). Note that to be strict it's good practice to define your deps in both package.json and tsconfig paths - see a [how to here](https://github.com/belgattitude/nextjs-monorepo-example/discussions/350#discussioncomment-1264216). Note: next-transpile-module is not required if you were using it for that.

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
  • ultra-runner

    🏃⛰ Ultra fast monorepo script runner and build tool

  • Then comes the question of triggering docker builds if you need to release images. If you have many apps, it's better to create a docker file for each, so you can decide which one needs to be built. Nx help in this area, because it can compute which apps needs to be rebuilt... If you have only few apps you can use github action paths (ie: simplified example) or eventually make use of things like [ultra-runner](https://github.com/folke/ultra-runner). Anyway docker and nextjs take times to setup (env...). It's another story.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts