• Discover
  • Collections
  • Board
  • Create
  • Profile
  • Settings
Paths

Lesson 2.3: Getting Started with Turborepo - Basic Setup

Lesson 2.3: Getting Started with Turborepo - Basic Setup

1 min read

Setting up Turborepo in an existing (or new) JavaScript/TypeScript monorepo is straightforward. Turborepo integrates seamlessly with popular package managers that support workspaces, such as Yarn Workspaces, pnpm Workspaces, and npm Workspaces. The first step typically involves defining your workspaces in your package manager's configuration file (e.g., pnpm-workspace.yaml or package.json's workspaces field).

Next, you'll install turbo as a development dependency. The core configuration lives in a turbo.json file at the root of your monorepo. This file defines your pipeline, specifying how tasks (like build, test, lint) should be run, what files they output, and which other tasks they depend on. For example, a build task might depend on a lint task. Turborepo then orchestrates these tasks using the turbo run command, automatically applying caching and parallelism based on your configuration and the project's dependencies.

json
{ "$schema": "https://turbo.build/schema.json", "pipeline": { "build": { "dependsOn": ["^build"], "outputs": [".next/**", "dist/**"] }, "lint": {}, "dev": { "cache": false, "persistent": true } } }

This minimal turbo.json tells Turborepo about your build, lint, and dev scripts, defining dependencies and output files for efficient caching.

End of lesson
👏Well done!
Previous Lesson
Lesson 2.2: The Core Concepts: Caching and Parallelism
Next Lesson
Quiz: Module 2: Introducing Turborepo - The High-Performance Build System

Course Content

0% Complete0/16 Lessons

Lesson 1.1: Polyrepo vs. Monorepo - A Fundamental Choice

Lesson 1.2: The Advantages of a Monorepo

Lesson 1.3: The Challenges of a Monorepo

Quiz

Lesson 2.1: What is Turborepo and Why Was It Created?

Lesson 2.2: The Core Concepts: Caching and Parallelism

Lesson 2.3: Getting Started with Turborepo - Basic Setup

Quiz

Course Content

0% Complete0/16 Lessons

Lesson 1.1: Polyrepo vs. Monorepo - A Fundamental Choice

Lesson 1.2: The Advantages of a Monorepo

Lesson 1.3: The Challenges of a Monorepo

Quiz

Lesson 2.1: What is Turborepo and Why Was It Created?

Lesson 2.2: The Core Concepts: Caching and Parallelism

Lesson 2.3: Getting Started with Turborepo - Basic Setup

Quiz