/cursor-tutorials

How to generate full CRUD features with Cursor

Learn how to generate complete CRUD features in Cursor with clear steps and tips that speed up development and help you build powerful apps fast.

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 generate full CRUD features with Cursor

When you want Cursor to generate full CRUD features, the core idea is: you guide Cursor with clear instructions, file context, and your existing project structure. Cursor can generate all Create / Read / Update / Delete code, but only if you feed it the right files and constraints. The fastest workflow is to open the relevant backend folder, highlight the model and routes, then use Cursor’s Cmd+K (Edit) or the Chat pane to ask for CRUD generation. Cursor will then create the controllers, routes, validation, and (if you ask) frontend forms or components. You keep control, because Cursor will show the diff before writing anything. That's the whole trick: guide it clearly and review every diff.

 

How to reliably generate full CRUD features with Cursor

 

You don’t “press a button for CRUD”; instead, you use Cursor’s strengths — multi‑file reasoning, refactors, and diff previews — to have it generate code that fits your project. Below is the approach that works consistently in real teams.

  • Open the model or schema file (for example a Mongoose model, Prisma schema, SQLAlchemy model, Django model, etc.). Cursor generates the best CRUD when it sees that file.
  • Tell Cursor exactly what backend stack you're using (Node/Express, FastAPI, Django, etc.). Cursor does not guess accurately unless you say it.
  • Use Cmd+K (Edit) in the actual folder where you want the new CRUD code to live. This helps Cursor infer project structure.
  • Ask Cursor to generate controllers + routes + validation + service logic, not just “CRUD”. Being explicit avoids hallucinations.
  • Review the diff before accepting. This is where you catch mistakes or missing imports.
  • Use the integrated terminal to test immediately with commands like `npm run dev` or `uvicorn main:app --reload`.

 

Example: Generating CRUD in a Node + Express project

 

Below is a simple, real-world example. Let’s say you have a file models/Book.js with a Mongoose schema. You highlight this file and tell Cursor:

“Generate full CRUD (controller + routes) for this Book model using Express + Mongoose. Output separate files in controllers/ and routes/. Use async/await. No TypeScript.”

Cursor will usually generate something like the following. This is valid, real Express/Mongoose code:

 

// controllers/bookController.js

const Book = require('../models/Book');

// CREATE
exports.createBook = async (req, res) => {
  try {
    const book = await Book.create(req.body); // Create
    res.status(201).json(book);
  } catch (err) {
    res.status(400).json({ error: err.message });
  }
};

// READ ALL
exports.getBooks = async (req, res) => {
  try {
    const books = await Book.find(); // Read many
    res.json(books);
  } catch (err) {
    res.status(500).json({ error: err.message });
  }
};

// READ ONE
exports.getBook = async (req, res) => {
  try {
    const book = await Book.findById(req.params.id); // Read one
    if (!book) return res.status(404).json({ error: 'Not found' });
    res.json(book);
  } catch (err) {
    res.status(500).json({ error: err.message });
  }
};

// UPDATE
exports.updateBook = async (req, res) => {
  try {
    const updated = await Book.findByIdAndUpdate(
      req.params.id,
      req.body,
      { new: true }
    ); // Update
    if (!updated) return res.status(404).json({ error: 'Not found' });
    res.json(updated);
  } catch (err) {
    res.status(400).json({ error: err.message });
  }
};

// DELETE
exports.deleteBook = async (req, res) => {
  try {
    const removed = await Book.findByIdAndDelete(req.params.id); // Delete
    if (!removed) return res.status(404).json({ error: 'Not found' });
    res.json({ message: 'Deleted' });
  } catch (err) {
    res.status(500).json({ error: err.message });
  }
};

 

// routes/bookRoutes.js

const express = require('express');
const router = express.Router();
const controller = require('../controllers/bookController');

// Each route maps to a controller function
router.post('/', controller.createBook);
router.get('/', controller.getBooks);
router.get('/:id', controller.getBook);
router.put('/:id', controller.updateBook);
router.delete('/:id', controller.deleteBook);

module.exports = router;

 

This is exactly the kind of output Cursor can generate when you give it the proper context. You then plug the route into your Express app:

 

// app.js

const express = require('express');
const app = express();

app.use(express.json());
app.use('/api/books', require('./routes/bookRoutes')); // Mount CRUD

module.exports = app;

 

Tips to make Cursor generate stronger CRUD code

 

  • Always include the folder structure in your prompt. Example: “Put controllers in controllers/, routes in routes/.”
  • Pasting the relevant model into the Chat dramatically improves output.
  • Use incremental edits. First generate the controller. Accept. Then ask to generate routes. Accept. Cursor handles small steps better.
  • Ask Cursor to add validation (like Zod, Joi, or built‑in schema validation) if your project uses it.
  • Use the terminal right away to spot missing imports or wrong filenames.

 

If you also need front‑end CRUD (React example)

 

Cursor can generate React components if you open your frontend folder and tell it something like:

“Generate a React page with a form for creating Books and a list view showing all Books. Use fetch, no external libraries.”

It will output working components because it can see your project.

 

The mental model to keep

 

Cursor is not a magic generator. It’s a teammate who writes code fast when you provide:

  • Your model
  • Your folder structure
  • Your stack and conventions
  • The exact files you want created or modified

Give it those, accept diffs carefully, and Cursor will generate production-ready CRUD features in minutes, not hours.

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