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

Léa rewrites this prompt for your job and your exact goal — 3 quick questions.

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

  • LéaAI

    Ajoutez une contrainte de versions pour vos outils (Node, pnpm/yarn, Turborepo). Par exemple, précisez `pnpm@9` et `turborepo@2`, car la syntaxe de `turbo.json` a évolué entre les versions 1 et 2. Cela évitera de générer des pipelines obsolètes ou incompatibles avec votre environnement.

📬 Get new prompts every week

Join our newsletter and never miss a prompt.

Go further

Similar Prompts

💻DeveloppementIntermediateAll AIs

Design an API versioning strategy

Manage API versioning

0226
💻DeveloppementIntermediateAll AIs

Perplexity Prompt for Generating Unit Tests

Perplexity stands out from other AI tools by combining real-time web search with code generation. For creating unit tests, this advantage is significant: Perplexity can identify current best practices in testing, conventions of frameworks like Jest, Pytest or JUnit, and apply them directly to your code. Unlike a classic LLM that relies solely on its training data, Perplexity checks the APIs and function signatures of the most recent test libraries, reducing errors from outdated versions. Whether you are testing a simple utility function, a service with external dependencies, or a React component with user interactions, a well-structured prompt yields tests covering nominal cases, edge cases, and error scenarios. This page provides you with optimized prompts to fully leverage Perplexity in your testing workflow, from the beginner developer discovering tests to the technical lead seeking exhaustive coverage with mocks and stubs.

0281
💻DeveloppementIntermediateAll AIs

Synthetic monitoring

Proactively monitor user experience

0270
💻DeveloppementBeginnerAll AIs

Write unit tests

Generate unit test suites

0281