Installation

コンテンツ

Get started with Turborepo in a few moments using:

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.

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.

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

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.

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

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:

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.

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:

Use any of the example's names below:

Name

Description

Minimal Turborepo example for learning the fundamentals.

Unify your site's look and feel by sharing a design system across multiple apps.

Want to see a more in-depth example? Includes multiple frameworks, both frontend and backend.

Example of using Turborepo in a single project without workspaces

Simple Next.js monorepo preconfigured to publish packages via Changesets

Monorepo with an Express API and a Next.js App deployed with Docker utilizing turbo prune

Monorepo with a Gatsby.js and a Next.js app both sharing a UI Library

Monorepo with a Next.js App fully configured with Prisma

Simple React Native & Next.js monorepo with a shared UI library

Monorepo with a single Next.js app sharing a UI library bundled with Rollup

Monorepo with multiple SvelteKit apps sharing a UI Library

Monorepo with multiple Next.js apps sharing a UI Library all using Tailwind CSS with a shared config

Monorepo with multiple Vanilla JS apps bundled with Vite, sharing a UI Library

Monorepo with Vue and Nuxt, sharing a UI Library

要約する
Turborepo allows for efficient monorepo management with global and local installations of 'turbo'. It offers fast workflows and stable versions for all developers. Pin versions of dependencies with 'turbo' as a 'devDependency'. The community provides examples like 'basic' for learning, 'design-system' for unified design, and 'kitchen-sink' for a comprehensive example. Other examples include 'with-changesets', 'with-docker', 'with-gatsby', 'with-prisma', 'with-react-native-web', 'with-rollup', 'with-svelte', 'with-tailwind', 'with-vite', and 'with-vue-nuxt' for various setups in a monorepo.