Architecture for PNPM + Turborepo + Multiple Netlify sites in Monorepo


Is there any guide or solution to use pnpm workspaces + turborepo + base directory deploy?

I have this structure:

├─ package.json
├─ turbo.json
├─ pnpm-workspace.yaml
├─ site-1/
│  ├─ netlify.toml
│  ├─ package.json
├─ site-2/
│  ├─ netlify.toml
│  ├─ package.json
├─ ui-library/
│  ├─ netlify.toml
│  ├─ package.json
// turbo.json
  "$schema": "",
  "baseBranch": "origin/main",
  "pipeline": {
    "dev": {
      "cache": false
    "build": {
      "dependsOn": [
      "outputs": [

And these are the dependencies logic

  • site-1 build depends on ui-library build (not working)
  • site-2 build do not depends on any other build ( it works )
  • ui-library build do not depends on any other build ( it works )
// site-1 package.json
  "dependencies": {
    "@organization/ui": "../ui-library",

site-1 build fails because it does not find the proper ui-library package.
If I try to add a cd .. command on the preInstall hook, the build fails with an ENOENT error

I don’t think we do have a guide for that. Our best docs on monorepos are here:

…but it just talks about our preferred layout, one subdirectory per project that is entirely contained.

Since then we’ve implemented npm workspaces support at least: feat: Support npm workspaces caching by zgriesinger · Pull Request #752 · netlify/build-image · GitHub …but I don’t think we have anything turborepo specific in our support yet.

Could you link us to the logs for a failing deploy for site-1, so we can see if we can glean any next steps by examining them? Please do link instead of copy-pasting as we’ll also use that link to find your site in our database to examine its settings there :slight_smile:

this is the deploy url:

Thanks! Looking at this error:

…how should that module be built or found by your build? Do you build it explicitly, or include the built copy of it in the repo already?

The module gets build at deploy. But that code and its build instructions its living in other folder. That behavior is inherited from Turborepo.

Hey @davidboom,

Sorry for the delay on this one. While we don’t have any strong advice for you yet, and part of the reason is the not-so-stable monorepo support on Netlify, we’re actively working with our devs to have some clear direction about this.

Meanwhile, could you confirm if clear cache and deploy works? Also, I know this would be sub-optimal, but probably you could deploy the packages as private NPM modules or directly use a Git repo as a module?

Hi @hrishikesh, thank you for the response.

The repo is working but:

  1. I have to omit base folder. So I have to build the root and then publish /project-1/dist
  2. If I have 3 subfolders that map directly to 3 different netlify projects, None of them have a base folder. All of them get built and deployed even if just one folder change its contents.
  3. ignoreBuild and plugins logic is a bit problematic because moving between folders with cd commands is not possible due to permission errors when a baseFolder is set.
    Deploying packages as npm modules or use git repo as a module will make Turborepo useless.

Hey @davidboom, it sounds like things are working as best they can (as Hrishikesh mentioned), and what you mentioned about Turborepo is accurate. If you have any additional questions on this let us know, we’d be happy to help however we can.