How to Build a Scalable Design System in a Monorepo

Iniciado por joomlamz, Hoje at 02:15

Respostas: 0   |   Visualizações: 4

Tópico anterior - Tópico seguinte

0 Membros e 1 Visitante estão a ver este tópico.


                     How to Build a Scalable Design System in a Monorepo
               




Tópico:
                     How to Build a Scalable Design System in a Monorepo
               
Categoria: Tutoriais | FreeCodeCamp Premium
Idioma Principal: Português (Conteúdo de Tecnologia)

Conteúdo do Tutorial / Guia Passo a Passo:
-------------------------------------------------------------------------
When you hear "Scalable Design System with a Monorepo Ecosystem" it might sound like a bunch of jargon glued together. Let's simplify:

• Design system: the building blocks of your product (buttons, inputs, styles, tokens, patterns).

• Monorepo: one big repo with multiple packages living together, sharing tooling and workflows.

Now here's the magic: when you combine them, you get modularity, consistency, and a faster development cycle. Basically the dream setup for teams working across web, mobile, and beyond.

In this article, you'll learn how to build a modular, scalable design system using React and Turborepo – the same approach used by Microsoft, IBM, and Shopify.

Table of Contents

• Prerequisites

• Who's Already Doing This?

• Why it Works

• Think of it Like a Ladder

• The Same Design System, Everywhere

• Should You Go Monorepo?

• When a Monorepo Is Not the Right Fit

• Let's Build Our Design System

• Create Your Turborepo Project

• Design Your Package Structure

• Build Your Design Tokens Package

• Create Primitive Components

• Configure the Turborepo Pipeline

• Build the @yourds Packages

• Use Your Design System in an App

• Wrapping Up

Prerequisites

Before you follow along, you'll want to have a few things in place:

• Working knowledge of React and TypeScript: You should be comfortable creating components and reading basic type annotations.

• Familiarity with the command line: You'll run
npx,
npm, and similar commands throughout.

• Node.js installed (v18 or later): Verify with
node -v. If you don't have it, install it from nodejs.org.

• A package manager: This guide uses
npm, but
pnpmor
yarnwill work with minor command tweaks.

• A code editor of your choice (VS Code is a popular fit for TypeScript work).

You don't need any prior experience with monorepos or Turborepo. We'll set everything up from scratch.

Who's Already Doing This?

Turns out, some of the biggest design systems you've heard of run inside monorepos:

• Microsoft Fluent UI: lives in a multi-package monorepo that ships React components, Web Components, and even design tokens.

• IBM Carbon: multiple packages like
@carbon/ibm-productscome straight out of their Carbon monorepo.

• Shopify Polaris: openly describes itself as a monorepo, packaging React components, docs, and even a VS Code extension.

• Atlassian Atlaskit: their public
@atlaskit/*packages are published from a large internal monorepo.

• MUI (Material UI): maintained as a mono-repository to coordinate React components, tooling, and docs.

• Elastic EUI: developed and released from a single repo, with discussions about monorepo publishing flows.

Why it Works

When you put all the pieces of your design system in one repository, you get a few specific advantages that are hard to replicate in a split-repo setup. Each of these reinforces the others, which is why teams that adopt this pattern rarely go back.

Here's what makes it work:

• Consistency: tokens, styles, and primitives are defined once and flow everywhere.

• Faster iteration: fix a bug in Button and the updates cascade to mobile, desktop, and docs instantly.

• Shared tooling: linting, tests, CI pipelines, and release workflows are configured once, and then applied to all packages.

• Versioning control: with tool

... [O tutorial continua no link abaixo] ...


Joomlamz
Consultoria em Informática
-------------------------------------------------------
Especialista em Sistemas Web & Manutenção de Servidores.
A desenvolver o novo AplPortal com suporte a PHP 8.
Precisa de ajuda profissional? Contacte-me.

Tags: