Turborepo

Installation

Get started with Turborepo in a few moments using:

Terminal
npx create-turbo@latest

The starter repository will have:

  • Two deployable applications
  • Three shared libraries for use in the rest of the monorepo

For more details on the starter, visit the README for the basic starter on GitHub. You can also use an example that more closely fits your tooling interests.

Installing turbo

turbo can be installed both globally and in your repository. We highly recommend installing both ways so you can take advantage of fast, convenient workflows and a stable version of turbo for all developers working in your repository.

Global installation

A global install of turbo brings flexibility and speed to your local workflows.

Terminal
npm install turbo --global

Once installed globally, you can run your scripts through turbo from your terminal, quickly running one-off commands to use within your repository. For example:

  • turbo build: Run build scripts following your repository's dependency graph
  • turbo build --filter=docs --dry: Quickly print an outline of the build task for your docs package (without running it)
  • turbo generate: Run Generators to add new code to your repository
  • cd apps/docs && turbo build: Run the build script in the docs package and its dependencies. For more, visit the Automatic Package Scoping section.

Good to know:

turbo is an alias for turbo run. For example, turbo build and turbo run build will both run your build task.

Avoid multiple global installations

If you've installed global turbo before, make sure you use the same package manager as your existing installation to avoid unexpected behaviors. You can quickly check which package manager you previously used with turbo bin.

Using global turbo in CI

You can also take advantage of global turbo when creating your CI pipelines. Visit the Constructing CI guide for more information.

Repository installation

When collaborating with other developers in a repository, it's a good idea to pin versions of dependencies. You can do this with turbo by adding it as a devDependency in the root of your repository:

Terminal
npm install turbo --save-dev

You can continue to use your global installation of turbo to run commands. Global turbo will defer to the local version of your repository if it exists.

This lets you to get the best of both installations: easily run commands in your terminal while maintaining a pinned version for consistent usage for all developers in the repository.

Start with an example

The community curates a set of examples to showcase ways to use common tools and libraries with Turborepo. To bootstrap your monorepo with one of the examples, use the --example flag:

Terminal
npx create-turbo@latest --example [example-name]

Use any of the example's names below:

NameDescription
basicMinimal Turborepo example for learning the fundamentals.
design-systemUnify your site's look and feel by sharing a design system across multiple apps.
kitchen-sinkWant to see a more in-depth example? Includes multiple frameworks, both frontend and backend.
non-monorepoExample of using Turborepo in a single project without workspaces
with-changesetsSimple Next.js monorepo preconfigured to publish packages via Changesets
with-dockerMonorepo with an Express API and a Next.js App deployed with Docker utilizing turbo prune
with-gatsbyMonorepo with a Gatsby.js and a Next.js app both sharing a UI Library
with-prismaMonorepo with a Next.js App fully configured with Prisma
with-react-native-webSimple React Native & Next.js monorepo with a shared UI library
with-rollupMonorepo with a single Next.js app sharing a UI library bundled with Rollup
with-svelteMonorepo with multiple SvelteKit apps sharing a UI Library
with-tailwindMonorepo with multiple Next.js apps sharing a UI Library all using Tailwind CSS with a shared config
with-viteMonorepo with multiple Vanilla JS apps bundled with Vite, sharing a UI Library
with-vue-nuxtMonorepo with Vue and Nuxt, sharing a UI Library

hours

Total Compute Saved
Get started with
Remote Caching →

On this page