Skip to content

Monorepo Setup

Krait automatically discovers all workspaces in a monorepo by walking the directory tree and finding manifest files (package.json, go.mod, Cargo.toml, CMakeLists.txt).

For most monorepos, just run:

Terminal window
krait init

krait init scans your project, detects all workspaces, and generates .krait/krait.toml:

$ cd ~/projects/my-monorepo
$ krait init
Detected project root: /Users/me/projects/my-monorepo
Detected workspaces:
typescript packages/api
typescript packages/common
typescript packages/web
go backend
Written: krait.toml (4 workspaces)
Edit this file to customize which workspaces to index.
[[workspace]]
path = "packages/api"
language = "typescript"
[[workspace]]
path = "packages/common"
language = "typescript"
[[workspace]]
path = "packages/web"
language = "typescript"
[[workspace]]
path = "backend"
language = "go"

Krait runs one LSP process per language and dynamically attaches workspace folders via workspace/didChangeWorkspaceFolders. This means:

  • No restart needed when switching between packages
  • Shared type information across packages of the same language
  • Minimal memory footprint vs. one-server-per-workspace

Krait is tested against real-world monorepos:

ProjectStackWorkspaces
medusaTypeScript76
meetTypeScript6
WeKnoraGo + TypeScript3