Cursor Rules in Monorepos

Hey there,

We are currently establishing Cursor Rules in our company after swapping our project into a Monorepo structure.

The Structure:

* apps/frontend (Public Store)

* apps/backend (Admin Dashboard)

* apps/api (Laravel Backend)

The Setup: I have placed a global rule file at the root to handle navigation and architecture: .cursor/rules/monorepo-md-guidelines.mdc

PS the \ are a Copy Error ignore them :slight_smile:

---

description: Global Monorepo Guidelines

alwaysApply: true

---



\# Monorepo Architecture & Navigation



We are working in a Monorepo with distinct projects. Always respect the specific rules found in the sub-directories.



\# Project Structure (The Map)



1\. \*\*apps/backend/\*\*

   \* \*\*Type:\*\* Internal Admin Dashboard

   \* \*\*Stack:\*\* Nuxt.js (Vue) + Bootstrap 4

   \* \*\*Role:\*\* Management interface for the platform.



2\. \*\*apps/frontend/\*\*

   \* \*\*Type:\*\* Public Customer Store

   \* \*\*Stack:\*\* Nuxt.js (Vue) + Tailwind CSS

   \* \*\*Role:\*\* The frontend facing the end-customers.



3\. \*\*apps/api/\*\*

   \* \*\*Type:\*\* Central Backend

   \* \*\*Stack:\*\* Laravel

   \* \*\*Role:\*\* Provides REST API for both frontends.



\# Global Behavior Rules



\* \*\*Context:\*\* When I ask for a full feature implementation, check if it spans across the API and one of the Frontends.

I also have specific .mdc files inside the sub-projects, for example: apps/backend/.cursor/rules/project-md-guidelines.mdc

---

description: Applies to admin-frontend project, enforcing best practices for frontend development.

globs: apps/backend/\*\*/\*

---

\# \[Specific Rules for Backend Frontend...\]

The Problem: Today I tried to modify an existing component in apps/backend, but Cursor ignored the context completely:

1. CSS: It started writing custom CSS instead of using Bootstrap 4 (as defined in the stack).

2. SSR: It ignored Server/Client rendering distinctions (e.g., trying to put a Timer in server-side code).

These rules are explicitly defined in the sub-project guidelines, but the AI seems to be overlooking them.

Question: Has anyone successfully set up Cursor Rules for a Monorepo where sub-directories have conflicting stacks (e.g., Tailwind in one app, Bootstrap in another)? Does Cursor support nested .cursor folders, or should I move everything to the root with specific globs?

Any advice is appreciated!

Hey, thanks for the report. Cursor does support nested .cursor/rules. But you have multiple config issues, which is why the rules get ignored.

Problem 1: Metadata mismatch

description: Applies to admin-frontend project...  # Says FRONTEND
globs: apps/backend/**/*                           # Path is BACKEND

The AI reads the description, sees “admin-frontend”, but you’re working in apps/backend/, so it thinks the rule doesn’t apply and ignores it. That’s why it wrote custom CSS instead of using Bootstrap 4.

Problem 2: Wrong glob for nested rules

If the rule is in apps/backend/.cursor/rules/, then globs: apps/backend/**/* may not work. The glob should be relative to the project root, but for nested rules it’s better to use a relative path, or don’t specify globs at all.

Problem 3: alwaysApply: false

With alwaysApply: false, the AI decides whether to apply the rule based on the description. Your description is broad and also conflicting, so the AI can’t tell when it should apply.

How rule activation works:

Stage 1 (Injection): globs or alwaysApply loads the rule into context
Stage 2 (Activation): description helps the AI decide whether to follow the rule

More details: A Deep Dive into Cursor Rules (> 0.45)

Correct fix for apps/backend/.cursor/rules/project-md-guidelines.mdc:

---
description: Backend admin dashboard - use Bootstrap 4 classes, Nuxt SSR patterns, avoid custom CSS
globs: ["**/*.vue", "**/*.js", "**/*.ts"]
alwaysApply: true
---

# Backend Admin Dashboard Rules

## Stack
-  Nuxt.js (Vue) with Bootstrap 4
-  Server-side rendering (SSR)
-  No custom CSS - use Bootstrap utilities

## CSS Rules
-  Always use Bootstrap 4 classes
-  Never write custom CSS
-  Use `b-` prefixed components from BootstrapVue

## SSR Rules
-  Keep reactive code in `mounted()` or client-only components
-  Timers/intervals only in `<client-only>` wrapper
-  Check `process.client` before using browser APIs

@tsconfig.json
@nuxt.config.js

Alternative (if globs don’t work):

---
description: Backend admin dashboard - Bootstrap 4, SSR, no custom CSS
alwaysApply: true
---

With alwaysApply: true, the rule will always apply for files in the apps/backend/ directory, no matter what the globs do.

For apps/frontend/.cursor/rules/ (Tailwind):

---
description: Frontend public store - use Tailwind CSS utilities, no Bootstrap
globs: ["**/*.vue", "**/*.js", "**/*.ts"]
alwaysApply: true
---

# Frontend Public Store Rules

## Stack
-  Nuxt.js (Vue) with Tailwind CSS
-  Use Tailwind utility classes
-  No Bootstrap classes

Known issues with globs in monorepos:

  • In multi-root workspaces, globs can be unreliable
  • Format matters, use an array like ["**/*.vue"], not a string
  • No spaces after commas, like **/*.vue,**/*.js

Official docs: https://docs.cursor.com/context/rules
Related thread: Nested Cursor Rules (Subdirectories)

Fix the metadata and the rules should start working. The most reliable setup is alwaysApply: true plus a clear description that names the exact stack.