Post

Two Years of Lessons with a TypeScript Monorepo

santerre.xyz / 2023

Introduction

At Borderless, we used TypeScript across browser and server applications to share code and types across deployed systems. The biggest lessons were less about TypeScript itself and more about repository shape, module boundaries, builds, and developer workflows.

Goals

  • Keep the structure simple enough for new engineers to understand.
  • Keep builds fast enough that deploys remain routine.
  • Automate repetitive package setup and code generation tasks.
  • Make common package patterns consistent across the repository.

First iteration

We split independently deployable packages into apps and reusable code into packages. Each app or package kept its own package manifest so that dependency boundaries were visible and import decisions stayed explicit.

The build pipeline

In a monorepo, builds, linting, and tests can cascade through dependent packages. Turborepo worked well for this shape because each package had a standard task surface and cacheable outputs.