Skip to main content

Overview

Proton WebClients is a Yarn 4 monorepo containing multiple web applications and shared packages. The workspace structure enables efficient dependency management and code sharing across projects.

Workspace Structure

The monorepo is organized into the following workspace categories:
{
  "workspaces": [
    "applications/*",
    "applications/pass-desktop/native",
    "packages/*",
    "packages/wasm/*",
    "tests",
    "tests/mail-renderer",
    "tests/packages/*",
    "utilities/*",
    "vendor/*/*"
  ]
}

Directory Layout

  • applications/ - Web applications (Mail, Drive, Calendar, Pass, etc.)
  • packages/ - Shared libraries and utilities
  • packages/wasm/ - WebAssembly modules
  • tests/ - Test utilities and configurations
  • vendor/ - Third-party dependencies

Managing Dependencies

Installing Dependencies

Install all dependencies for the entire monorepo:
yarn install
Yarn 4 uses the node_modules linker strategy as configured in .yarnrc.yml.

Adding Dependencies

Add a dependency to the root workspace:
yarn add <package-name> -W

Removing Dependencies

yarn workspace <workspace-name> remove <package-name>

Workspace Commands

List Workspaces

List all workspaces in the monorepo:
yarn workspaces list
List with location information:
yarn workspaces list --verbose

Run Commands in Workspaces

Run a script in a specific workspace:
yarn workspace <workspace-name> <script-name>
Examples:
yarn workspace proton-mail start
yarn workspace proton-drive build:web
yarn workspace @proton/components test

Workspace Naming

Workspace names follow these conventions:
  • Applications: proton-<app-name> (e.g., proton-mail, proton-drive)
  • Packages: @proton/<package-name> (e.g., @proton/shared, @proton/components)

Common Workspace Packages

Core Packages

PackageDescription
@proton/sharedShared utilities and business logic
@proton/componentsReact component library
@proton/packBuild tooling (webpack configuration)
@proton/i18nInternationalization utilities
@proton/cryptoCryptography utilities
@proton/stylesShared styles and themes
@proton/iconsIcon library

Application Packages

PackageApplication
proton-mailProton Mail
proton-calendarProton Calendar
proton-driveProton Drive
proton-passProton Pass
proton-accountAccount settings
proton-vpn-settingsVPN settings

Version Management

Requirements

{
  "packageManager": "[email protected]",
  "engines": {
    "node": ">= 22.14.0 <23.6.0"
  }
}

Manual Versioning

Version an application manually from the root folder:
yarn workspace @proton/version run version --applications proton-X --version x.x.x.x

Turbo Configuration

The monorepo uses Turbo for task orchestration and caching:
{
  "tasks": {
    "build:web": {
      "outputs": ["dist/**", "webapp-bundle.tar.gz"]
    },
    "test:ci": {
      "dependsOn": ["transit"]
    },
    "lint": {},
    "check-types": {
      "dependsOn": ["transit"]
    }
  }
}

Troubleshooting

Clear the cache and reinstall:
yarn cache clean
rm -rf node_modules
yarn install
Verify the workspace name:
yarn workspaces list | grep <workspace-name>
Check that the package exists in the correct directory.
Check for dependency version mismatches:
yarn why <package-name>
Review resolutions in root package.json for pinned versions.
The monorepo uses workspace protocol (workspace:^) for internal dependencies. Do not manually modify these to version numbers.

Best Practices

Use Workspace Protocol

Always use workspace:^ for internal package dependencies

Run from Root

Execute workspace commands from the monorepo root directory

Check Dependencies

Use yarn why to understand dependency resolution

Leverage Turbo

Take advantage of Turbo’s caching for faster builds

Build docs developers (and LLMs) love