Cursor
What is Cursor?
Cursor is an AI-native code editor built on VS Code. It has all of VS Code's features (extensions, keybindings, themes) plus AI built deeply into the editor — not as a plugin, but as a core feature.
The key difference from Copilot: Cursor understands your entire codebase, not just the current file. You can ask "how does authentication work in this project?" and it searches your code to answer.
Installation
Download from cursor.com. Import your VS Code settings, extensions, and keybindings on first launch — takes 30 seconds.
Pricing: free tier with limited messages; Pro plan for unlimited use.
Core Features
Chat (Ctrl+L)
Opens a chat panel that can see your codebase:
You: Where is the JWT token verified in this project?
Cursor: JWT verification happens in `middleware/auth.js` at line 12,
in the `requireAuth` function. It uses `jsonwebtoken.verify()` with
the secret from `process.env.JWT_SECRET`. The middleware is applied
to all routes in `routes/api.js` line 8.
Attach specific files to give Cursor more context:
- Type
@filenameto include a file - Type
@docsto include documentation - Type
@webto search the web
Composer (Ctrl+I or Ctrl+Shift+I)
Composer makes changes across multiple files simultaneously. This is Cursor's superpower:
Prompt: "Add input validation to all Express route handlers using Joi.
Create a validate() middleware and apply it to POST and PUT routes."
Cursor: Creates middleware/validate.js
Updates routes/users.js (3 routes)
Updates routes/posts.js (2 routes)
Creates schemas/userSchema.js
Creates schemas/postSchema.js
It shows a diff for every file change — you review and accept or reject each one.
Use Composer for:
- Large refactors that touch many files
- Adding a new pattern consistently across the codebase
- Migrating from one library to another
- Implementing a feature from scratch
Inline Editing (Ctrl+K)
Select code, press Ctrl+K, type an instruction:
Select: a messy 30-line function
Prompt: "refactor this to be more readable, extract helper functions"
Cursor: Shows a diff of the refactored version inline
Quick edits without opening the full chat panel.
Codebase Indexing
Cursor indexes your project so it can answer questions about it:
You: What database ORM does this project use?
Cursor: This project uses Mongoose (v7.x). The connection is established
in `config/database.js` and models are defined in the `models/`
directory using Mongoose schemas.
You: How are errors handled in this API?
Cursor: Error handling is centralized in `middleware/errorHandler.js`.
Route handlers use the asyncHandler wrapper (utils/asyncHandler.js)
to catch async errors and forward them via next(err).
Effective Cursor Workflows
Onboarding to a New Codebase
When you join a new project:
Chat: "Explain the overall architecture of this project"
Chat: "What are the main data models?"
Chat: "How does a typical API request flow from route to database?"
Chat: "What testing approach does this project use?"
Cursor reads the actual code and gives accurate answers — much faster than reading all files manually.
Implementing a Feature
1. Describe the feature to Cursor Chat:
"I need to add email verification when a user registers.
Walk me through how to implement this."
2. Cursor outlines the approach using your existing code patterns
3. Open Composer, give it the full requirement:
"Implement email verification on registration:
- Send a verification email after signup
- Add a /verify-email/:token route
- Store verification tokens in the User model
- Expire tokens after 24 hours"
4. Review each file diff, accept or modify
5. Run tests, fix issues in Chat
Debugging
Paste an error into Chat:
You: Getting this error:
TypeError: Cannot read properties of undefined (reading 'email')
at getUserProfile (controllers/userController.js:45:25)
Cursor: The error is on line 45 where you access `user.email`.
Looking at your code, `findById` returns null when the
user doesn't exist, and you're not checking for that.
Add a null check:
const user = await User.findById(req.params.id);
if (!user) return res.status(404).json({ error: 'User not found' });
Cursor vs Copilot — When to Use Which
| Task | Tool |
|---|---|
| Autocomplete as you type | Copilot |
| Single-file edits | Either (Cursor inline, Copilot suggestion) |
| Multi-file refactor | Cursor Composer |
| Understand existing code | Cursor Chat |
| Quick function generation | Copilot |
| Debugging with error context | Cursor Chat |
Many developers use both: Copilot for autocomplete, Cursor for larger changes.
Privacy Considerations
Cursor sends your code to its servers for AI processing. For proprietary codebases, check whether your company's security policy allows this. Cursor offers a "Privacy Mode" that doesn't store code on their servers.