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.
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.
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
: Runbuild
scripts following your repository's dependency graphturbo build --filter=docs --dry
: Quickly print an outline of thebuild
task for yourdocs
package (without running it)turbo generate
: Run Generators to add new code to your repositorycd apps/docs && turbo build
: Run thebuild
script in thedocs
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:
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:
Use any of the example's names below:
Name | Description |
---|---|
basic | Minimal Turborepo example for learning the fundamentals. |
design-system | Unify your site's look and feel by sharing a design system across multiple apps. |
kitchen-sink | Want to see a more in-depth example? Includes multiple frameworks, both frontend and backend. |
non-monorepo | Example of using Turborepo in a single project without workspaces |
with-changesets | Simple Next.js monorepo preconfigured to publish packages via Changesets |
with-docker | Monorepo with an Express API and a Next.js App deployed with Docker utilizing turbo prune |
with-gatsby | Monorepo with a Gatsby.js and a Next.js app both sharing a UI Library |
with-prisma | Monorepo with a Next.js App fully configured with Prisma |
with-react-native-web | Simple React Native & Next.js monorepo with a shared UI library |
with-rollup | Monorepo with a single Next.js app sharing a UI library bundled with Rollup |
with-svelte | Monorepo with multiple SvelteKit apps sharing a UI Library |
with-tailwind | Monorepo with multiple Next.js apps sharing a UI Library all using Tailwind CSS with a shared config |
with-vite | Monorepo with multiple Vanilla JS apps bundled with Vite, sharing a UI Library |
with-vue-nuxt | Monorepo with Vue and Nuxt, sharing a UI Library |
Was this helpful?