tldraw/tldraw
Getting started
This page walks through cloning the repo, installing dependencies, and running the most common workflows.
Prerequisites
- Node
^20.0.0 - Yarn 4 (managed via Corepack)
- A POSIX-ish shell (macOS or Linux). Windows works through WSL2.
npm i -g corepackThe repo's package manager is pinned in package.json ("packageManager": "yarn@4.12.0"). Do not use npm; the lockfile is yarn-shaped and many scripts assume Yarn workspaces.
Install
From the repo root:
yarnThe postinstall step runs husky install && yarn refresh-assets, which wires the git hooks under .husky/ and regenerates the asset modules under packages/assets/.
Common commands
These come from the root package.json and are documented in AGENTS.md.
Develop
| Command | What it does |
|---|---|
yarn dev |
Starts the examples app at http://localhost:5420. This is the canonical SDK dev loop. |
yarn dev-app |
Starts the tldraw.com client and its workers. |
yarn dev-docs |
Starts the docs site at apps/docs. |
yarn dev-vscode |
Opens the VS Code extension folder and starts its dev tasks. |
yarn dev-template <name> |
Runs one of the templates under templates/. |
Build
| Command | What it does |
|---|---|
yarn build |
Incremental build of every changed package via lazyrepo. |
yarn build-package |
Builds only the SDK packages (packages/*). |
yarn build-app |
Builds apps/dotcom/client. |
yarn build-docs |
Builds the docs site. |
yarn build-api |
Regenerates the api-extractor reports for public APIs. |
yarn build-i18n |
Builds translation bundles. |
Test
| Command | What it does |
|---|---|
yarn test |
Runs Vitest in watch mode across the whole repo (slow; prefer per-workspace). |
yarn vitest run (in a workspace) |
One-shot test run for that workspace. |
yarn vitest run --grep "<pattern>" |
Filter tests by name. |
yarn e2e |
Playwright e2e for the examples app. |
yarn e2e-dotcom |
Playwright e2e for tldraw.com. |
yarn test-coverage |
Coverage report; opens the HTML output. |
Lint, format, typecheck
| Command | What it does |
|---|---|
yarn typecheck |
Refreshes assets, then runs the repo-wide TypeScript check via internal/scripts/typecheck.ts. |
yarn lint |
Runs internal/scripts/lint.ts (oxlint + eslint). |
yarn lint-current |
Lints only files changed against main. |
yarn format / yarn format-current |
Same with --fix. |
yarn api-check |
Validates the public API reports for the SDK packages. |
Other
yarn refresh-assets— regenerates the modules underpackages/assets/fromassets/.yarn check-packages— sanity-checkspackage.jsonfiles across the workspace.yarn check-circular-deps—internal/scripts/check-circular-deps.ts.yarn clean—internal/scripts/clean.sh.
Your first edit
To make a small change to the SDK and see it in the browser:
yarn dev(this runsapps/examples,packages/tldraw,apps/bemo-worker, andapps/dotcom/image-resize-workerin parallel throughlazyrepo).- Edit something in
packages/tldraw/src/lib/...orpackages/editor/src/lib/.... - Watch the change reload at
http://localhost:5420. - Run a focused test:
cd packages/tldraw && yarn vitest run --grep "<thing you touched>". - If you touched cross-package types, run
yarn typecheckfrom the repo root. - If you touched a public export, run
yarn api-check.
Cloning starter templates
To bootstrap a new app outside the monorepo:
npx create-tldraw@latestThis is implemented in packages/create-tldraw/ and pulls from templates/.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.