Monorepo Build Optimization with Turborepo

Suppose your frontend build takes 12 minutes, backend and frontend are in separate repositories, shared code is duplicated, and CI tasks run sequentially. This is a typical situation we solve by setting up a [Turborepo](https://github.com/turborepo/turborepo) monorepo. We've encountered projects whe

Development and maintenance of all types of websites:

Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Our competencies:

Frequently Asked Questions

Latest works

  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1281
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1237
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    977
  • image_crm_chasseurs_493_0.webp
    CRM development for Chasseurs
    1026
  • image_website-sbh_0.webp
    Website development for SBH Partners
    1103
  • image_website-_0.webp
    Website development for Red Pear
    550

Suppose your frontend build takes 12 minutes, backend and frontend are in separate repositories, shared code is duplicated, and CI tasks run sequentially. This is a typical situation we solve by setting up a Turborepo monorepo. We've encountered projects where the build took 30 minutes, and Turborepo reduced it to 5. Proper configuration cuts build time by 3–5 times through parallelization and caching. After implementation, clients save an average of $2,000 per month on CI infrastructure costs. We guarantee your project will build faster.

Choosing the Right Tool

When to Choose Turborepo?

npm/yarn/pnpm workspaces already provide a monorepo structure, but Turborepo adds parallel execution with dependency awareness, incremental caching (local and remote), and a task graph. For small projects (2–3 packages), workspaces suffice. With 5+ packages and CI/CD, Turborepo starts saving real time. Comparison: with 10 packages, Turborepo is 4x faster than manual parallelization due to automatic build ordering.

Turborepo vs Nx

Turborepo is lighter: no need for code generators and plugins. A turbo.json and workspace protocol are enough. It's the ideal choice for teams wanting a monorepo without bloat. Nx offers more features, but Turborepo wins in simplicity of setup and speed.

Project Architecture and Configuration

Project Structure

my-project/ ├── apps/ │ ├── web/ # Next.js frontend │ ├── admin/ # Vite + React admin panel │ └── api/ # Node.js/Express backend ├── packages/ │ ├── ui/ # shared React components │ ├── config/ │ │ ├── eslint/ # ESLint config │ │ ├── typescript/ # base tsconfigs │ │ └── tailwind/ # tailwind preset │ ├── utils/ # shared utilities (formatDate, etc.) │ └── types/ # shared TypeScript types ├── package.json # workspaces declaration ├── turbo.json # Turborepo configuration └── pnpm-workspace.yaml # if using pnpm 

Configuring turbo.json

{ "$schema": "https://turbo.build/schema.json", "globalDependencies": [".env"], "pipeline": { "build": { "dependsOn": ["^build"], "inputs": ["src/**", "package.json", "tsconfig.json"], "outputs": ["dist/**", ".next/**", "!.next/cache/**"], "env": ["NODE_ENV", "API_URL"] }, "dev": { "cache": false, "persistent": true }, "lint": { "inputs": ["src/**", "*.ts", "*.tsx", ".eslintrc*"], "outputs": [] }, "typecheck": { "dependsOn": ["^build"], "inputs": ["src/**", "tsconfig.json"], "outputs": [] }, "test": { "dependsOn": ["^build"], "inputs": ["src/**", "test/**", "vitest.config.*"], "outputs": ["coverage/**"], "env": ["TEST_DATABASE_URL"] }, "test:e2e": { "dependsOn": ["build"], "inputs": ["e2e/**", "playwright.config.*"], "outputs": ["test-results/**"], "cache": false }, "db:generate": { "cache": false, "inputs": ["prisma/schema.prisma"] } } } 

Package Setup and Shared Configs

// packages/ui/package.json { "name": "@acme/ui", "version": "0.0.0", "private": true, "exports": { ".": { "import": "./dist/index.js", "types": "./dist/index.d.ts" }, "./styles": "./dist/styles.css" }, "scripts": { "build": "tsup src/index.ts --format esm --dts", "dev": "tsup src/index.ts --format esm --dts --watch" }, "devDependencies": { "@acme/eslint-config": "*", "@acme/typescript-config": "*", "tsup": "^8.0.0" }, "peerDependencies": { "react": "^18.0.0" } } 

CI/CD and Remote Caching

How to Set Up CI with Turborepo?

# .github/workflows/ci.yml name: CI on: [push, pull_request] jobs: ci: runs-on: ubuntu-latest env: TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} TURBO_TEAM: ${{ secrets.TURBO_TEAM }} steps: - uses: actions/checkout@v4 with: { fetch-depth: 2 } - uses: pnpm/action-setup@v3 with: { version: 9 } - uses: actions/setup-node@v4 with: { node-version: 20, cache: pnpm } - run: pnpm install --frozen-lockfile - run: pnpm turbo lint typecheck test --filter=...[HEAD^1] - run: pnpm turbo build 

Why Remote Cache Is Critical for CI?

Local cache works only on one machine. For teams and CI, remote cache is essential. According to Turborepo official documentation, remote caching can reduce CI build times by up to 80%. Vercel Remote Cache is free for open source, paid for private repos. A self-hosted option via turborepo-remote-cache:

# docker-compose.yml for remote cache server services: turbo-cache: image: ducktors/turborepo-remote-cache:latest ports: - "3000:3000" environment: TURBO_TOKEN: "your-secret-token" STORAGE_PROVIDER: "s3" S3_BUCKET: "turbo-cache-bucket" AWS_ACCESS_KEY_ID: "${AWS_ACCESS_KEY_ID}" AWS_SECRET_ACCESS_KEY: "${AWS_SECRET_ACCESS_KEY}" 

Table 1: Caching comparison: local vs remote

Criteria Local cache Remote cache (S3)
Speed Fast (disk) Fast (network)
Availability Only on machine Whole team + CI
Time savings 50% 80%
Setup Automatic Docker + S3 (4 hours)

Table 2: Monorepo tool comparison

Tool Parallelization Caching Setup complexity
npm workspaces No No Low
Turborepo Yes Yes Medium
Nx Yes Yes High

Common Mistakes and Solutions

  • Not specifying env in pipeline — cache returns stale values.
  • Forgetting persistent: true for dev — watcher doesn't start.
  • Circular dependencies — check the dependency graph.
  • Missing fetch-depth: 2 in CI — filter ...[HEAD^1] doesn't work.
  • Incorrect remote cache setup — ensure TURBO_TOKEN and TURBO_TEAM are set.

Turnkey Turborepo Setup Process

We handle the full cycle: audit of current architecture, design of monorepo structure, configuration of turbo.json, creation of shared packages (TypeScript, ESLint, Tailwind), deployment of remote cache on S3, CI/CD integration, documentation, and team training. Result: builds 3–5 times faster, caching on CI, unified codebase. Development time savings can reach 80%.

What's Included in Our Service

  • Detailed project audit and migration plan
  • Set up Turborepo monorepo with all configurations
  • Remote cache server deployment (Docker + S3)
  • CI/CD pipeline integration (GitHub Actions, GitLab CI, etc.)
  • Shared packages creation (TypeScript, ESLint, Tailwind presets)
  • Comprehensive documentation and team onboarding
  • 2 weeks of post-launch support and optimization

Timeline and Savings

Setting up from scratch for a project with 5–8 packages takes 2–3 days. Migrating an existing project to monorepo takes about a week. Cost is calculated individually, but our clients typically save $1,000–$3,000 per month on CI infrastructure. Over 50 monorepo projects completed, seven years in web development.

How Does Turborepo Speed Up Builds?

Task parallelization based on the dependency graph allows independent tasks to run simultaneously. Caching results (local and remote) skips rebuilding unchanged packages. The built-in --filter runs tasks only for affected packages and their dependencies. According to Turborepo official documentation, parallelization can reduce build time by up to 5x.

Conclusion

Turborepo is an efficient tool for accelerating CI and simplifying monorepo workflows. Proper configuration with remote cache and a well-designed pipeline yields noticeable time and resource savings. We offer turnkey monorepo setup in as little as 3 days. Contact us for a free project estimate — we'll help you identify potential savings and design an optimal solution.