/cursor-tutorials

How to make Cursor follow MVC patterns

Learn how to make Cursor follow MVC patterns with clear steps and tips to structure your code efficiently in any project.

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 make Cursor follow MVC patterns

To make Cursor follow MVC patterns, you don’t force Cursor to “understand MVC” automatically — instead, you structure your project in a clear MVC layout and then guide Cursor through Chat and Composer edits so it respects the folder boundaries. Cursor is very good at following patterns once the pattern is visible in the codebase. If MVC is cleanly defined, Cursor will naturally generate controllers, models, and views in the right places as long as you explicitly tell it where each piece belongs.

 

How to Make Cursor Follow MVC Patterns

 

You ensure Cursor follows MVC by first organizing your folders into a clear Models, Views, and Controllers structure, then giving Cursor very explicit instructions whenever generating or modifying code. Cursor doesn’t “enforce architecture”, but it strictly follows patterns already present. If your structure is clean and consistent, Cursor will adopt it automatically. If it’s messy or ambiguous, Cursor will guess — and sometimes guess wrong.

 

What MVC Means (simple explanation)

 

  • Model – Code that talks to the database or business logic. Example: User model, Product model.
  • View – The UI layer. In backend frameworks this can be templates (like EJS). In React apps the “views” are React components.
  • Controller – Code that handles incoming requests, calls the models, then sends back responses or renders views.

The goal is: controllers shouldn’t contain database logic, models shouldn’t render UI, and views shouldn’t know how data is stored.

 

How to Set Up Your Folder Structure So Cursor Understands It

 

Cursor relies heavily on the structure of your project. A clean layout teaches it how to behave.

 

project/
  src/
    models/
      userModel.js
      productModel.js

    controllers/
      userController.js
      productController.js

    views/
      userView.jsx
      productView.jsx

    routes/
      userRoutes.js
      productRoutes.js

  server.js

 

If you’re using Node/Express, this is a very standard layout and Cursor follows it well.

 

How to “Train” Cursor to Keep Using MVC

 

When making edits, tell Cursor exactly where each part belongs. This prevents it from mixing logic.

  • In Chat, be explicit: “Generate a new Product controller in src/controllers, do not mix model logic into it.”
  • Select multiple files (Shift+Click in the file tree) so Cursor sees the full context.
  • Use Composer when generating new features so Cursor understands the relationship between models, views, and controllers.

Cursor becomes much more predictable once the pattern is visible and repeated.

 

Example of Clear MVC Code Cursor will Respect

 

Below is a simple Node/Express example. Cursor tends to follow this style very reliably.

  • Model
// src/models/userModel.js

class UserModel {
  constructor(db) {
    this.db = db
  }

  async findById(id) {
    return this.db.users.find(user => user.id === id) // Fake in-memory db example
  }
}

module.exports = UserModel
  • Controller
// src/controllers/userController.js

const UserModel = require('../models/userModel')

class UserController {
  constructor(db) {
    this.userModel = new UserModel(db)
  }

  async getUser(req, res) {
    const user = await this.userModel.findById(req.params.id)
    if (!user) return res.status(404).send('User not found')
    res.json(user)
  }
}

module.exports = UserController
  • Route
// src/routes/userRoutes.js

const express = require('express')
const router = express.Router()
const UserController = require('../controllers/userController')
const db = { users: [{ id: '1', name: 'Alice' }] } // Fake in-memory data
const userController = new UserController(db)

router.get('/:id', (req, res) => userController.getUser(req, res))

module.exports = router

Cursor sees this separation and will start generating files in the right place.

 

Using Cursor Commands to Enforce MVC

 

  • When generating new functionality: “Create a new Order model, controller, and routes. Keep each part in its proper folder.”
  • When cleaning existing code: “Refactor this controller to remove DB logic and move it into a model in src/models.”
  • When rewriting legacy code: “Split this monolithic file into MVC-separated files following the project structure.”

Cursor handles these tasks extremely well as long as the direction is specific.

 

Common Mistakes That Break MVC in Cursor

 

  • Letting controllers talk to the database directly. Cursor will copy that pattern.
  • Mixing React components with backend controllers. Cursor gets confused about “views”.
  • Leaving duplicate folder structures (e.g., old “controllers-old/”). Cursor might use the wrong one.
  • Not selecting enough files when asking Cursor for multi-file changes.

Fixing these early makes Cursor behave much more predictably.

 

Summary

 

Cursor follows MVC as long as the project itself follows MVC. You create a clean structure, keep your logic separated, and give Cursor explicit prompts when adding new files or modifying behavior. Cursor is pattern-driven — so when your architecture is consistent, Cursor becomes consistent too.

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