Run a Microservices Monorepo Without Rebuilding Everything
A practical architecture and rollout playbook for keeping twenty services in one repository while preserving independent builds, deployments, and ownership.
A Microservices Monorepo Needs an Explicit Dependency Graph
A microservices monorepo can simplify refactoring, contract changes, dependency upgrades, and developer onboarding. It can also give you the worst parts of a monolith and microservices at the same time: tightly coupled code, long CI pipelines, and twenty services redeployed for a one-line frontend change.The repository, the build system, and Qovery must agree on the same dependency boundaries.Two configuration mistakes cause most of the wasted work: setting the Qovery application root path to the service subfolder, which removes shared packages from the Docker build context, and omitting MATCH deployment restrictions, which lets every commit trigger every service.This tutorial uses four services as a running example: an API gateway, orders, payments, and a web frontend. The model scales because each service keeps its own deployment path even though the source lives in one repository. By the end, you have four change tests that prove whether selective deployment works before you migrate the second service.
The Target Architecture
Start by separating deployable units from reusable code. A directory under apps/ is allowed to become a Qovery application or job. A directory under packages/ is not deployed by itself.
The import rule is deliberately boring: apps may import packages; an app must not import another app. If orders needs a capability owned by payments, it calls an API or consumes an event. It does not reach into apps/payments.Enforce this rule in CI with Nx tags, ESLint boundaries, dependency-cruiser, or an equivalent graph check. The exact tool matters less than making a forbidden edge fail before merge.
Rule 1: Keep the Docker Build Context at the Repository Root
Qovery separates the application root path from the Dockerfile path. For a service that imports shared workspace packages, point the application root to the repository root and the Dockerfile to the service:
The console and the Terraform provider express the repository root differently. Leave Root Application Path empty in the console. In Terraform, set git_repository.root_path to /. The provider defines dockerfile_path relative to that root, so apps/orders/Dockerfile can still access packages/contracts, packages/logger, the root lockfile, and the workspace manifest.
Prune Before You Install
Pruning keeps the root build context from bloating the final image. Use turbo prune —docker to reduce install and build inputs to the target application and its transitive dependencies. Nx can generate package metadata or bundle an application, but it does not provide a direct equivalent to turbo prune.
FROM node:22-alpine AS baseARG TURBO_VERSION=2.5.6RUN corepack enable && npm install -g turbo@${TURBO_VERSION}WORKDIR /repoFROM base AS prunerCOPY . .RUN turbo prune @acme/orders --dockerFROM base AS builderCOPY --from=pruner /repo/out/json/ .RUN pnpm install --frozen-lockfileCOPY --from=pruner /repo/out/full/ .RUN pnpm turbo run build --filter=@acme/ordersFROM node:22-alpine AS runnerWORKDIR /appENV NODE_ENV=productionRUN addgroup -S app && adduser -S app -G appCOPY --from=builder --chown=app:app /repo/apps/orders/dist ./distUSER appCMD ["node", "dist/main.js"]
Adapt the package name and build output to your framework. Pin TURBO_VERSION to the same version used by the repository. The important properties are stable: prune the dependency graph, separate dependency installation from source compilation, and run the final image as a non-root user.
Keep environment-specific values out of Docker ARG instructions whenever possible. Qovery documents that those values contribute to the computed image tag; a different value per environment can force a rebuild even when the commit is unchanged. Inject runtime configuration through Qovery environment variables instead.
Do not create one giant “monorepo” service that starts every process. Create one Qovery application per long-running service and one lifecycle job per migration workflow. Each Qovery service keeps its own runtime ownership.
This keeps scaling, health checks, secrets, rollbacks, and deployment history independent. A frontend change should not create a new orders runtime. A payment rollback should not touch the API gateway.
Rule 3: Make Deployment Triggers Follow the Dependency Graph
Qovery supports multiple services connected to the same Git repository. Deployment Restrictions in MATCH mode let each service react only to changes in its own code and the shared packages it actually consumes.For orders, start with these MATCH paths:
apps/orders/
packages/contracts/
packages/logger/
pnpm-lock.yaml
Qovery’s documented behavior is precise: paths must not start with a slash, wildcards are not supported, folder prefixes are supported, and one matching condition is enough to trigger the deployment.Give the migrations lifecycle job its own MATCH list instead of copying the application list:
apps/orders/migrations/
pnpm-lock.yaml
Add another shared-package path only when the migration code imports it. Do not include packages/logger/ merely because the orders application uses it. The current qovery_job provider schema exposes deployment_restrictions for lifecycle jobs.
Do not add packages/config/ just because every workspace extends the same TypeScript configuration. A lint configuration change may need CI, but it does not necessarily change the runtime artifact. Deployment restrictions should model runtime impact, not every edge in the development toolchain.
Audit Restrictions as Code Evolves
Restrictions drift when a developer adds an import from packages/logger but nobody updates Qovery. Treat this as a graph consistency problem. A small CI job can read the Turbo or Nx dependency graph, calculate each app’s runtime package dependencies, and compare them with the MATCH paths declared in Terraform.Run that check on every infrastructure change and schedule a broader audit quarterly. A missing path causes stale deployments; an unnecessary path causes wasted builds. Both are configuration defects.Reference: Qovery’s Deployment Restrictions documentation.
Encode the Deployment Contract in a Terraform Module
The current Qovery provider exposes the repository root, Dockerfile path, deployment stage, skipped state, and deployment restrictions on qovery_application. That is enough to encode the monorepo contract once and reuse it.
resource "qovery_application" "orders" { environment_id = qovery_environment.staging.id name = "orders" git_repository = { url = "https://github.com/acme/platform.git" branch = "main" root_path = "/" } build_mode = "DOCKER" dockerfile_path = "apps/orders/Dockerfile" deployment_stage_id = qovery_deployment_stage.core_services.id auto_deploy = true deployment_restrictions = [ { mode = "MATCH", type = "PATH", value = "apps/orders/" }, { mode = "MATCH", type = "PATH", value = "packages/contracts/" }, { mode = "MATCH", type = "PATH", value = "packages/logger/" }, { mode = "MATCH", type = "PATH", value = "pnpm-lock.yaml" } ]}
This is a focused excerpt, not a production-complete application resource. Add ports, health checks, resources, variables, secrets, and storage for your service.Manage staging and production through Terraform and restrict ad-hoc console changes with RBAC. Qovery does not require this operating model; it is a governance choice. At twenty services, however, mixing Terraform and manual edits makes drift a routine incident source.Reference: qovery_application provider resource.
Rule 4: Design the Deployment Pipeline Around Dependencies
Each Qovery service belongs to one deployment stage. Stages run in order; independent services in the same stage can deploy in parallel. Replace generic stages with names that explain the dependency chain:
databases
migrations
core-services: orders and payments
edge: API gateway and web
A migration lifecycle job belongs before the application that depends on the new schema. The gateway belongs after core services when it needs their endpoints to become healthy first. Services with no dependency between them belong in the same stage so Qovery can deploy them concurrently.Do not turn the pipeline into a serialized list of every service. Stages should express ordering constraints, not team ownership or alphabetical preference.Contract changes need their own order inside this pipeline. Use expand, deploy consumers, deploy producers, then contract. Old and new instances can overlap during a rollout, and services in one stage may deploy in parallel.
Measure the Pipeline You Actually Have
Use the Qovery CLI deployment explanation to see where time is spent:
Look for a stage that serializes unrelated work, repeated image builds, or migrations that dominate the critical path.Reference: Qovery’s Deployment Pipeline documentation.
Rule 5: Use Preview Environments Deliberately
A Qovery Preview Environment is created from a fully configured Blueprint Environment when a pull request targets the configured base branch. The deployment pipeline and skipped-service state are inherited.In a monorepo, previews get expensive quickly. The environment topology is cloned for the pull request, so decide which services are useful for PR validation and which should remain skipped. Qovery documents both automatic previews and a manual on-demand workflow triggered by the /qovery preview command in a pull-request comment. The manual workflow is a useful cost control for large stacks.
Run previews on a cluster separate from production.
Keep the Blueprint deployable and test it regularly.
Use smaller resource sizes where production parity is not required.
Seed test data with lifecycle jobs; never copy production secrets.
Automatically clean up the environment when the pull request closes.
General Monorepo Rules That Keep the Architecture Honest
Use One Lockfile and One Task Graph
A single lockfile makes dependency resolution reproducible across the workspace. Turbo or Nx should model build dependencies explicitly. For example, an app build depends on the builds of the packages it consumes. CI can then run only affected tasks.
The —affected flag works from Git history, so shallow CI checkouts must still contain the comparison base. Add a remote cache when repeated builds across developer machines and CI runners justify it; protect the cache credentials like any other CI secret.Reference: Turborepo —affected documentation.
Make Ownership Visible
Add CODEOWNERS entries for apps and critical shared packages. A change to packages/contracts should be reviewed by the owners of its consumers, not only by the team that owns the schema file.Keep application-to-application imports forbidden. A monorepo makes internal source paths tempting; the architecture should still communicate through versioned APIs or events.
Treat Contracts as Products
Store OpenAPI, protobuf, or GraphQL schemas in packages/contracts and generate clients consistently. Test backward compatibility in CI. A shared repository makes atomic contract changes easier, but it does not remove the need for compatibility during rolling deployments.
Keep Data Ownership at the Service Boundary
Default to one database per service, or at least one independently owned schema and credential boundary per service. A service runs its own migrations through a lifecycle job. Other services consume its API or events instead of joining its tables.Qovery does not impose this data boundary. Keeping it stops the monorepo from turning into a distributed monolith.
Build Once, Identify Immutably
Use immutable image identifiers tied to a commit SHA or digest. Avoid latest; Qovery does not accept it. When the same artifact moves between environments, inject environment-specific configuration at runtime rather than rebuilding it with different Docker arguments.
A Rollout Process That Limits Blast Radius
Start with orders: it imports shared packages, owns migrations, and sits before the gateway. Prove the path on that service, run the four selective-deployment tests below, and only then migrate the second service.
Phase 1: Repository Foundations
Move deployables under apps/ and shared code under packages/.
Adopt one lockfile and make the task graph explicit with Turbo or Nx.
Add import-boundary checks and CODEOWNERS.
Run affected builds in CI and establish a baseline duration.
pnpm turbo run build --affected --dry-run
Exit criterion: the dry run selects the changed app, its dependencies, and its dependents, with nothing unrelated.
Phase 2: One Production-Shaped Dockerfile
Choose a service that imports at least one shared runtime package.
Build it from the repository root.
Verify the runtime image contains no source tree, package manager cache, or root user requirement.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Qovery","colors":{"primary":"#642DFF","light":"#D8CBFF","dark":"#151B2B"},"logo":{"light":"https://mintcdn.com/qovery/Nvnl0g5BHzA0XQmy/images/logos/qovery-logo-black.svg?fit=max\u0026auto=format\u0026n=Nvnl0g5BHzA0XQmy\u0026q=85\u0026s=fd1a292f8293eb3cf8763f75af6ee9d4","dark":"https://mintcdn.com/qovery/Nvnl0g5BHzA0XQmy/images/logos/qovery-logo-white.svg?fit=max\u0026auto=format\u0026n=Nvnl0g5BHzA0XQmy\u0026q=85\u0026s=93dca33bf2171e9faadba09595bdf80b"},"favicon":"https://mintcdn.com/qovery/ppnp94_itg1qC8g_/favicon.svg?fit=max\u0026auto=format\u0026n=ppnp94_itg1qC8g_\u0026q=85\u0026s=e0709ea668cbf2f32d1159fa6c2b136d","navbar":{"links":[{"icon":"github","href":"https://github.com/Qovery","label":"GitHub"}],"primary":{"type":"button","label":"Console","href":"https://console.qovery.com"}},"footer":{"links":[{"items":[{"label":"Pricing","href":"https://www.qovery.com/pricing"},{"label":"Changelog","href":"https://www.qovery.com/changelog"},{"label":"Roadmap","href":"https://roadmap.qovery.com/en/roadmap"},{"label":"Case Studies","href":"https://www.qovery.com/case-studies"}]},{"items":[{"label":"Documentation","href":"https://qovery.com/docs"},{"label":"Blog","href":"https://www.qovery.com/blog"},{"label":"GitHub","href":"https://github.com/Qovery"},{"label":"Changelog","href":"https://www.qovery.com/changelog"},{"label":"Replibyte","href":"https://www.replibyte.com"}]},{"items":[{"label":"Contact","href":"https://www.qovery.com/contact"},{"label":"Security","href":"https://trust.qovery.com"},{"label":"Terms","href":"https://www.qovery.com/terms-of-service"},{"label":"Privacy Policy","href":"https://www.qovery.com/private-policy"}]}]},"integrations":{"posthog":{"apiKey":"phc_IgdG1K2GveDUte1gJ6hlwNbFHCv9nViWETUyLMU7ciq","apiHost":"https://e.qovery.com","sessionRecording":true}},"styling":{"latex":true},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"qovery","hasAudioNarration":false,"actualSubdomain":"qovery","customDomains":["www.qovery.com"],"gitSource":{"type":"github","owner":"qovery","repo":"documentation","deployBranch":"main","contentDirectory":"docs","isPrivate":false,"mountPath":"","label":""},"feedback":{"thumbs":true,"issues":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6afb21a05b1cae9d19ce7364","clientVersion":"0.0.4143","searchFilterCounts":[{"language":"default","tag":"API Reference","count":575},{"language":"default","tag":"Configuration","count":131},{"language":"default","tag":"Getting Started","count":74},{"language":"default","tag":"Services","count":47},{"language":"default","tag":"Clusters","count":38},{"language":"default","tag":"CLI","count":36},{"language":"default","tag":"Commands","count":34},{"language":"default","tag":"Blueprints","count":32},{"language":"default","tag":"Cloud Provider Credentials","count":25},{"language":"default","tag":"Tutorials","count":22}]},"assistantConfig":{},"basePath":"/docs","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"custom.css","content":".logo img,[class*=\"Logo\"] img,header img[alt*=\"logo\"i]{max-height:40px!important;height:40px!important;width:auto!important}header nav a,header a[href],[class*=\"topbar\"] a{color:inherit!important;text-decoration:none!important}#topbar-cta-button a span.bg-primary-dark{background-color:#642dff!important}html[class*=\"dark\"] #topbar-cta-button a span.bg-primary-dark,html[data-theme=\"dark\"] #topbar-cta-button a span.bg-primary-dark,.dark #topbar-cta-button a span.bg-primary-dark{background-color:#d8cbff!important}html[class*=\"dark\"] #topbar-cta-button a span.text-white,html[data-theme=\"dark\"] #topbar-cta-button a span.text-white,.dark #topbar-cta-button a span.text-white{color:#151b2b!important}html[class*=\"dark\"] #topbar-cta-button a svg,html[data-theme=\"dark\"] #topbar-cta-button a svg,.dark #topbar-cta-button a svg{color:#151b2b!important}#topbar-cta-button a div span.text-white::before{content:\"\"!important;display:inline-block!important;width:16px!important;height:16px!important;margin-right:6px!important;background-image:url('data:image/svg+xml,\u003csvg width=\"84\" height=\"96\" viewBox=\"0 0 84 96\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\u003cpath d=\"M80.3554 21.4078L45.5514 1.31333C43.3963 0.0687351 40.7428 0.0687351 38.5906 1.31333L3.78655 21.4078C1.63427 22.6496 0.306152 24.9494 0.306152 27.4358V67.6247C0.306152 70.1111 1.63149 72.4082 3.78655 73.6528L42.071 95.7575V73.6528C42.071 72.4082 42.7336 71.261 43.8112 70.6373L62.9534 59.5864V83.6986L80.3554 73.6528C82.5104 72.4082 83.8358 70.1111 83.8358 67.6247V27.4358C83.8358 24.9494 82.5104 22.6524 80.3554 21.4078ZM40.3308 48.5354L21.1886 59.5864V37.4816C21.1886 36.2371 21.8512 35.0899 22.9288 34.4662L40.3308 24.4204C41.4083 23.7995 42.7336 23.7995 43.8112 24.4204L61.2132 34.4662C62.2907 35.0871 62.9534 36.2371 62.9534 37.4816V59.5864L43.8112 48.5354C42.7336 47.9145 41.4083 47.9145 40.3308 48.5354Z\" fill=\"white\"/>\u003c/svg>')!important;background-size:contain!important;background-repeat:no-repeat!important;background-position:center!important;vertical-align:text-bottom!important;transform:translateY(-1px)!important}html[class*=\"dark\"] #topbar-cta-button a div span.text-white::before,html[data-theme=\"dark\"] #topbar-cta-button a div span.text-white::before,.dark #topbar-cta-button a div span.text-white::before{background-image:url('data:image/svg+xml,\u003csvg width=\"84\" height=\"96\" viewBox=\"0 0 84 96\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\u003cpath d=\"M80.3554 21.4078L45.5514 1.31333C43.3963 0.0687351 40.7428 0.0687351 38.5906 1.31333L3.78655 21.4078C1.63427 22.6496 0.306152 24.9494 0.306152 27.4358V67.6247C0.306152 70.1111 1.63149 72.4082 3.78655 73.6528L42.071 95.7575V73.6528C42.071 72.4082 42.7336 71.261 43.8112 70.6373L62.9534 59.5864V83.6986L80.3554 73.6528C82.5104 72.4082 83.8358 70.1111 83.8358 67.6247V27.4358C83.8358 24.9494 82.5104 22.6524 80.3554 21.4078ZM40.3308 48.5354L21.1886 59.5864V37.4816C21.1886 36.2371 21.8512 35.0899 22.9288 34.4662L40.3308 24.4204C41.4083 23.7995 42.7336 23.7995 43.8112 24.4204L61.2132 34.4662C62.2907 35.0871 62.9534 36.2371 62.9534 37.4816V59.5864L43.8112 48.5354C42.7336 47.9145 41.4083 47.9145 40.3308 48.5354Z\" fill=\"%23151B2B\"/>\u003c/svg>')!important}[data-page-mode=\"custom\"] main,[data-page-mode=\"custom\"] article,html[data-page-mode=\"custom\"] main>div,html[data-page-mode=\"custom\"] article>div{max-width:1280px!important;margin-left:auto!important;margin-right:auto!important;padding-left:2rem!important;padding-right:2rem!important;box-sizing:border-box!important}.card-icon img,.card img[src*=\"/logos/\"]{max-width:24px!important;max-height:24px!important;width:24px!important;height:24px!important;background:transparent!important}[class*=\"CardIcon\"] img,[class*=\"card-icon\"] img{max-width:24px!important;max-height:24px!important;object-fit:contain!important;background:transparent!important}img[src*=\"/scaleway-icon\"],[class*=\"Card\"] img[src*=\"/scaleway-icon\"]{max-width:24px!important;max-height:24px!important;width:auto!important;height:24px!important;object-fit:contain!important}html[class*=\"dark\"] .card-icon,html[data-theme=\"dark\"] .card-icon,html[class*=\"dark\"] [class*=\"CardIcon\"],html[data-theme=\"dark\"] [class*=\"CardIcon\"]{background:transparent!important;background-color:transparent!important}[class*=\"Card\"] img[src*=\"logo\"],.card img[src*=\"logo\"],img[src*=\"/logos/\"]{background:transparent!important;mix-blend-mode:normal!important}.card{display:flex!important;flex-direction:column!important;align-items:flex-start!important}.card-icon{margin-bottom:12px!important}html[class*=\"dark\"] .light-mode-only,html[data-theme=\"dark\"] .light-mode-only{display:none!important}html[class*=\"light\"] .dark-mode-only,html[data-theme=\"light\"] .dark-mode-only,html:not([class*=\"dark\"]):not([data-theme=\"dark\"]) .dark-mode-only{display:none!important}.badge-icon{display:inline-block;height:20px;max-height:20px;width:auto;margin-left:8px;vertical-align:middle;object-fit:contain}img[src*=\"/scaleway-icon\"].badge-icon,img[alt=\"Scaleway\"].badge-icon{height:20px!important;max-height:20px!important;width:auto!important;object-fit:contain!important}.raci-legend{display:flex;gap:1.5rem;margin-bottom:1.5rem;flex-wrap:wrap;padding:1rem;background-color:rgba(100, 45, 255, 0.05);border-radius:8px;border-left:4px solid #642dff}.raci-legend div{font-size:0.9rem}.role-r-text{color:#dc2626;font-weight:600}.role-a-text{color:#2563eb;font-weight:600}.role-c-text{color:#16a34a;font-weight:600}.role-i-text{color:#9333ea;font-weight:600}.raci-table-container{overflow-x:auto;margin:2rem 0;width:100%}table.raci-matrix{width:100%;min-width:100%;table-layout:fixed;border-collapse:separate;border-spacing:0;border:1px solid #e5e7eb;border-radius:8px;overflow:hidden}table.raci-matrix .col-component{width:50%}table.raci-matrix .col-provider,table.raci-matrix .col-qovery,table.raci-matrix .col-customer{width:16.66%}table.raci-matrix th{background-color:#642dff;color:white;font-weight:600;padding:12px;text-align:center;border-bottom:2px solid #5527cc}table.raci-matrix th:first-child{text-align:left}table.raci-matrix tbody tr:hover{background-color:rgba(100, 45, 255, 0.05)}table.raci-matrix tr.layer-header td{background-color:#f3f4f6;font-weight:700;font-size:0.95rem;padding:10px 12px;color:#1f2937;border-top:2px solid #d1d5db;border-bottom:1px solid #d1d5db}table.raci-matrix td{padding:12px;border-bottom:1px solid #e5e7eb;text-align:center}table.raci-matrix td:first-child{text-align:left;font-weight:500}table.raci-matrix .role-ra{background-color:#fee2e2;color:#991b1b;font-weight:700}table.raci-matrix .role-r{background-color:#fef2f2;color:#dc2626;font-weight:600}table.raci-matrix .role-a{background-color:#dbeafe;color:#1e40af;font-weight:600}table.raci-matrix .role-c{background-color:#dcfce7;color:#15803d;font-weight:600}table.raci-matrix .role-i{background-color:#f3e8ff;color:#7c3aed;font-weight:600}table.raci-matrix .role-ci{background-color:#d1fae5;color:#065f46;font-weight:600}.vpc-tooltip-container{position:relative}.info-icon{display:inline-block;width:16px;height:16px;background-color:#642dff;color:white;border-radius:50%;text-align:center;font-size:12px;font-weight:bold;margin-left:6px;cursor:help}.vpc-tooltip{display:none;position:absolute;bottom:100%;left:0;background-color:#1f2937;color:white;padding:12px;border-radius:6px;width:300px;font-size:0.85rem;line-height:1.5;z-index:1000;box-shadow:0 4px 6px -1px rgba(0, 0, 0, 0.1)}.vpc-tooltip-container:hover .vpc-tooltip{display:block}.vpc-tooltip p{margin:0 0 8px 0}.vpc-tooltip p:last-child{margin-bottom:0}html[data-theme=\"dark\"] table.raci-matrix{border-color:#374151}html[data-theme=\"dark\"] table.raci-matrix th{background-color:#642dff;border-bottom-color:#5527cc}html[data-theme=\"dark\"] table.raci-matrix td{border-bottom-color:#374151}html[data-theme=\"dark\"] table.raci-matrix tr.layer-header td{background-color:#1f2937;color:#f9fafb;border-top-color:#4b5563;border-bottom-color:#4b5563}html[data-theme=\"dark\"] .raci-legend{background-color:rgba(100, 45, 255, 0.1)}.badge-icon-scaleway-light{display:inline-block;height:20px;max-height:20px;width:20px;max-width:20px;margin-left:8px;vertical-align:middle;object-fit:contain}.badge-icon-scaleway-dark{display:none;height:20px;max-height:20px;width:20px;max-width:20px;margin-left:8px;vertical-align:middle;object-fit:contain}html[class*=\"dark\"] .badge-icon-scaleway-light,html[data-theme=\"dark\"] .badge-icon-scaleway-light{display:none}html[class*=\"dark\"] .badge-icon-scaleway-dark,html[data-theme=\"dark\"] .badge-icon-scaleway-dark{display:inline-block}.badge-aws,.badge-gcp,.badge-azure,.badge-scw,.badge-app,.badge-container,.badge-cronjob,.badge-job,.badge-helm,.badge-new{display:inline-block;padding:3px 8px;border-radius:4px;font-size:11px;font-weight:600;color:white;margin-right:8px;margin-bottom:4px;white-space:nowrap;line-height:1.4;vertical-align:middle}.badge-aws{background-color:#ff9900}.badge-gcp{background-color:#ea4335}.badge-azure{background-color:#0089d6}.badge-scw{background-color:#4f0599}.badge-app{background-color:#10b981}.badge-container{background-color:#3b82f6}.badge-cronjob{background-color:#f59e0b}.badge-job{background-color:#8b5cf6}.badge-helm{background-color:#0f1689}.badge-new{background-color:#642DFF}.badge-terraform{background-color:#4040b2}.helm-icon{display:inline-block;height:20px;width:auto;margin-right:8px;margin-bottom:4px;vertical-align:middle}.terraform-icon{display:inline-block;height:20px;width:auto;margin-right:8px;margin-bottom:4px;vertical-align:middle}img[src*=\"/terraform-icon.svg\"],img[src*=\"/helm-icon.svg\"],img[src*=\"/aws-icon.svg\"],img[src*=\"/github-icon.svg\"]{}html[class*=\"dark\"] img[src*=\"/terraform-icon.svg\"],html[data-theme=\"dark\"] img[src*=\"/terraform-icon.svg\"],.dark img[src*=\"/terraform-icon.svg\"]{filter:brightness(0) saturate(100%) invert(92%) sepia(8%) saturate(1299%)\n hue-rotate(202deg) brightness(103%) contrast(100%)}html[class*=\"dark\"] img[src*=\"/helm-icon.svg\"],html[data-theme=\"dark\"] img[src*=\"/helm-icon.svg\"],.dark img[src*=\"/helm-icon.svg\"],html[class*=\"dark\"] img[src*=\"/helm-icon-light.svg\"],html[data-theme=\"dark\"] img[src*=\"/helm-icon-light.svg\"],.dark img[src*=\"/helm-icon-light.svg\"]{filter:brightness(0) invert(1)}html[class*=\"dark\"] img[src*=\"/aws-icon.svg\"],html[data-theme=\"dark\"] img[src*=\"/aws-icon.svg\"],.dark img[src*=\"/aws-icon.svg\"]{filter:brightness(0) invert(1)}html[class*=\"dark\"] img[src*=\"/github-icon.svg\"],html[data-theme=\"dark\"] img[src*=\"/github-icon.svg\"],.dark img[src*=\"/github-icon.svg\"]{filter:brightness(0) invert(1)}html[class*=\"dark\"] img[src*=\"/scaleway-icon-light.svg\"],html[data-theme=\"dark\"] img[src*=\"/scaleway-icon-light.svg\"],.dark img[src*=\"/scaleway-icon-light.svg\"]{filter:brightness(0) saturate(100%) invert(92%) sepia(8%) saturate(1299%)\n hue-rotate(202deg) brightness(103%) contrast(100%)}html[class*=\"dark\"] img[src*=\"/logos/provision-logo-only.svg\"],html[data-theme=\"dark\"] img[src*=\"/logos/provision-logo-only.svg\"],.dark img[src*=\"/logos/provision-logo-only.svg\"]{filter:brightness(0) saturate(100%) invert(92%) sepia(8%) saturate(1299%)\n hue-rotate(202deg) brightness(103%) contrast(100%)}html[class*=\"dark\"] img[src*=\"/logos/deploy-logo-only.svg\"],html[data-theme=\"dark\"] img[src*=\"/logos/deploy-logo-only.svg\"],.dark img[src*=\"/logos/deploy-logo-only.svg\"]{filter:brightness(0) saturate(100%) invert(92%) sepia(8%) saturate(1299%)\n hue-rotate(202deg) brightness(103%) contrast(100%)}html[class*=\"dark\"] img[src*=\"/logos/observe-logo-only.svg\"],html[data-theme=\"dark\"] img[src*=\"/logos/observe-logo-only.svg\"],.dark img[src*=\"/logos/observe-logo-only.svg\"]{filter:brightness(0) saturate(100%) invert(92%) sepia(8%) saturate(1299%)\n hue-rotate(202deg) brightness(103%) contrast(100%)}html[class*=\"dark\"] img[src*=\"/logos/optimize-logo-only.svg\"],html[data-theme=\"dark\"] img[src*=\"/logos/optimize-logo-only.svg\"],.dark img[src*=\"/logos/optimize-logo-only.svg\"]{filter:brightness(0) saturate(100%) invert(92%) sepia(8%) saturate(1299%)\n hue-rotate(202deg) brightness(103%) contrast(100%)}html[class*=\"dark\"] img[src*=\"/logos/secure-logo-only.svg\"],html[data-theme=\"dark\"] img[src*=\"/logos/secure-logo-only.svg\"],.dark img[src*=\"/logos/secure-logo-only.svg\"]{filter:brightness(0) saturate(100%) invert(92%) sepia(8%) saturate(1299%)\n hue-rotate(202deg) brightness(103%) contrast(100%)}html[class*=\"dark\"] img[src*=\"/ai-tools/cursor.svg\"],html[data-theme=\"dark\"] img[src*=\"/ai-tools/cursor.svg\"],html[class*=\"dark\"] img[src*=\"/ai-tools/githubcopilot.svg\"],html[data-theme=\"dark\"] img[src*=\"/ai-tools/githubcopilot.svg\"],html[class*=\"dark\"] img[src*=\"/ai-tools/amp.svg\"],html[data-theme=\"dark\"] img[src*=\"/ai-tools/amp.svg\"],html[class*=\"dark\"] img[src*=\"/ai-tools/openai.svg\"],html[data-theme=\"dark\"] img[src*=\"/ai-tools/openai.svg\"],html[class*=\"dark\"] img[src*=\"/ai-tools/goose.png\"],html[data-theme=\"dark\"] img[src*=\"/ai-tools/goose.png\"]{filter:brightness(0) invert(1)}.terminal-window{background:#0d1117;border-radius:10px;overflow:hidden;margin:16px 0 24px;box-shadow:0 4px 24px rgba(0, 0, 0, 0.25)}.terminal-bar{background:#161b22;padding:10px 16px;display:flex;align-items:center;border-bottom:1px solid #21262d}.terminal-dots{display:flex;gap:6px;margin-right:12px}.terminal-dot{width:12px;height:12px;border-radius:50%;flex-shrink:0}.terminal-dot-red{background:#ff5f57}.terminal-dot-yellow{background:#febc2e}.terminal-dot-green{background:#28c840}.terminal-title-bar{flex:1;text-align:center;color:#6e7681;font-size:12px;font-family:'Roboto Mono', monospace}.terminal-copy{background:transparent;border:none;color:#6e7681;cursor:pointer;padding:4px 6px;border-radius:4px;display:flex;align-items:center;transition:color 0.15s, background 0.15s;flex-shrink:0}.terminal-copy:hover{color:#e6edf3;background:rgba(255, 255, 255, 0.08)}.terminal-copy-success{color:#3fb950!important}.terminal-body{padding:20px 24px;font-family:'Roboto Mono', monospace;font-size:13px;line-height:1.8;color:#e6edf3}.terminal-prompt{display:block;margin:4px 0}.terminal-prompt::before{content:'$ ';color:#642DFF;font-weight:700}.terminal-output{display:block;color:#8b949e;padding-left:14px;margin:2px 0}.terminal-success{display:block;color:#3fb950;padding-left:14px;margin:2px 0}.terminal-sep{border:none;border-top:1px solid #21262d;margin:14px 0}@keyframes blink-cursor{0%,50%{opacity:1}51%,100%{opacity:0}}.terminal-cursor{display:inline-block;width:7px;height:13px;background:#e6edf3;animation:blink-cursor 1s step-end infinite;vertical-align:text-bottom;margin-left:2px}.skill-radio{position:absolute;opacity:0;pointer-events:none;width:0;height:0}.skills-grid{display:grid;grid-template-columns:repeat(4, 1fr);gap:8px;margin-bottom:16px}@media (max-width: 640px){.skills-grid{grid-template-columns:repeat(2, 1fr)}}.skill-card{padding:12px 14px;border:1px solid #e5e7eb;border-radius:8px;cursor:pointer;transition:border-color 0.15s, background 0.15s;display:flex;flex-direction:column;gap:3px;user-select:none}html.dark .skill-card,html[data-theme=\"dark\"] .skill-card{border-color:rgba(255, 255, 255, 0.1)}.skill-card:hover{border-color:rgba(100, 45, 255, 0.5);background:rgba(100, 45, 255, 0.05)}.skill-card-name{font-size:12px;font-weight:600;color:#111827;font-family:'Roboto Mono', monospace;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}html.dark .skill-card-name,html[data-theme=\"dark\"] .skill-card-name{color:#e6edf3}.skill-card-desc{font-size:11px;color:#6b7280;line-height:1.35}html.dark .skill-card-desc,html[data-theme=\"dark\"] .skill-card-desc{color:#8b949e}#sk-qovery:checked~.skills-grid label[for=\"sk-qovery\"],#sk-signup:checked~.skills-grid label[for=\"sk-signup\"],#sk-onboard:checked~.skills-grid label[for=\"sk-onboard\"],#sk-deploy:checked~.skills-grid label[for=\"sk-deploy\"],#sk-troubleshoot:checked~.skills-grid label[for=\"sk-troubleshoot\"],#sk-optimize:checked~.skills-grid label[for=\"sk-optimize\"],#sk-speedup:checked~.skills-grid label[for=\"sk-speedup\"],#sk-preview:checked~.skills-grid label[for=\"sk-preview\"],#sk-terraform:checked~.skills-grid label[for=\"sk-terraform\"],#sk-policy-token:checked~.skills-grid label[for=\"sk-policy-token\"],#sk-assess:checked~.skills-grid label[for=\"sk-assess\"]{border-color:#642DFF;background:rgba(100, 45, 255, 0.1)}.skills-desc-wrap{padding:12px 14px;min-height:44px;font-size:13.5px;color:#374151;line-height:1.6;border-left:3px solid #642DFF;background:rgba(100, 45, 255, 0.04);border-radius:0 6px 6px 0;margin-bottom:12px}html.dark .skills-desc-wrap,html[data-theme=\"dark\"] .skills-desc-wrap{color:#c9d1d9;background:rgba(100, 45, 255, 0.08)}.sk-desc{display:none}#sk-qovery:checked~.skills-desc-wrap .sk-desc-qovery{display:block}#sk-signup:checked~.skills-desc-wrap .sk-desc-signup{display:block}#sk-onboard:checked~.skills-desc-wrap .sk-desc-onboard{display:block}#sk-deploy:checked~.skills-desc-wrap .sk-desc-deploy{display:block}#sk-troubleshoot:checked~.skills-desc-wrap .sk-desc-troubleshoot{display:block}#sk-optimize:checked~.skills-desc-wrap .sk-desc-optimize{display:block}#sk-speedup:checked~.skills-desc-wrap .sk-desc-speedup{display:block}#sk-preview:checked~.skills-desc-wrap .sk-desc-preview{display:block}#sk-terraform:checked~.skills-desc-wrap .sk-desc-terraform{display:block}#sk-policy-token:checked~.skills-desc-wrap .sk-desc-policy-token{display:block}#sk-assess:checked~.skills-desc-wrap .sk-desc-assess{display:block}.sk-prompt{display:none}#sk-qovery:checked~.skills-terminal .sk-prompt-qovery{display:block}#sk-signup:checked~.skills-terminal .sk-prompt-signup{display:block}#sk-onboard:checked~.skills-terminal .sk-prompt-onboard{display:block}#sk-deploy:checked~.skills-terminal .sk-prompt-deploy{display:block}#sk-troubleshoot:checked~.skills-terminal .sk-prompt-troubleshoot{display:block}#sk-optimize:checked~.skills-terminal .sk-prompt-optimize{display:block}#sk-speedup:checked~.skills-terminal .sk-prompt-speedup{display:block}#sk-preview:checked~.skills-terminal .sk-prompt-preview{display:block}#sk-terraform:checked~.skills-terminal .sk-prompt-terraform{display:block}#sk-policy-token:checked~.skills-terminal .sk-prompt-policy-token{display:block}#sk-assess:checked~.skills-terminal .sk-prompt-assess{display:block}.terminal-actions{display:flex;align-items:center;gap:6px;margin-left:auto}.terminal-open-cursor{display:flex;align-items:center;gap:5px;background:#2a2a2e;border:1px solid rgba(255, 255, 255, 0.1);color:#ffffff;font-size:11px;font-weight:500;padding:3px 8px;border-radius:5px;cursor:pointer;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;transition:background 0.15s;white-space:nowrap;text-decoration:none;line-height:1}.terminal-open-cursor:hover{background:#3a3a3e}.compare-table{width:100%;border-collapse:collapse;font-size:14px;margin:16px 0}.compare-table thead th{padding:8px 16px 12px;text-align:left;font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:0.06em;color:#6b7280;border-bottom:1px solid #e5e7eb}html.dark .compare-table thead th,html[data-theme=\"dark\"] .compare-table thead th{color:#6e7681;border-bottom-color:#21262d}.compare-table thead th.col-featured{color:#642DFF!important}.compare-table tbody td{padding:12px 16px;border-bottom:1px solid #f3f4f6;font-size:13.5px;vertical-align:middle;color:#374151}html.dark .compare-table tbody td,html[data-theme=\"dark\"] .compare-table tbody td{border-bottom-color:rgba(255,255,255,0.06);color:#c9d1d9}.compare-table tbody td:first-child{font-weight:600;color:#111827}html.dark .compare-table tbody td:first-child,html[data-theme=\"dark\"] .compare-table tbody td:first-child{color:#e6edf3}.compare-table tbody td.col-featured{background:rgba(100, 45, 255, 0.05)}html.dark .compare-table tbody td.col-featured,html[data-theme=\"dark\"] .compare-table tbody td.col-featured{background:rgba(100, 45, 255, 0.09)}.cmp-yes{color:#16a34a;font-weight:500}.cmp-no{color:#9ca3af}.cmp-auto{color:#7c3aed;font-weight:500}html.dark .cmp-yes{color:#3fb950}html.dark .cmp-no,html[data-theme=\"dark\"] .cmp-no{color:#6e7681}html.dark .cmp-auto,html[data-theme=\"dark\"] .cmp-auto{color:#a78bfa}.ai-section{background:linear-gradient(135deg, rgba(100, 45, 255, 0.09) 0%, rgba(100, 45, 255, 0.03) 100%);border:1px solid rgba(100, 45, 255, 0.22);border-radius:16px;padding:28px 28px 20px;margin:8px 0 24px}.ai-section h3{margin-top:0!important}html[class*=\"dark\"] .ai-section,html[data-theme=\"dark\"] .ai-section{background:linear-gradient(135deg, rgba(100, 45, 255, 0.18) 0%, rgba(100, 45, 255, 0.06) 100%);border-color:rgba(100, 45, 255, 0.38)}article>h1:first-of-type,main>h1:first-of-type,[class*=\"Content\"]>h1:first-of-type{display:none!important}footer,[class*=\"footer\"],[class*=\"Footer\"]{margin-left:0!important;padding-left:0!important}@media (min-width: 768px){footer,[class*=\"footer\"],[class*=\"Footer\"]{position:relative!important;z-index:1!important}footer>div,[class*=\"footer\"]>div,[class*=\"Footer\"]>div{margin-left:260px!important;padding-left:2rem!important}}.cta-banner{background:linear-gradient(135deg, #642DFF 0%, #8B5CF6 100%);border-radius:16px;padding:28px 32px;margin:40px 0 8px;display:flex;align-items:center;justify-content:space-between;gap:20px}.cta-banner-text h3{color:#ffffff;font-size:18px;font-weight:700;margin:0 0 6px!important;line-height:1.3}.cta-banner-text p{color:rgba(255, 255, 255, 0.82);font-size:14px;margin:0!important;line-height:1.5}.cta-banner-button{display:inline-flex;align-items:center;gap:6px;background:#ffffff;color:#642DFF!important;font-weight:700;font-size:14px;padding:11px 22px;border-radius:8px;text-decoration:none!important;white-space:nowrap;flex-shrink:0;transition:opacity 0.15s, transform 0.15s}.cta-banner-button:hover{opacity:0.92;transform:translateY(-1px)}@media (max-width: 640px){.cta-banner{flex-direction:column;text-align:center;padding:24px 20px}.cta-banner-button{width:100%;justify-content:center}}a[href*=\"mintlify.com\"][href*=\"poweredBy\"]{display:none!important}"}],"page":{"pagePath":"getting-started/guides/advanced-tutorials/microservices-monorepo","slug":"/getting-started/guides/advanced-tutorials/microservices-monorepo","pageMetadata":{"title":"Run a Microservices Monorepo Without Rebuilding Everything","description":"A practical architecture and rollout playbook for keeping twenty services in one repository while preserving independent builds, deployments, and ownership.","href":"/getting-started/guides/advanced-tutorials/microservices-monorepo"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"A practical architecture and rollout playbook for keeping twenty services in one repository while preserving independent builds, deployments, and ownership.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,OptimizedImage,Tip}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!OptimizedImage)_missingMdxReference(`OptimizedImage`,true);if(!Tip)_missingMdxReference(`Tip`,true);return _jsxs(_Fragment,{children:[_jsx(Heading,{level:`2`,id:`a-microservices-monorepo-needs-an-explicit-dependency-graph`,children:`A Microservices Monorepo Needs an Explicit Dependency Graph`}),`\n`,_jsx(_components.p,{children:`A microservices monorepo can simplify refactoring, contract changes, dependency upgrades, and developer onboarding. It can also give you the worst parts of a monolith and microservices at the same time: tightly coupled code, long CI pipelines, and twenty services redeployed for a one-line frontend change.`}),`\n`,_jsx(_components.p,{children:`The repository, the build system, and Qovery must agree on the same dependency boundaries.`}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Two configuration mistakes cause most of the wasted work: setting the Qovery application root path to the service subfolder, which removes shared packages from the Docker build context, and omitting MATCH deployment restrictions, which lets every commit trigger every service.`})}),`\n`,_jsx(_components.p,{children:`This tutorial uses four services as a running example: an API gateway, orders, payments, and a web frontend. The model scales because each service keeps its own deployment path even though the source lives in one repository. By the end, you have four change tests that prove whether selective deployment works before you migrate the second service.`}),`\n`,_jsx(Heading,{level:`2`,id:`the-target-architecture`,children:`The Target Architecture`}),`\n`,_jsx(_components.p,{children:`Start by separating deployable units from reusable code. A directory under apps/ is allowed to become a Qovery application or job. A directory under packages/ is not deployed by itself.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`29`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`29`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`├── apps/`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`│ ├── api-gateway/`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`│ │ ├── Dockerfile`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`│ │ └── src/`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`│ ├── orders/`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`│ │ ├── Dockerfile`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`│ │ ├── migrations/`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`│ │ └── src/`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`│ ├── payments/`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`│ │ ├── Dockerfile`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`│ │ ├── migrations/`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`│ │ └── src/`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`│ └── web/`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`│ ├── Dockerfile`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`│ └── src/`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`├── packages/`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`│ ├── contracts/`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`│ ├── config/`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`│ └── logger/`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`├── infra/qovery/`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`│ ├── modules/service/`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`│ └── environments/`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`├── .github/`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`├── .dockerignore`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`├── turbo.json`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`├── package.json`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`└── pnpm-lock.yaml`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`The import rule is deliberately boring: apps may import packages; an app must not import another app. If orders needs a capability owned by payments, it calls an API or consumes an event. It does not reach into apps/payments.`}),`\n`,_jsx(_components.p,{children:`Enforce this rule in CI with Nx tags, ESLint boundaries, dependency-cruiser, or an equivalent graph check. The exact tool matters less than making a forbidden edge fail before merge.`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/qovery/WeQuh9cFL9FKqSJx/images/microservices-monorepo/microservices-monorepo-target-architecture.webp?fit=max\u0026auto=format\u0026n=WeQuh9cFL9FKqSJx\u0026q=85\u0026s=661e345af10e7cac30b554977bcbafe1`,alt:`The qovery-monorepo-microservices repository tree, with apps/*/Dockerfile annotated \"One Dockerfile per app\" and packages/ annotated \"Shared code\"`,\"data-og-width\":`1347`,width:`1347`,\"data-og-height\":`910`,height:`910`,\"data-path\":`images/microservices-monorepo/microservices-monorepo-target-architecture.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/qovery/WeQuh9cFL9FKqSJx/images/microservices-monorepo/microservices-monorepo-target-architecture.webp?w=280\u0026fit=max\u0026auto=format\u0026n=WeQuh9cFL9FKqSJx\u0026q=85\u0026s=e8cd5ac6da9d8a290c3d1f1f094471f3 280w, https://mintcdn.com/qovery/WeQuh9cFL9FKqSJx/images/microservices-monorepo/microservices-monorepo-target-architecture.webp?w=560\u0026fit=max\u0026auto=format\u0026n=WeQuh9cFL9FKqSJx\u0026q=85\u0026s=cd072e32dab04614c70c37fb1029c3b2 560w, https://mintcdn.com/qovery/WeQuh9cFL9FKqSJx/images/microservices-monorepo/microservices-monorepo-target-architecture.webp?w=840\u0026fit=max\u0026auto=format\u0026n=WeQuh9cFL9FKqSJx\u0026q=85\u0026s=e457440ebf1691b586947f42e8710917 840w, https://mintcdn.com/qovery/WeQuh9cFL9FKqSJx/images/microservices-monorepo/microservices-monorepo-target-architecture.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=WeQuh9cFL9FKqSJx\u0026q=85\u0026s=513b16e59031d5139cc7af88b5148a7d 1100w, https://mintcdn.com/qovery/WeQuh9cFL9FKqSJx/images/microservices-monorepo/microservices-monorepo-target-architecture.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=WeQuh9cFL9FKqSJx\u0026q=85\u0026s=ae42a4764889f36ba5fef0b2a136bdf3 1650w, https://mintcdn.com/qovery/WeQuh9cFL9FKqSJx/images/microservices-monorepo/microservices-monorepo-target-architecture.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=WeQuh9cFL9FKqSJx\u0026q=85\u0026s=20df49dca196226e13abc790d1a678bb 2500w`}),`\n`,_jsx(Heading,{level:`2`,id:`rule-1-keep-the-docker-build-context-at-the-repository-root`,children:`Rule 1: Keep the Docker Build Context at the Repository Root`}),`\n`,_jsx(_components.p,{children:`Qovery separates the application root path from the Dockerfile path. For a service that imports shared workspace packages, point the application root to the repository root and the Dockerfile to the service:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Console Root Application Path: leave empty (repository root)`}),`\n`,_jsx(_components.li,{children:`Dockerfile path: apps/orders/Dockerfile`}),`\n`,_jsx(_components.li,{children:`Terraform root_path: /`}),`\n`]}),`\n`,_jsx(_components.p,{children:`The console and the Terraform provider express the repository root differently. Leave Root Application Path empty in the console. In Terraform, set git_repository.root_path to /. The provider defines dockerfile_path relative to that root, so apps/orders/Dockerfile can still access packages/contracts, packages/logger, the root lockfile, and the workspace manifest.`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/qovery/WeQuh9cFL9FKqSJx/images/microservices-monorepo/microservices-monorepo-console-root-path.webp?fit=max\u0026auto=format\u0026n=WeQuh9cFL9FKqSJx\u0026q=85\u0026s=ef757be4b8e60fe16cc6407bab7305e9`,alt:`Qovery console General settings for the orders application, showing Application root folder path set to \"/\" and Dockerfile path set to \"apps/orders/Dockerfile\"`,\"data-og-width\":`1279`,width:`1279`,\"data-og-height\":`1019`,height:`1019`,\"data-path\":`images/microservices-monorepo/microservices-monorepo-console-root-path.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/qovery/WeQuh9cFL9FKqSJx/images/microservices-monorepo/microservices-monorepo-console-root-path.webp?w=280\u0026fit=max\u0026auto=format\u0026n=WeQuh9cFL9FKqSJx\u0026q=85\u0026s=fac3be374189ae6ed0bea81ca504b655 280w, https://mintcdn.com/qovery/WeQuh9cFL9FKqSJx/images/microservices-monorepo/microservices-monorepo-console-root-path.webp?w=560\u0026fit=max\u0026auto=format\u0026n=WeQuh9cFL9FKqSJx\u0026q=85\u0026s=1f186cd311eb89752425ee4f8ec687a7 560w, https://mintcdn.com/qovery/WeQuh9cFL9FKqSJx/images/microservices-monorepo/microservices-monorepo-console-root-path.webp?w=840\u0026fit=max\u0026auto=format\u0026n=WeQuh9cFL9FKqSJx\u0026q=85\u0026s=71184a7989370d7aa4f4608403b681e6 840w, https://mintcdn.com/qovery/WeQuh9cFL9FKqSJx/images/microservices-monorepo/microservices-monorepo-console-root-path.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=WeQuh9cFL9FKqSJx\u0026q=85\u0026s=03bb43aa0790c092cb808522e724110f 1100w, https://mintcdn.com/qovery/WeQuh9cFL9FKqSJx/images/microservices-monorepo/microservices-monorepo-console-root-path.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=WeQuh9cFL9FKqSJx\u0026q=85\u0026s=e1da73a07ee1c68c1e40817559db7a18 1650w, https://mintcdn.com/qovery/WeQuh9cFL9FKqSJx/images/microservices-monorepo/microservices-monorepo-console-root-path.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=WeQuh9cFL9FKqSJx\u0026q=85\u0026s=df0d25886235d4114d4584ca45c77087 2500w`}),`\n`,_jsx(Heading,{level:`3`,id:`prune-before-you-install`,children:`Prune Before You Install`}),`\n`,_jsx(_components.p,{children:`Pruning keeps the root build context from bloating the final image. Use turbo prune —docker to reduce install and build inputs to the target application and its transitive dependencies. Nx can generate package metadata or bundle an application, but it does not provide a direct equivalent to turbo prune.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`22`,language:`docker`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`docker`,children:_jsxs(_components.code,{language:`docker`,numberOfLines:`22`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` node:22-alpine `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`AS`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` base`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`ARG`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` TURBO_VERSION=2.5.6`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`RUN`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:\" corepack enable \u0026\u0026 npm install -g turbo@${TURBO_VERSION}\"})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`WORKDIR`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` /repo`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` base `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`AS`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` pruner`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`COPY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` . .`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`RUN`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` turbo prune @acme/orders --docker`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` base `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`AS`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` builder`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`COPY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` --from=pruner /repo/out/json/ .`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`RUN`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` pnpm install --frozen-lockfile`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`COPY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` --from=pruner /repo/out/full/ .`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`RUN`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` pnpm turbo run build --filter=@acme/orders`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` node:22-alpine `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`AS`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` runner`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`WORKDIR`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` /app`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`ENV`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` NODE_ENV=production`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`RUN`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` addgroup -S app \u0026\u0026 adduser -S app -G app`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`COPY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` --from=builder --chown=app:app /repo/apps/orders/dist ./dist`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`USER`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` app`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`CMD`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"node\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"dist/main.js\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`]})})}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[`Adapt the package name and build output to your framework. Pin `,_jsx(_components.code,{children:`TURBO_VERSION`}),` to the same version used by the repository. The important properties are stable: prune the dependency graph, separate dependency installation from source compilation, and run the final image as a non-root user.`]})}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[`Keep environment-specific values out of Docker `,_jsx(_components.code,{children:`ARG`}),` instructions whenever possible. Qovery documents that those values contribute to the computed image tag; a different value per environment can force a rebuild even when the commit is unchanged. Inject runtime configuration through Qovery environment variables instead.`]})}),`\n`,_jsxs(_components.p,{children:[`Reference: `,_jsx(_components.a,{href:`/configuration/deployment/image-mirroring`,children:`Qovery Image Mirroring`}),`, `,_jsx(_components.a,{href:`/configuration/deployment/pipeline#avoid-environment-specific-build-variables`,children:`Qovery deployment pipeline guidance`}),` and `,_jsx(_components.a,{href:`https://turborepo.com/docs/guides/tools/docker`,children:`Turborepo’s Docker guide`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`rule-2-create-one-qovery-service-per-deployable`,children:`Rule 2: Create One Qovery Service per Deployable`}),`\n`,_jsx(_components.p,{children:`Do not create one giant “monorepo” service that starts every process. Create one Qovery application per long-running service and one lifecycle job per migration workflow. Each Qovery service keeps its own runtime ownership.`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`apps/api-gateway → Qovery application`}),`\n`,_jsx(_components.li,{children:`apps/orders → Qovery application + migrations lifecycle job`}),`\n`,_jsx(_components.li,{children:`apps/payments → Qovery application + migrations lifecycle job`}),`\n`,_jsx(_components.li,{children:`apps/web → Qovery application`}),`\n`]}),`\n`,_jsx(_components.p,{children:`This keeps scaling, health checks, secrets, rollbacks, and deployment history independent. A frontend change should not create a new orders runtime. A payment rollback should not touch the API gateway.`}),`\n`,_jsx(Heading,{level:`2`,id:`rule-3-make-deployment-triggers-follow-the-dependency-graph`,children:`Rule 3: Make Deployment Triggers Follow the Dependency Graph`}),`\n`,_jsx(_components.p,{children:`Qovery supports multiple services connected to the same Git repository. Deployment Restrictions in MATCH mode let each service react only to changes in its own code and the shared packages it actually consumes.`}),`\n`,_jsx(_components.p,{children:`For orders, start with these MATCH paths:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`apps/orders/`}),`\n`,_jsx(_components.li,{children:`packages/contracts/`}),`\n`,_jsx(_components.li,{children:`packages/logger/`}),`\n`,_jsx(_components.li,{children:`pnpm-lock.yaml`}),`\n`]}),`\n`,_jsx(_components.p,{children:`Qovery’s documented behavior is precise: paths must not start with a slash, wildcards are not supported, folder prefixes are supported, and one matching condition is enough to trigger the deployment.`}),`\n`,_jsx(_components.p,{children:`Give the migrations lifecycle job its own MATCH list instead of copying the application list:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`apps/orders/migrations/`}),`\n`,_jsx(_components.li,{children:`pnpm-lock.yaml`}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`Add another shared-package path only when the migration code imports it. Do not include packages/logger/ merely because the orders application uses it. The current `,_jsx(_components.a,{href:`https://github.com/Qovery/terraform-provider-qovery/blob/main/docs/resources/job.md#nestedatt--deployment_restrictions`,children:`qovery_job provider schema`}),` exposes deployment_restrictions for lifecycle jobs.`]}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[`Do not add `,_jsx(_components.code,{children:`packages/config/`}),` just because every workspace extends the same TypeScript configuration. A lint configuration change may need CI, but it does not necessarily change the runtime artifact. Deployment restrictions should model runtime impact, not every edge in the development toolchain.`]})}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/qovery/WeQuh9cFL9FKqSJx/images/microservices-monorepo/microservices-monorepo-deployment-restrictions.webp?fit=max\u0026auto=format\u0026n=WeQuh9cFL9FKqSJx\u0026q=85\u0026s=9ef59bcb14bfbe25e4795465b938fcf4`,alt:`Qovery console Deployment Restrictions screen for the orders application, listing four MATCH restrictions: apps/orders/, packages/contracts/, pnpm-lock.yaml, and packages/logger/`,\"data-og-width\":`878`,width:`878`,\"data-og-height\":`520`,height:`520`,\"data-path\":`images/microservices-monorepo/microservices-monorepo-deployment-restrictions.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/qovery/WeQuh9cFL9FKqSJx/images/microservices-monorepo/microservices-monorepo-deployment-restrictions.webp?w=280\u0026fit=max\u0026auto=format\u0026n=WeQuh9cFL9FKqSJx\u0026q=85\u0026s=847d7b19c72573a7885ac284dcdf91e8 280w, https://mintcdn.com/qovery/WeQuh9cFL9FKqSJx/images/microservices-monorepo/microservices-monorepo-deployment-restrictions.webp?w=560\u0026fit=max\u0026auto=format\u0026n=WeQuh9cFL9FKqSJx\u0026q=85\u0026s=fe44d002191a342767eab7061ce14f0f 560w, https://mintcdn.com/qovery/WeQuh9cFL9FKqSJx/images/microservices-monorepo/microservices-monorepo-deployment-restrictions.webp?w=840\u0026fit=max\u0026auto=format\u0026n=WeQuh9cFL9FKqSJx\u0026q=85\u0026s=c61ab4234decba19314962088071a026 840w, https://mintcdn.com/qovery/WeQuh9cFL9FKqSJx/images/microservices-monorepo/microservices-monorepo-deployment-restrictions.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=WeQuh9cFL9FKqSJx\u0026q=85\u0026s=9cb81a88d571abd2108b61774069fe5c 1100w, https://mintcdn.com/qovery/WeQuh9cFL9FKqSJx/images/microservices-monorepo/microservices-monorepo-deployment-restrictions.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=WeQuh9cFL9FKqSJx\u0026q=85\u0026s=722b0a134e3dc1fdb39a8164e888f358 1650w, https://mintcdn.com/qovery/WeQuh9cFL9FKqSJx/images/microservices-monorepo/microservices-monorepo-deployment-restrictions.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=WeQuh9cFL9FKqSJx\u0026q=85\u0026s=d295570bc4495aa2e5fa7b419b81b3b0 2500w`}),`\n`,_jsx(Heading,{level:`3`,id:`audit-restrictions-as-code-evolves`,children:`Audit Restrictions as Code Evolves`}),`\n`,_jsx(_components.p,{children:`Restrictions drift when a developer adds an import from packages/logger but nobody updates Qovery. Treat this as a graph consistency problem. A small CI job can read the Turbo or Nx dependency graph, calculate each app’s runtime package dependencies, and compare them with the MATCH paths declared in Terraform.`}),`\n`,_jsx(_components.p,{children:`Run that check on every infrastructure change and schedule a broader audit quarterly. A missing path causes stale deployments; an unnecessary path causes wasted builds. Both are configuration defects.`}),`\n`,_jsxs(_components.p,{children:[`Reference: `,_jsx(_components.a,{href:`/configuration/deployment/auto-deploy`,children:`Qovery’s Deployment Restrictions documentation`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`encode-the-deployment-contract-in-a-terraform-module`,children:`Encode the Deployment Contract in a Terraform Module`}),`\n`,_jsx(_components.p,{children:`The current Qovery provider exposes the repository root, Dockerfile path, deployment stage, skipped state, and deployment restrictions on qovery_application. That is enough to encode the monorepo contract once and reuse it.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`22`,language:`hcl`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`hcl`,children:_jsxs(_components.code,{language:`hcl`,numberOfLines:`22`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`resource`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` \"qovery_application\"`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` \"orders\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` environment_id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` qovery_environment`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`staging`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`id`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` name`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"orders\"`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` git_repository`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` url`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"https://github.com/acme/platform.git\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` branch`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"main\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` root_path`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"/\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` build_mode`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"DOCKER\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` dockerfile_path`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"apps/orders/Dockerfile\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` deployment_stage_id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` qovery_deployment_stage`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`core_services`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`id`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` auto_deploy`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` true`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` deployment_restrictions`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`mode`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"MATCH\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`type`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"PATH\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`value`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"apps/orders/\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`mode`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"MATCH\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`type`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"PATH\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`value`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"packages/contracts/\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`mode`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"MATCH\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`type`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"PATH\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`value`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"packages/logger/\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`mode`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"MATCH\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`type`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"PATH\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`value`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"pnpm-lock.yaml\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`This is a focused excerpt, not a production-complete application resource. Add ports, health checks, resources, variables, secrets, and storage for your service.`}),`\n`,_jsx(_components.p,{children:`Manage staging and production through Terraform and restrict ad-hoc console changes with RBAC. Qovery does not require this operating model; it is a governance choice. At twenty services, however, mixing Terraform and manual edits makes drift a routine incident source.`}),`\n`,_jsxs(_components.p,{children:[`Reference: `,_jsx(_components.a,{href:`https://registry.terraform.io/providers/qovery/qovery/latest/docs/resources/application`,children:`qovery_application provider resource`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`rule-4-design-the-deployment-pipeline-around-dependencies`,children:`Rule 4: Design the Deployment Pipeline Around Dependencies`}),`\n`,_jsx(_components.p,{children:`Each Qovery service belongs to one deployment stage. Stages run in order; independent services in the same stage can deploy in parallel. Replace generic stages with names that explain the dependency chain:`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsx(_components.li,{children:`databases`}),`\n`,_jsx(_components.li,{children:`migrations`}),`\n`,_jsx(_components.li,{children:`core-services: orders and payments`}),`\n`,_jsx(_components.li,{children:`edge: API gateway and web`}),`\n`]}),`\n`,_jsx(_components.p,{children:`A migration lifecycle job belongs before the application that depends on the new schema. The gateway belongs after core services when it needs their endpoints to become healthy first. Services with no dependency between them belong in the same stage so Qovery can deploy them concurrently.`}),`\n`,_jsx(_components.p,{children:`Do not turn the pipeline into a serialized list of every service. Stages should express ordering constraints, not team ownership or alphabetical preference.`}),`\n`,_jsx(_components.p,{children:`Contract changes need their own order inside this pipeline. Use expand, deploy consumers, deploy producers, then contract. Old and new instances can overlap during a rollout, and services in one stage may deploy in parallel.`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/qovery/WeQuh9cFL9FKqSJx/images/microservices-monorepo/microservices-monorepo-pipeline-stages.webp?fit=max\u0026auto=format\u0026n=WeQuh9cFL9FKqSJx\u0026q=85\u0026s=79dff1e8ea1ed8d21108ef4534a8f2b3`,alt:`Qovery console deployment pipeline showing the migrations stage (orders-migrations, payments-migrations), core-services stage (payments, orders), and edge stage (web, api-gateway)`,\"data-og-width\":`955`,width:`955`,\"data-og-height\":`322`,height:`322`,\"data-path\":`images/microservices-monorepo/microservices-monorepo-pipeline-stages.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/qovery/WeQuh9cFL9FKqSJx/images/microservices-monorepo/microservices-monorepo-pipeline-stages.webp?w=280\u0026fit=max\u0026auto=format\u0026n=WeQuh9cFL9FKqSJx\u0026q=85\u0026s=33c3ee4af1be5d87bec16bff3bf5a104 280w, https://mintcdn.com/qovery/WeQuh9cFL9FKqSJx/images/microservices-monorepo/microservices-monorepo-pipeline-stages.webp?w=560\u0026fit=max\u0026auto=format\u0026n=WeQuh9cFL9FKqSJx\u0026q=85\u0026s=178b317ece354ae8ed9400378698180e 560w, https://mintcdn.com/qovery/WeQuh9cFL9FKqSJx/images/microservices-monorepo/microservices-monorepo-pipeline-stages.webp?w=840\u0026fit=max\u0026auto=format\u0026n=WeQuh9cFL9FKqSJx\u0026q=85\u0026s=87e4ab2b15083cb4e04d8328e8619d0f 840w, https://mintcdn.com/qovery/WeQuh9cFL9FKqSJx/images/microservices-monorepo/microservices-monorepo-pipeline-stages.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=WeQuh9cFL9FKqSJx\u0026q=85\u0026s=3f5b959326eb05e47bf99f1434d5f46b 1100w, https://mintcdn.com/qovery/WeQuh9cFL9FKqSJx/images/microservices-monorepo/microservices-monorepo-pipeline-stages.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=WeQuh9cFL9FKqSJx\u0026q=85\u0026s=9dcd6bafb815df5d091e4d63e254bb24 1650w, https://mintcdn.com/qovery/WeQuh9cFL9FKqSJx/images/microservices-monorepo/microservices-monorepo-pipeline-stages.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=WeQuh9cFL9FKqSJx\u0026q=85\u0026s=725738b3825898659dbd4a0427cd5957 2500w`}),`\n`,_jsx(Heading,{level:`3`,id:`measure-the-pipeline-you-actually-have`,children:`Measure the Pipeline You Actually Have`}),`\n`,_jsx(_components.p,{children:`Use the Qovery CLI deployment explanation to see where time is spent:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`qovery`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` environment`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` deployment`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` explain`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --level`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` step`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Look for a stage that serializes unrelated work, repeated image builds, or migrations that dominate the critical path.`}),`\n`,_jsxs(_components.p,{children:[`Reference: `,_jsx(_components.a,{href:`/configuration/deployment/pipeline`,children:`Qovery’s Deployment Pipeline documentation`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`rule-5-use-preview-environments-deliberately`,children:`Rule 5: Use Preview Environments Deliberately`}),`\n`,_jsx(_components.p,{children:`A Qovery Preview Environment is created from a fully configured Blueprint Environment when a pull request targets the configured base branch. The deployment pipeline and skipped-service state are inherited.`}),`\n`,_jsxs(_components.p,{children:[`In a monorepo, previews get expensive quickly. The environment topology is cloned for the pull request, so decide which services are useful for PR validation and which should remain skipped. Qovery documents both automatic previews and a `,_jsx(_components.a,{href:`/configuration/environment#manual-on-demand`,children:`manual on-demand workflow`}),` triggered by the /qovery preview command in a pull-request comment. The manual workflow is a useful cost control for large stacks.`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Run previews on a cluster separate from production.`}),`\n`,_jsx(_components.li,{children:`Keep the Blueprint deployable and test it regularly.`}),`\n`,_jsx(_components.li,{children:`Use smaller resource sizes where production parity is not required.`}),`\n`,_jsx(_components.li,{children:`Seed test data with lifecycle jobs; never copy production secrets.`}),`\n`,_jsx(_components.li,{children:`Automatically clean up the environment when the pull request closes.`}),`\n`]}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/qovery/WeQuh9cFL9FKqSJx/images/microservices-monorepo/microservices-monorepo-preview-environment.webp?fit=max\u0026auto=format\u0026n=WeQuh9cFL9FKqSJx\u0026q=85\u0026s=1991eb596967018a8a7744c06ed2c8b1`,alt:`A GitHub pull request with a Qovery bot comment announcing an automatically created preview environment and a link to follow its deployment`,\"data-og-width\":`1650`,width:`1650`,\"data-og-height\":`858`,height:`858`,\"data-path\":`images/microservices-monorepo/microservices-monorepo-preview-environment.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/qovery/WeQuh9cFL9FKqSJx/images/microservices-monorepo/microservices-monorepo-preview-environment.webp?w=280\u0026fit=max\u0026auto=format\u0026n=WeQuh9cFL9FKqSJx\u0026q=85\u0026s=874f8e47490b66cd3f15156f5a79e50f 280w, https://mintcdn.com/qovery/WeQuh9cFL9FKqSJx/images/microservices-monorepo/microservices-monorepo-preview-environment.webp?w=560\u0026fit=max\u0026auto=format\u0026n=WeQuh9cFL9FKqSJx\u0026q=85\u0026s=bfbca23b82cb4fdfceb4969e78e658e5 560w, https://mintcdn.com/qovery/WeQuh9cFL9FKqSJx/images/microservices-monorepo/microservices-monorepo-preview-environment.webp?w=840\u0026fit=max\u0026auto=format\u0026n=WeQuh9cFL9FKqSJx\u0026q=85\u0026s=4a7744cfc7660094de6403e36e2a91d8 840w, https://mintcdn.com/qovery/WeQuh9cFL9FKqSJx/images/microservices-monorepo/microservices-monorepo-preview-environment.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=WeQuh9cFL9FKqSJx\u0026q=85\u0026s=2162e2052b30d0a392d141a4bd4cad14 1100w, https://mintcdn.com/qovery/WeQuh9cFL9FKqSJx/images/microservices-monorepo/microservices-monorepo-preview-environment.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=WeQuh9cFL9FKqSJx\u0026q=85\u0026s=fd4c4aac4d8ee7e12377b73792d7a9a9 1650w, https://mintcdn.com/qovery/WeQuh9cFL9FKqSJx/images/microservices-monorepo/microservices-monorepo-preview-environment.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=WeQuh9cFL9FKqSJx\u0026q=85\u0026s=0967bae334c1bcf3f9bdac076b99cdeb 2500w`}),`\n`,_jsxs(_components.p,{children:[`Reference: `,_jsx(_components.a,{href:`/configuration/environment#preview-environments`,children:`Qovery Preview Environments documentation`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`general-monorepo-rules-that-keep-the-architecture-honest`,children:`General Monorepo Rules That Keep the Architecture Honest`}),`\n`,_jsx(Heading,{level:`3`,id:`use-one-lockfile-and-one-task-graph`,children:`Use One Lockfile and One Task Graph`}),`\n`,_jsx(_components.p,{children:`A single lockfile makes dependency resolution reproducible across the workspace. Turbo or Nx should model build dependencies explicitly. For example, an app build depends on the builds of the packages it consumes. CI can then run only affected tasks.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`8`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`8`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"tasks\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"build\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"dependsOn\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"^build\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`],`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"outputs\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"dist/**\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`pnpm`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` turbo`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` run`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` lint`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` test`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` build`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --affected`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`The —affected flag works from Git history, so shallow CI checkouts must still contain the comparison base. Add a remote cache when repeated builds across developer machines and CI runners justify it; protect the cache credentials like any other CI secret.`}),`\n`,_jsxs(_components.p,{children:[`Reference: `,_jsx(_components.a,{href:`https://turborepo.com/docs/reference/run#--affected`,children:`Turborepo —affected documentation`}),`.`]}),`\n`,_jsx(Heading,{level:`3`,id:`make-ownership-visible`,children:`Make Ownership Visible`}),`\n`,_jsx(_components.p,{children:`Add CODEOWNERS entries for apps and critical shared packages. A change to packages/contracts should be reviewed by the owners of its consumers, not only by the team that owns the schema file.`}),`\n`,_jsx(_components.p,{children:`Keep application-to-application imports forbidden. A monorepo makes internal source paths tempting; the architecture should still communicate through versioned APIs or events.`}),`\n`,_jsx(Heading,{level:`3`,id:`treat-contracts-as-products`,children:`Treat Contracts as Products`}),`\n`,_jsx(_components.p,{children:`Store OpenAPI, protobuf, or GraphQL schemas in packages/contracts and generate clients consistently. Test backward compatibility in CI. A shared repository makes atomic contract changes easier, but it does not remove the need for compatibility during rolling deployments.`}),`\n`,_jsx(Heading,{level:`3`,id:`keep-data-ownership-at-the-service-boundary`,children:`Keep Data Ownership at the Service Boundary`}),`\n`,_jsx(_components.p,{children:`Default to one database per service, or at least one independently owned schema and credential boundary per service. A service runs its own migrations through a lifecycle job. Other services consume its API or events instead of joining its tables.`}),`\n`,_jsx(_components.p,{children:`Qovery does not impose this data boundary. Keeping it stops the monorepo from turning into a distributed monolith.`}),`\n`,_jsx(Heading,{level:`3`,id:`build-once-identify-immutably`,children:`Build Once, Identify Immutably`}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[`Use immutable image identifiers tied to a commit SHA or digest. Avoid `,_jsx(_components.code,{children:`latest`}),`; Qovery does not accept it. When the same artifact moves between environments, inject environment-specific configuration at runtime rather than rebuilding it with different Docker arguments.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`a-rollout-process-that-limits-blast-radius`,children:`A Rollout Process That Limits Blast Radius`}),`\n`,_jsx(_components.p,{children:`Start with orders: it imports shared packages, owns migrations, and sits before the gateway. Prove the path on that service, run the four selective-deployment tests below, and only then migrate the second service.`}),`\n`,_jsx(Heading,{level:`3`,id:`phase-1-repository-foundations`,children:`Phase 1: Repository Foundations`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsx(_components.li,{children:`Move deployables under apps/ and shared code under packages/.`}),`\n`,_jsx(_components.li,{children:`Adopt one lockfile and make the task graph explicit with Turbo or Nx.`}),`\n`,_jsx(_components.li,{children:`Add import-boundary checks and CODEOWNERS.`}),`\n`,_jsx(_components.li,{children:`Run affected builds in CI and establish a baseline duration.`}),`\n`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`pnpm`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` turbo`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` run`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` build`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --affected`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --dry-run`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Exit criterion: the dry run selects the changed app, its dependencies, and its dependents, with nothing unrelated.`}),`\n`,_jsx(Heading,{level:`3`,id:`phase-2-one-production-shaped-dockerfile`,children:`Phase 2: One Production-Shaped Dockerfile`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsx(_components.li,{children:`Choose a service that imports at least one shared runtime package.`}),`\n`,_jsx(_components.li,{children:`Build it from the repository root.`}),`\n`,_jsx(_components.li,{children:`Verify the runtime image contains no source tree, package manager cache, or root user requirement.`}),`\n`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`docker`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` build`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` apps/orders/Dockerfile`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -t`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` orders:test`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` .`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Exit criterion: shared packages resolve correctly and the container passes its health check locally.`}),`\n`,_jsx(Heading,{level:`3`,id:`phase-3-staging-as-code`,children:`Phase 3: Staging as Code`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsx(_components.li,{children:`Create the Qovery application with root_path = /.`}),`\n`,_jsx(_components.li,{children:`Add the per-service Dockerfile path and MATCH restrictions.`}),`\n`,_jsx(_components.li,{children:`Assign the service and its migration job to explicit stages.`}),`\n`,_jsx(_components.li,{children:`Import existing resources before applying if this is a migration.`}),`\n`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`terraform`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -chdir=infra/qovery/environments/staging`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` plan`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Exit criterion: the plan contains no unintended replacement or deletion.`}),`\n`,_jsx(Heading,{level:`3`,id:`phase-4-prove-selective-deployment`,children:`Phase 4: Prove Selective Deployment`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsx(_components.li,{children:`Change only apps/orders and confirm only orders is triggered.`}),`\n`,_jsx(_components.li,{children:`Change packages/logger and confirm only its consumers are triggered.`}),`\n`,_jsx(_components.li,{children:`Change packages/config and confirm CI runs while runtime services remain untouched, if that is your intended policy.`}),`\n`,_jsx(_components.li,{children:`Change pnpm-lock.yaml and confirm every application is eligible to rebuild.`}),`\n`]}),`\n`,_jsx(_components.p,{children:`Exit criterion: observed deployments match the declared dependency graph in all four cases.`}),`\n`,_jsx(Heading,{level:`3`,id:`phase-5-preview-then-production`,children:`Phase 5: Preview, Then Production`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsx(_components.li,{children:`Clone a known-good environment as the Preview Blueprint.`}),`\n`,_jsx(_components.li,{children:`Move heavy or irrelevant services to Skipped and test on-demand preview creation.`}),`\n`,_jsx(_components.li,{children:`Recreate the same Terraform module for production with a dedicated cluster and stricter RBAC.`}),`\n`,_jsx(_components.li,{children:`Roll out service by service; keep the previous deployment path available until the new one is proven.`}),`\n`]}),`\n`,_jsx(_components.p,{children:`Exit criterion: a pull request creates and deletes a usable preview, and a production plan is reviewed with no console-only drift.`}),`\n`,_jsx(Heading,{level:`2`,id:`sources-and-further-reading`,children:`Sources and Further Reading`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/configuration/application`,children:`Qovery application configuration`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/configuration/deployment/auto-deploy`,children:`Qovery Deployment Restrictions`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/configuration/deployment/pipeline`,children:`Qovery Deployment Pipeline`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/configuration/deployment/image-mirroring`,children:`Qovery Image Mirroring`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/configuration/environment#preview-environments`,children:`Qovery Preview Environments`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`https://registry.terraform.io/providers/qovery/qovery/latest/docs/resources/application`,children:`Qovery Terraform provider: qovery_application`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`https://github.com/Qovery/terraform-provider-qovery/blob/main/docs/resources/job.md#nestedatt--deployment_restrictions`,children:`Qovery Terraform provider: qovery_job`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`https://turborepo.com/docs/guides/tools/docker`,children:`Turborepo Docker guide`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`https://turborepo.com/docs/reference/run#--affected`,children:`Turborepo run —affected`})}),`\n`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Run a Microservices Monorepo Without Rebuilding Everything","description":"A practical architecture and rollout playbook for keeping twenty services in one repository while preserving independent builds, deployments, and ownership.","href":"/getting-started/guides/advanced-tutorials/microservices-monorepo"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"A Microservices Monorepo Needs an Explicit Dependency Graph","slug":"a-microservices-monorepo-needs-an-explicit-dependency-graph","depth":2,"children":[]},{"title":"The Target Architecture","slug":"the-target-architecture","depth":2,"children":[]},{"title":"Rule 1: Keep the Docker Build Context at the Repository Root","slug":"rule-1-keep-the-docker-build-context-at-the-repository-root","depth":2,"children":[{"title":"Prune Before You Install","slug":"prune-before-you-install","depth":3,"children":[]}]},{"title":"Rule 2: Create One Qovery Service per Deployable","slug":"rule-2-create-one-qovery-service-per-deployable","depth":2,"children":[]},{"title":"Rule 3: Make Deployment Triggers Follow the Dependency Graph","slug":"rule-3-make-deployment-triggers-follow-the-dependency-graph","depth":2,"children":[{"title":"Audit Restrictions as Code Evolves","slug":"audit-restrictions-as-code-evolves","depth":3,"children":[]}]},{"title":"Encode the Deployment Contract in a Terraform Module","slug":"encode-the-deployment-contract-in-a-terraform-module","depth":2,"children":[]},{"title":"Rule 4: Design the Deployment Pipeline Around Dependencies","slug":"rule-4-design-the-deployment-pipeline-around-dependencies","depth":2,"children":[{"title":"Measure the Pipeline You Actually Have","slug":"measure-the-pipeline-you-actually-have","depth":3,"children":[]}]},{"title":"Rule 5: Use Preview Environments Deliberately","slug":"rule-5-use-preview-environments-deliberately","depth":2,"children":[]},{"title":"General Monorepo Rules That Keep the Architecture Honest","slug":"general-monorepo-rules-that-keep-the-architecture-honest","depth":2,"children":[{"title":"Use One Lockfile and One Task Graph","slug":"use-one-lockfile-and-one-task-graph","depth":3,"children":[]},{"title":"Make Ownership Visible","slug":"make-ownership-visible","depth":3,"children":[]},{"title":"Treat Contracts as Products","slug":"treat-contracts-as-products","depth":3,"children":[]},{"title":"Keep Data Ownership at the Service Boundary","slug":"keep-data-ownership-at-the-service-boundary","depth":3,"children":[]},{"title":"Build Once, Identify Immutably","slug":"build-once-identify-immutably","depth":3,"children":[]}]},{"title":"A Rollout Process That Limits Blast Radius","slug":"a-rollout-process-that-limits-blast-radius","depth":2,"children":[{"title":"Phase 1: Repository Foundations","slug":"phase-1-repository-foundations","depth":3,"children":[]},{"title":"Phase 2: One Production-Shaped Dockerfile","slug":"phase-2-one-production-shaped-dockerfile","depth":3,"children":[]},{"title":"Phase 3: Staging as Code","slug":"phase-3-staging-as-code","depth":3,"children":[]},{"title":"Phase 4: Prove Selective Deployment","slug":"phase-4-prove-selective-deployment","depth":3,"children":[]},{"title":"Phase 5: Preview, Then Production","slug":"phase-5-preview-then-production","depth":3,"children":[]}]},{"title":"Sources and Further Reading","slug":"sources-and-further-reading","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/docs/_mintlify/custom/qovery/0bf2b14fb00c53b9/custom.js","/docs/_mintlify/custom/qovery/a066ee21572976bb/reo.js"],"subdomain":"qovery","siteName":"Qovery","title":"Run a Microservices Monorepo Without Rebuilding Everything - Qovery","relatedPagesConfig":{"enabled":true,"limit":5,"mode":"automatic"},"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-11-16T12:56:16.910Z","originalFileLocation":"getting-started/guides/advanced-tutorials/microservices-monorepo.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"A practical architecture and rollout playbook for keeping twenty services in one repository while preserving independent builds, deployments, and ownership.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Qovery\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/qovery/ujffYmd-5c8eNJut/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/docs/mintlify-assets/_mintlify/favicons/qovery/ujffYmd-5c8eNJut/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/qovery/ujffYmd-5c8eNJut/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/qovery/ujffYmd-5c8eNJut/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/qovery/ujffYmd-5c8eNJut/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/qovery/ujffYmd-5c8eNJut/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/qovery/ujffYmd-5c8eNJut/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/qovery/ujffYmd-5c8eNJut/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/qovery/ujffYmd-5c8eNJut/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Run a Microservices Monorepo Without Rebuilding Everything - Qovery\">\u003cmeta data-mint-head property=\"og:description\" content=\"A practical architecture and rollout playbook for keeping twenty services in one repository while preserving independent builds, deployments, and ownership.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Qovery\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://www.qovery.com/docs/getting-started/guides/advanced-tutorials/microservices-monorepo\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://qovery.mintlify.site/docs/_mintlify/api/og/v2?division=Development+%26+Deployment\u0026amp;title=Run+a+Microservices+Monorepo+Without+Rebuilding+Everything\u0026amp;description=A+practical+architecture+and+rollout+playbook+for+keeping+twenty+services+in+one+repository+while+preserving+independent+builds%2C+deployments%2C+and+ownership.\u0026amp;theme=cf3c64c2b8b4eaf93258ebc7\u0026amp;signature=de76ffda809cf80b1709b95ef6a9bfb0cdfd5e6d1873d2f9f8546c07197bab69\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Run a Microservices Monorepo Without Rebuilding Everything - Qovery\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"A practical architecture and rollout playbook for keeping twenty services in one repository while preserving independent builds, deployments, and ownership.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://qovery.mintlify.site/docs/_mintlify/api/og/v2?division=Development+%26+Deployment\u0026amp;title=Run+a+Microservices+Monorepo+Without+Rebuilding+Everything\u0026amp;description=A+practical+architecture+and+rollout+playbook+for+keeping+twenty+services+in+one+repository+while+preserving+independent+builds%2C+deployments%2C+and+ownership.\u0026amp;theme=cf3c64c2b8b4eaf93258ebc7\u0026amp;signature=de76ffda809cf80b1709b95ef6a9bfb0cdfd5e6d1873d2f9f8546c07197bab69\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/docs/mintlify-assets/_mintlify/favicons/qovery/ujffYmd-5c8eNJut/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Qovery\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#642DFF\">\u003clink data-mint-head rel=\"canonical\" href=\"https://www.qovery.com/docs/getting-started/guides/advanced-tutorials/microservices-monorepo\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/docs/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/docs/getting-started/guides/advanced-tutorials/microservices-monorepo.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://www.qovery.com/#organization\",\"name\":\"Qovery\",\"url\":\"https://www.qovery.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/qovery/Nvnl0g5BHzA0XQmy/images/logos/qovery-logo-black.svg?fit=max\u0026auto=format\u0026n=Nvnl0g5BHzA0XQmy\u0026q=85\u0026s=fd1a292f8293eb3cf8763f75af6ee9d4\"}},{\"@type\":\"WebSite\",\"@id\":\"https://www.qovery.com/docs#website\",\"name\":\"Qovery\",\"url\":\"https://www.qovery.com/docs\",\"publisher\":{\"@id\":\"https://www.qovery.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://www.qovery.com/docs/getting-started/guides/advanced-tutorials/microservices-monorepo#webpage\",\"url\":\"https://www.qovery.com/docs/getting-started/guides/advanced-tutorials/microservices-monorepo\",\"name\":\"Run a Microservices Monorepo Without Rebuilding Everything\",\"description\":\"A practical architecture and rollout playbook for keeping twenty services in one repository while preserving independent builds, deployments, and ownership.\",\"dateModified\":\"2026-11-16T12:56:16.910Z\",\"isPartOf\":{\"@id\":\"https://www.qovery.com/docs#website\"},\"breadcrumb\":{\"@id\":\"https://www.qovery.com/docs/getting-started/guides/advanced-tutorials/microservices-monorepo#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://www.qovery.com/docs/getting-started/guides/advanced-tutorials/microservices-monorepo#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Tutorials\",\"item\":\"https://www.qovery.com/docs/getting-started/guides/getting-started/deploy-your-first-application\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Advanced Tutorials\",\"item\":\"https://www.qovery.com/docs/getting-started/guides/advanced-tutorials/aws-iam-roles\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Development \u0026 Deployment\",\"item\":\"https://www.qovery.com/docs/getting-started/guides/advanced-tutorials/write-dockerfile\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Run a Microservices Monorepo Without Rebuilding Everything\",\"item\":\"https://www.qovery.com/docs/getting-started/guides/advanced-tutorials/microservices-monorepo\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://www.qovery.com/docs/getting-started/guides/advanced-tutorials/microservices-monorepo#article\",\"headline\":\"Run a Microservices Monorepo Without Rebuilding Everything\",\"name\":\"Run a Microservices Monorepo Without Rebuilding Everything\",\"description\":\"A practical architecture and rollout playbook for keeping twenty services in one repository while preserving independent builds, deployments, and ownership.\",\"url\":\"https://www.qovery.com/docs/getting-started/guides/advanced-tutorials/microservices-monorepo\",\"mainEntityOfPage\":{\"@id\":\"https://www.qovery.com/docs/getting-started/guides/advanced-tutorials/microservices-monorepo#webpage\"},\"dateModified\":\"2026-11-16T12:56:16.910Z\",\"publisher\":{\"@id\":\"https://www.qovery.com/#organization\"},\"isPartOf\":{\"@id\":\"https://www.qovery.com/docs#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Qovery\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Qovery\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/docs/getting-started/guides/advanced-tutorials/microservices-monorepo.md","siteName":"Qovery","nav":{"global":null,"tabs":[{"tab":"Getting Started","icon":"rocket","groups":[{"group":"Get Started","pages":[{"title":"Introduction","mode":"wide","href":"/getting-started/introduction"},{"title":"Get Started with Qovery","mode":"wide","href":"/getting-started/quickstart"},{"title":"Deploy with AI Agent","mode":"wide","href":"/getting-started/quickstart/ai-agent"},{"title":"Try Qovery on Your Laptop with a Coding Agent","sidebarTitle":"Try It on Your Laptop","mode":"wide","href":"/getting-started/quickstart/try-with-an-agent"},{"title":"Deploy from a Repository with the CLI and API","sidebarTitle":"Deploy with the CLI and API","href":"/getting-started/quickstart/cli-and-api"},{"title":"How Qovery Works","href":"/getting-started/how-it-works"},{"title":"Core Concepts","href":"/getting-started/basic-concepts"},{"group":"Installation","pages":[{"title":"Test \u0026 Learn Locally","href":"/getting-started/quickstart/docker"},{"group":"Managed Cluster","pages":[{"title":"Create Your Cluster","href":"/getting-started/quickstart/cloud"},{"title":"Install Qovery on AWS","href":"/getting-started/installation/aws"},{"title":"Install Qovery on GCP","href":"/getting-started/installation/gcp"},{"title":"Install Qovery on Azure","href":"/getting-started/installation/azure"},{"title":"Install Qovery on Scaleway","href":"/getting-started/installation/scaleway"}]},{"title":"BYOK (Bring Your Own Kubernetes)","tag":"PREVIEW","href":"/getting-started/installation/kubernetes"}]}]},{"group":"Platform Capabilities","pages":[{"group":"Core Products","pages":[{"title":"Provision","href":"/getting-started/guides/qovery-101/provision"},{"title":"Deploy","href":"/getting-started/guides/qovery-101/deploy"},{"title":"Observe","href":"/getting-started/guides/qovery-101/observe"},{"title":"Optimize","href":"/getting-started/guides/qovery-101/optimize"},{"title":"Secure","href":"/getting-started/guides/qovery-101/secure"},{"title":"Agent Tasks","tag":"NEW","href":"/getting-started/agent-tasks"}]},{"group":"Security \u0026 Compliance","pages":[{"title":"Security Overview","href":"/getting-started/security-and-compliance/overview"},{"group":"IAM Permissions Reference","pages":[{"title":"AWS IAM Permissions Reference","href":"/getting-started/security-and-compliance/aws-iam-permissions"},{"title":"GCP IAM Permissions Reference","href":"/getting-started/security-and-compliance/gcp-iam-permissions"},{"title":"Azure IAM Permissions Reference","href":"/getting-started/security-and-compliance/azure-iam-permissions"},{"title":"Scaleway IAM Permissions Reference","href":"/getting-started/security-and-compliance/scaleway-iam-permissions"}]},{"title":"Audit Logs","href":"/getting-started/security-and-compliance/audit-logs"},{"title":"SOC2","href":"/getting-started/security-and-compliance/soc2"},{"title":"GDPR","href":"/getting-started/security-and-compliance/gdpr"},{"title":"DORA Compliance","href":"/getting-started/security-and-compliance/dora"},{"title":"HIPAA Compliance","href":"/getting-started/security-and-compliance/hipaa"}]},{"title":"Maintenance","href":"/getting-started/configuration/maintenance"}]},{"group":"How-to Guides","pages":[{"title":"Production Environment Management","href":"/getting-started/guides/use-cases/production-environment-management"},{"title":"Migrate to Kubernetes","href":"/getting-started/guides/use-cases/cloud-migration-and-scaling"},{"title":"Let a Coding Agent Deploy Without Cloud Admin Credentials","href":"/getting-started/guides/use-cases/coding-agent-deploy-access"},{"group":"Ephemeral Environments","pages":[{"title":"Ephemeral Environments","href":"/getting-started/guides/use-cases/ephemeral-environment"},{"title":"Set Up Preview Environments for Every Pull Request","href":"/getting-started/guides/use-cases/preview-environments"},{"title":"Build E2E Testing Environments with GitHub Actions","href":"/getting-started/guides/use-cases/e2e-testing"}]}]},{"group":"Tutorials","pages":[{"title":"Deploy Your First Application","href":"/getting-started/guides/getting-started/deploy-your-first-application"},{"title":"Create a Database","href":"/getting-started/guides/getting-started/connect-database"},{"title":"Database Seeding with Lifecycle Jobs","href":"/getting-started/guides/others/database-seeding-lifecycle-job"},{"group":"Advanced Tutorials","pages":[{"group":"Infrastructure \u0026 Security","pages":[{"title":"Use AWS IAM Roles with Qovery","href":"/getting-started/guides/advanced-tutorials/aws-iam-roles"},{"title":"Certificate Management for Multi-Tenant Applications","href":"/getting-started/guides/advanced-tutorials/certificate-management-multi-tenant"},{"title":"Integrate Application Logs to CloudWatch","href":"/getting-started/guides/advanced-tutorials/cloudwatch-integration"},{"title":"Deploy a DaemonSet in a Karpenter Context","href":"/getting-started/guides/advanced-tutorials/deploy-daemonset-karpenter"},{"title":"HPA vs KEDA: Choosing an Autoscaling Mode","href":"/getting-started/guides/advanced-tutorials/hpa-vs-keda-autoscaling"},{"title":"Minimize downtime while upgrading RDS instances","href":"/getting-started/guides/advanced-tutorials/upgrading-rds-instance"},{"title":"Restore an RDS PostgreSQL blueprint to a point in time","href":"/getting-started/guides/advanced-tutorials/restoring-rds-point-in-time"}]},{"group":"Networking \u0026 Access Control","pages":[{"title":"Setting Up Cloudflare and Custom Domain on Qovery","href":"/getting-started/guides/advanced-tutorials/cloudflare-custom-domain"},{"title":"How to Setup Rate Limit on Services","href":"/getting-started/guides/advanced-tutorials/rate-limiting"},{"title":"How to Setup IP and Header-Based Authorization","href":"/getting-started/guides/advanced-tutorials/ip-header-authorization"},{"title":"Filter Outbound Traffic with an Egress Proxy","href":"/getting-started/guides/advanced-tutorials/egress-filtering-squid-proxy"},{"title":"Isolate Environments with Kubernetes NetworkPolicies","href":"/getting-started/guides/advanced-tutorials/isolate-environments-network-policies"},{"title":"Customizing Preview URL with Qovery CLI","href":"/getting-started/guides/advanced-tutorials/customizing-preview-url-with-qovery-cli"},{"title":"Expose a Qovery Service on Your Tailnet with Tailscale","href":"/getting-started/guides/advanced-tutorials/tailscale-expose-service"}]},{"group":"Development \u0026 Deployment","pages":[{"title":"How to Write a Dockerfile","href":"/getting-started/guides/advanced-tutorials/write-dockerfile"},{"title":"Import Environment Variables with the Qovery CLI","href":"/getting-started/guides/advanced-tutorials/import-env-vars-cli"},{"title":"Deploy JupyterHub using Helm","href":"/getting-started/guides/advanced-tutorials/deploy-jupyterhub"},{"title":"Create a Blazingly Fast REST API in Rust (Part 1/2)","description":"Build a performant Twitter clone API with Rust and deploy on Qovery","href":"/getting-started/guides/advanced-tutorials/rust-api-part-1"},{"title":"Run a Microservices Monorepo Without Rebuilding Everything","href":"/getting-started/guides/advanced-tutorials/microservices-monorepo"}]}]}]},{"group":"Troubleshooting","pages":[{"title":"Troubleshooting","description":"Diagnose a failed build or deployment from its logs, then fix common service deployment, runtime and cluster issues on Qovery.","href":"/getting-started/troubleshoot/overview"}]},{"group":"Useful Resources","pages":[{"title":"FAQ","href":"/getting-started/useful-resources/faq"},{"title":"Help and Support","href":"/getting-started/useful-resources/help-and-support"}]}]},{"tab":"Configuration","icon":"sliders","pages":[{"title":"Configuration","href":"/configuration/overview"}]},{"tab":"AI","icon":"robot","pages":[{"title":"AI","href":"/copilot/ai-overview"}]},{"tab":"Terraform Provider","icon":"code","pages":[{"title":"Terraform Provider","href":"/terraform-provider/overview"}]},{"tab":"CLI","icon":"terminal","pages":[{"title":"CLI","href":"/cli/overview"}]},{"tab":"API Reference","icon":"brackets-curly","pages":[{"title":"API Reference","href":"/api-reference/introduction"}]}]},"basePath":"","title":"Run a Microservices Monorepo Without Rebuilding Everything - Qovery","buildId":"dpl_Aw98ji4XvBsgtZwL1VrkUF9ehFqz","deploymentId":"dpl_Aw98ji4XvBsgtZwL1VrkUF9ehFqz","dynamics":["a74be98ba7"],"chunks":["zoom-image-lightbox-DsiWwPWR.js","lightbox-handle-r17bVUz3.js"]}