/cursor-tutorials

How to use Cursor in a monorepo

Learn how to use Cursor in a monorepo to streamline development, boost productivity, and manage shared code efficiently.

Matt Graham, CEO of Rapid Developers

Book a call with an Expert

Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.

Book a free No-Code consultation

How to use Cursor in a monorepo

When you use Cursor in a monorepo, you treat it almost exactly like VS Code, but with an AI layer that understands multiple packages at once. The key is organizing your repo so Cursor can “see” the relevant files, using the Composer tab to target the correct package, and guiding the AI so it doesn’t guess about cross‑package code. Cursor works great in monorepos as long as you keep context tight, use the right prompts, and let your package tooling (like pnpm, turbo, poetry, etc.) do the heavy lifting.

 

What “Using Cursor in a Monorepo” Actually Means

 

A monorepo is simply a single Git repository that contains several projects or packages. For example, typical folders might be apps/api, apps/web, and packages/utils. Cursor doesn’t change how the code runs — it only helps you edit, search, navigate, and generate code. You still rely on your local Node/Python runtime, your package manager, and your build tools. Cursor just helps you move faster inside that structure.

 

  • You open the entire monorepo as your root folder. Cursor indexes everything it can see.
  • You run commands from the monorepo root in the built‑in terminal, just like VS Code.
  • You guide Cursor toward the correct package so it doesn't hallucinate or mix layers.

 

How to Work Effectively

 

Below are the practical steps real developers use daily in Cursor when working in a monorepo. These reflect actual workflows that avoid hallucinations and keep the editor helpful instead of chaotic.

 

  • Use the Composer tab with folder context.
    In Cursor, when you highlight a folder (for example apps/api) and click Composer, Cursor limits its reasoning to those files. This dramatically improves accuracy when you only want to modify one package.
  • Use multi-file edit carefully.
    If you highlight the whole monorepo and ask for a big rewrite, Cursor may exceed its context limits. Instead, target a specific package or module.
  • Use “Search” to locate definitions before editing.
    The Search panel helps you ask Cursor something like “show me all references to `createUser`” before you attempt a refactor.
  • Open the terminal & run commands at the correct level.
    If you use Node with pnpm or turbo, run them exactly as you would in VS Code:
pnpm install
pnpm --filter api dev   // Run only the "api" app
pnpm --filter web build // Build only the "web" app
  • Let real tooling enforce correctness.
    Cursor helps write code, but your actual compiler/test runner/linter ensures correctness. For example:
pnpm test
ruff check .       // Python linter
pytest apps/api    // Run API tests
  • Ask Cursor to trace dependencies across packages.
    Cursor excels at explaining: “Where does this function get used across the monorepo?” This is often clearer than manually grepping for files.
  • Keep shared packages clean.
    In a monorepo, places like packages/utils or packages/config are used by multiple apps. When modifying them, tell Cursor exactly which consumers will be affected so it updates import paths correctly.

 

Example: Adding a Shared Function in a Monorepo

 

Say you have this structure:

apps/
  api/
  web/
packages/
  utils/

If you create a new helper in packages/utils/src/math.ts:

// packages/utils/src/math.ts

export function clamp(value: number, min: number, max: number) {
  return Math.min(Math.max(value, min), max)
}

You can ask Cursor:

  • “Add a `clamp` utility to utils and update all api/web imports accordingly.”

But highlight only the utils folder when doing the edit, then separately perform “edit and apply” in api and web. This keeps context correct and avoids the AI inventing unrelated files.

 

Practical Rules That Make Cursor Work Well in Monorepos

 

  • Always scope edits. Select the smallest set of files or folders possible.
  • Use your real dev server to verify. Don’t trust Cursor blindly; run the code.
  • Use search + navigate before large refactors.
  • Use version control carefully. Commit before big AI edits so you can revert.
  • Leverage tasks built in your monorepo. Cursor doesn’t replace pnpm/turborepo/poetry/Makefile.

 

Example Terminal Workflow in Cursor

 

git checkout -b feature/add-clamp

cursor   // You're already inside Cursor, but reminder
pnpm --filter utils test      // run tests for a single package
pnpm --filter api dev         // run local API server
pnpm --filter web dev         // run local front-end server

Then let Cursor help you edit files, explain dependencies, and apply safe-scoped changes.

 

Final Takeaway

 

Using Cursor in a monorepo works extremely well as long as you control scope. You let the monorepo tools (pnpm/turborepo/poetry) handle building and running, while Cursor handles navigation, explanation, cross-reference reasoning, and localized edits. Treat it like VS Code with a very smart helper — not like an auto‑pilot. That’s how senior engineers use it effectively every day.

Still stuck?
Copy this prompt into ChatGPT and get a clear, personalized explanation.

This prompt helps an AI assistant understand your setup and guide you through the fix step by step, without assuming technical knowledge.

AI AI Prompt

Want to explore opportunities to work with us?

Connect with our team to unlock the full potential of no-code solutions with a no-commitment consultation!

Book a Free Consultation

Client trust and success are our top priorities

When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.

Rapid Dev was an exceptional project management organization and the best development collaborators I've had the pleasure of working with. They do complex work on extremely fast timelines and effectively manage the testing and pre-launch process to deliver the best possible product. I'm extremely impressed with their execution ability.

CPO, Praction - Arkady Sokolov

May 2, 2023

Working with Matt was comparable to having another co-founder on the team, but without the commitment or cost. He has a strategic mindset and willing to change the scope of the project in real time based on the needs of the client. A true strategic thought partner!

Co-Founder, Arc - Donald Muir

Dec 27, 2022

Rapid Dev are 10/10, excellent communicators - the best I've ever encountered in the tech dev space. They always go the extra mile, they genuinely care, they respond quickly, they're flexible, adaptable and their enthusiasm is amazing.

Co-CEO, Grantify - Mat Westergreen-Thorne

Oct 15, 2022

Rapid Dev is an excellent developer for no-code and low-code solutions.
We’ve had great success since launching the platform in November 2023. In a few months, we’ve gained over 1,000 new active users. We’ve also secured several dozen bookings on the platform and seen about 70% new user month-over-month growth since the launch.

Co-Founder, Church Real Estate Marketplace - Emmanuel Brown

May 1, 2024 

Matt’s dedication to executing our vision and his commitment to the project deadline were impressive. 
This was such a specific project, and Matt really delivered. We worked with a really fast turnaround, and he always delivered. The site was a perfect prop for us!

Production Manager, Media Production Company - Samantha Fekete

Sep 23, 2022