P
💻DeveloppementAdvancedAll AIs

Prompt to Create a Monorepo with Turborepo

A prompt to generate the complete architecture of a Turborepo monorepo with folder structure, pipelines, shared packages and CI/CD configuration.

Paste in your AI

Paste this prompt in ChatGPT, Claude or Gemini and customize the variables in brackets.

Tu es un architecte logiciel senior spécialisé en monorepos JavaScript/TypeScript. Je veux créer un monorepo avec Turborepo pour mon projet.

Contexte du projet :

  • Type de projet : [TYPE_DE_PROJET (ex: SaaS avec frontend Next.js et API Node.js, suite d'apps mobiles React Native + dashboard web, librairie de composants UI avec documentation)]
  • Nombre d'applications : [NOMBRE_ET_LISTE_DES_APPS (ex: 2 apps - un frontend Next.js et une API Express)]
  • Packages partagés souhaités : [PACKAGES_PARTAGES (ex: ui, utils, config-eslint, config-typescript, types)]
  • Gestionnaire de paquets : [GESTIONNAIRE (pnpm, npm, yarn ou bun)]
  • Technologies principales : [STACK_TECHNIQUE (ex: TypeScript, React, Tailwind CSS, Prisma)]

Génère une architecture complète de monorepo Turborepo incluant :

  1. Structure des dossiers : arborescence complète avec apps/ et packages/, en expliquant le rôle de chaque dossier.

  2. Fichiers de configuration racine :

    • turbo.json avec les pipelines (build, dev, lint, test, type-check) et les dépendances entre tâches
    • package.json racine avec les workspaces et scripts globaux
    • Configuration du gestionnaire de paquets (pnpm-workspace.yaml si pnpm)
    • tsconfig.json de base partagé
  3. Packages partagés : pour chaque package listé, fournis :

    • Le package.json avec les exports corrects (main, types, exports map)
    • Le tsconfig.json qui étend la config de base
    • Un exemple de code source montrant le pattern d'export
  4. Configuration des apps : comment chaque app référence les packages internes (avec le protocole workspace:*).

  5. Pipeline Turborepo optimisé :

    • Ordre de build avec topological dependencies
    • Configuration du cache (inputs, outputs)
    • Variables d'environnement (globalEnv, env)
  6. Scripts utilitaires :

    • Script pour créer un nouveau package
    • Script pour créer une nouvelle app
    • Commandes de développement courantes
  7. CI/CD : exemple de GitHub Actions qui exploite le cache Turborepo et le Remote Caching.

  8. Bonnes pratiques :

    • Gestion des dépendances (internes vs externes)
    • Stratégie de versioning
    • Convention de nommage des packages
    • Pièges courants à éviter

Fournis tous les fichiers avec leur contenu complet, prêts à être copiés. Ajoute des commentaires explicatifs dans le code.

Personalize this prompt with Léa

Answer 3 questions and Léa tailors the prompt to your situation.

Why this prompt works

<p>This prompt guides AI to produce a turnkey Turborepo monorepo architecture. By specifying your <strong>project type</strong> and <strong>tech stack</strong>, you get a structure tailored to your real needs rather than a generic template.</p><p>The <strong>[SHARED_PACKAGES]</strong> and <strong>[NUMBER_AND_LIST_OF_APPS]</strong> variables are essential: they allow AI to correctly configure workspace dependencies, build pipelines and exports for each package. The more specific you are about your stack, the more directly usable the generated configuration files will be.</p><p>The prompt deliberately covers the entire monorepo lifecycle — from initial structure to CI/CD — so you can start immediately without figuring out how to connect the different parts. Adapt sections based on your priority: <strong>start with structure and configs</strong>, then add CI/CD once the monorepo is working locally.</p>

Use Cases

Start a new SaaS project with frontend and backend in a single repositoryMigrate multiple existing repositories into a unified monorepoCreate a shared component library across multiple applicationsSet up an optimized CI/CD pipeline with Turborepo distributed cache

Expected Output

A complete monorepo architecture with directory tree, all configuration files (turbo.json, package.json, tsconfig), shared package examples with their exports, a GitHub Actions workflow and a list of best practices.

Improve this prompt

Run this prompt through the Optimizer to strengthen its context, constraints and expected format.

Improve this prompt with the Optimizer

Comments

Be the first to comment on this prompt.

📬 Get new prompts every week

Join our newsletter and never miss a prompt.

Go further

Similar Prompts

💻DeveloppementIntermediateAll AIs

Activation Idea Test

Generating activation experiment ideas

0146
💻DeveloppementIntermediateAll AIs

NetworkPolicies for micro-segmentation

Isolate workloads with network policies

0139
💻DeveloppementAdvancedAll AIs

Progressive Rollout Strategy

Progressive deployment of a new model

0147
💻DeveloppementAdvancedAll AIs

Design a Versioned API

Evolving a public API without breaking integrations

0151