TypeScript Monorepos: Architect Maintainable Codebases

4 hours, 19 minutes CC
TypeScript Monorepos: Architect Maintainable Codebases

Course Description

Make even the largest monorepos feel fast and light! Go from monolith to monorepo as you refactor a codebase with Learna and Nx. Centralize ESLint, tsconfig, and testing configurations for consistency. Unify dependency version across packages and spot dead code and unused exports. Gain hands-on experience with modern tooling from the TypeScript monorepo ecosystem.

This course and others like it are available as part of our Frontend Masters video subscription.

Preview
Close

Course Details

Published: September 12, 2025

Learn Straight from the Experts Who Shape the Modern Web

Your Path to Senior Developer and Beyond
  • 250+ In-depth courses
  • 18 Learning Paths
  • Industry Leading Experts
  • Live Interactive Workshops

Table of Contents

Introduction

Section Duration: 17 minutes
  • Introduction
    Mike North introduces course by discussing the benefits of Monorepos, like simplified dependency management and easier testing across packages. He also outlines what the course will cover, including setting up a Monorepo, linking packages, running dependency-aware tasks, defining boundaries, and generating documentation with tools like pnpm and lerna.
  • Course Project Overview
    Mike introduces the course project, a minimal Svelte and Node app that will be refactored into a monorepo to demonstrate package linking and dependency-aware task execution. He also covers tools for managing API boundaries, generating docs, syncing code ownership, and keeping packages clean and consistent.
  • Monorepo Tooling Q&A
    Mike answers student questions regarding the relationship between monorepos and micro front end architecture, using monorepos for creating libraries, and using TurboRepo compared to NX. Mike also touches on using pnpm for enterprise projects and shares insights on indicators for choosing between monorepos and poly repos based on package interrelatedness and tooling needs.

Setup

Section Duration: 20 minutes
  • Project Setup
    Mike highlights the importance of using pnpm for the course, covers installation, project setup, running tasks, and verifying everything works. He also explains integrating multi-language packages in a monorepo and stresses identifying separable app components before transitioning.
  • Setup pnpm Workspace & Scripts
    Mike demonstrates setting up a new package in a monorepo by creating a folder, moving code, configuring package JSON, adding scripts, and preserving git history. He highlights pnpm for its readable lock files and smooth restructuring.

Extracting Server

Section Duration: 55 minutes
  • Extracting Models
    Mike shows how to refactor a UI package into multiple monorepo packages, starting with low-dependency modules like models. He covers file moves, package setup, dependency management, and build scripts to improve structure and maintainability.
  • Setup TS Configs
    Mike walks through setting up TypeScript configurations for type checking and building processes. Mike also highlights structuring TS configs consistently across the monorepo for efficient development and compilation processes.
  • Integrating Models & Library Package
    Mike discusses integrating models into the UI codebase by updating the package.json file to specify dependencies within a monorepo using pnpm. Mike also discusses strategies like using project references to optimize TypeScript performance in large monorepos.
  • Extracting Server Package
    Mike demonstrates breaking and factoring out from the UI package into a server package, resulting in three packages: models, server, and UI. The process involves organizing folder structures, moving code and tests, setting up package JSON, handling dependencies, and ensuring a working build process with pnpm.

Managing Dependencies & Code Formatting

Section Duration: 1 hour, 28 minutes

API & Monorepo Tools

Section Duration: 1 hour, 1 minute

Wrapping Up

Section Duration: 16 minutes
  • Wrapping Up
    Mike wraps up by answering questions on monorepo structure, overriding Nx cloud for task caching, evaluating tools like Zod and Arctype, building Nx generators, and switching to pnpm at scale.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now