DocLayer Monorepo

pnpm workspaces, Turborepo, and workflows for the DocLayer monorepo

On this page, you'll find everything you need to know about the DocLayer monorepo: its structure, setup, workflows, best practices, and the conventions we follow.

It is a great starting point for building on top of DocLayer or for contributing - whether that means adding new features or fixing bugs and issues. The main goal behind its structure and technology choices is to streamline and accelerate both development and contribution processes.


Building blocks

There are two main tools that we've used to manage the structure:

  • PNPM Workspaces - Enables shared dependencies, streamlined scripts, and consistent versioning across your projects, making development and maintenance much easier. About why we've picked the PNPM as a package manager you can read more here.
  • Turborepo - A high-performance build system and monorepo tool from Vercel (originally independent) that helps organize, cache, and optimize tasks across projects, speeding up builds and development workflows. And since it's built on top of workspaces (following package manager conventions), it fits and works very well with PNPM.

Structure

Below you can find the base structure of the monorepo. We follow the structure suggested by Turborepo, and in our experience, this approach works best as it is both intuitive and logical.

├── apps/│   └── docs/              # @vuehouse/dl-docs — the doclayer.dev documentation app├── packages/│   ├── config/│   │   ├── eslint/        # Shared ESLint config (`@vuehouse/eslint-config`)│   │   └── builder/       # Shared build config (`@vuehouse/build-config`)│   ├── cli/               # DocLayer CLI `(`@vuehouse/dl-cli`)│   ├── mdl-rules/         # Markdownlint rules (`@vuehouse/dl-mdl-rules`)│   └── modules/           # Publishable Nuxt modules (siblings, not nested)│       ├── dl/            # @vuehouse/dl│       ├── core/          # @vuehouse/core│       ├── search/        # @vuehouse/dl-search│       ├── ai-kit/        # @vuehouse/dl-ai-kit│       └── vercel/        # @vuehouse/dl-vercel├── turbo.json             # Turborepo task graph├── pnpm-workspace.yaml    # Workspace packages and dependency catalogs├── .npmrc└── .env.export.sh         # Shell script for exporting shared environment variables

There are more files in the root folder, but the ones listed above are the most relevant for setting up, and running the monorepo.

The main idea behind is to have two main entry points in the repository:

  • apps - The dynamic applications folder; this is where you run the runtime processes and where your applications live.
  • packages - Reusable, static, modular code shared across the entire repository - not just within applications, but also between other packages. These are intended to be built and published for use outside the monorepo as well.

Thanks to PNPM Workspaces, packages can be installed and linked across the entire repository just as if they were downloaded from a remote registry like NPM or GitHub Packages. This allows you to test your workflow almost exactly as it would run in production, once your packages are installed and bundled.

In this monorepo, the DocLayer documentation application - apps/docs (@vuehouse/dl-docs) - is the main consumer that wires the published packages together. When you're building from scratch, use this app as the reference for how a DocLayer site is assembled.

The documentation app is the one you're using and seeing right now. Throughout this page - and on many others - we reference it as the final source and outcome of the build process.

Prerequisites

Before installing any monorepo items (apps and/or packages), make sure you meet the prerequisites that we identify as the most reliable, safe, and modern for building within this structure.

{  // the rest of the package.json  "engines": {    "node": "^20.22.0 || ^22.22.0",    "pnpm": "^10.34.5"  },  "packageManager": "pnpm@10.34.5"}

If your system does not meet the required Node or pnpm versions, your package manager will notify you during the installation process.

Installation

To install dependencies for all items in the monorepo, simply run pnpm install in your console.

To prevent mismatches between package versions, we've included a few overrides to ensure that crucial packages are installed at the same version throughout the monorepo. You can find these overrides in the pnpm-workspace.yaml file.

Postinstall

Turborepo handles the installation processes in parallel. After all packages have been installed, the automatic postinstall script runs, which is equal to run Turborepo's dedicated pipeline, as well as the Husky process.

Additionally, we use a few global environment variables. To provide these to all packages and apps that need them, run the dedicated shell script, which will source these variables for you.

source .env.export.sh

Dependency Catalogs

Before we jump into the scripts that run applications and help manage other processes, let's introduce one more great feature of PNPM Workspaces that we use to ensure dependency alignment across the monorepo. These are the Dependency Catalogs.

PNPM Dependency Catalogs allow to centrally define version and manage sets of dependencies for your entire monorepo. Instead of specifying version numbers individually in every package, you can refer to catalogs - making it easy to keep dependencies aligned and up-to-date across all apps and packages. This helps reduce duplication, simplify upgrades, and ensures consistency throughout the workspace.

We have a couple of catalogs that help us differentiate packages belonging:

  • catalog:global - Used for dependencies that are shared widely across the entire monorepo, regardless of whether the consumer is a package or an application. This includes core tooling, CLI utilities, and major libraries that multiple items rely on (e.g., ESLint, Commitlint, Prettier).
  • catalog:nuxt - Contains all dependencies related to Nuxt and its ecosystem. This ensures all Nuxt-based apps and packages use compatible and aligned Nuxt versions, including Modules like @nuxt/content, @nuxt/ui, and related utilities.
  • catalog:tailwind - Gathers all Tailwind CSS-related packages in one place.
  • catalog:modules - Designed for third-party and internally used Nuxt modules that are not considered “core” tooling but are still tightly coupled or commonly used across multiple packages and apps.
  • catalog:doclayer - Contains dependencies that are essential and specific to DocLayer as the final module package. These are basically not used elsewhere in the monorepo.
  • catalog:vuehouse - Workspace packages published from the @vuehouse organization (@vuehouse/cli, and the rest), referenced when a consumer should resolve the published build rather than workspace:*.

This catalog-based approach allows every package and app in the workspace to reference dependencies by catalog alias - instead of version - making upgrades and maintenance dramatically easier. It looks like this:

{  // the rest of the package.json  "dependencies": {    "any-package": "catalog:global"  }}

Version discipline

When managing Nuxt-related packages, we strictly follow semantic versioning principles to ensure stability and predictable upgrades. For major packages that are well-established and stable (such as nuxt, @nuxt/content, @nuxt/ui, and similar) - crucial for the whole product - we lock versions to the latest compatible minor release by preferring ~ prefixes (e.g., ~4.2). This allows for non-breaking updates within the same minor version. We use this approach to maintain safety during periods of frequent minor releases. After each update, that is thoroughly tested, we upgrade promptly.

For early-stage or fast-evolving packages, we may pin to a precise version to avoid unexpected breaking changes, only updating when tested - this typically means using exact versions (e.g., 3.0.0-beta.12), especially for pre-releases or experimental modules.

Scripts

The package.json scripts are closely integrated with Turborepo pipelines; in most cases, they run combined processes that help streamline work across the monorepo. Use these scripts while contributing or as a reference when adding your own ones.

Development mode

The easiest way to start working with the monorepo and the core app (Docs) would be - just after the installation - running this sequence of commands:

# build companion packages for developmentpnpm build:package# stub modules for developmentpnpm module:stub# start the documentation app (development mode)pnpm docs:dev

dldev mode

When working with stubbed modules, use the --dldev flag when running the docs app. This enables development mode for the DocLayer package, ensuring the module's assets are loaded from the src directory instead of dist.

pnpm dev --dldev

Additionally, when building the app with stubbed modules (which is generally discouraged as it may cause unexpected behavior), you should set the DL_DEV environment variable to true to enable DocLayer package development mode. This is equivalent to running the app with the --dldev flag. The environment variable is necessary during an isolated build, because that process may not see the CLI flag. You can also use DL_DEV in development if it is more convenient.

DL_DEV=true pnpm build

Turborepo

This monorepo is managed using Turborepo, which provides fast, scalable pipelines for scripts and tasks across all packages and apps. Below you can find a short description of the most important parts of its setup.

Pipelines

Turborepo pipelines are defined in turbo.json and orchestrate tasks across the monorepo. Each pipeline can have dependencies, caching strategies, and specific configurations.

Environment variables

As previously mentioned, environment variables should be provided for all apps and packages. Additionally, they should also be set for Turborepo itself, since it orchestrates processes across the monorepo and needs to be aware of these variables globally. When contributing the variables will be provided for you along.

When setting up environmental variables across the monorepo it's very useful to use the .env.export.sh script. It will source the variables for you and make them available to all apps and packages. You can read more about it here.

Typescript

There is no global TypeScript configuration; each configuration is specific to an individual package or app. Refer to those specific configs to learn more about their setup. The DocLayer package also has additional resolutions handled by dedicated modules and Nuxt hooks to satisfy the structure and dependencies between the module and the final application. More about this setup you can read here.

VSCode

Our recommended editor is any modern VSCode AI-based variant, such as Cursor or Windsurf. Refer to the .vscode/settings.json file to see the development environment preferences we use for the best experience.