Workflow · Production

Real-world engineering challenges: building Cursor — 100x growth, 1M+ QPS, and billions of daily code completions

The problem

Cursor needed to deliver sub-second AI code completions at massive scale — 1M+ transactions per second — without storing sensitive source code on the server.

First attempt

Cursor's initial database Yugabyte did not scale as expected and had to be migrated to PostgreSQL; a separate large indexing outage forced an emergency migration to turbopuffer.

Workflow diagram · grounded in source
1
Context collected and encrypted locally
trigger
“A small part of the current context window (code) is collected locally by the client The code is encrypted The encrypted code / context is sent to the backend”
2
In-house LLM generates autocomplete
ai_action
“The backend decrypts the code / context A suggestion is generated using Cursor's in-house LLM model”
3
Tab suggestion displayed to user
output
“The IDE displays the suggestion. Hitting "Tab" accepts the suggestion”
4
Chat query triggers codebase search
trigger
“The prompt is sent to the Cursor server, where it interprets it, and decides it needs to execute a codebase search”
5
Vector search on codebase embeddings
ai_action
“Search is done using codebase indexes. Codebase indexes are previously-created embeddings. It tries to locate the embeddings that are best matches for the context using vector search”
6
Source code fetched from client
integration
“the server does not store any source code, but now requests the source code both from server.js and index.html, so it can analyze both and decide which is relevant”
7
Server answers with retrieved context
output
“after the vector search and requesting relevant source code from the client, the server has the context it needs to answer the question”
8
Merkle tree sync keeps index current
integration
“Every 3 minutes, Cursor does an index sync. To determine which files need re-indexing, it compares the two Merkle trees; the one on the client which is the source of truth, and the one on the server which is the state of the index”
Reported outcome

Cursor reached $500M+ in annual revenue and 100x growth in load within 12 months, serving over 1M transactions per second and used by more than 50% of the 1,000 largest US companies.

Reported metrics
Load growth in 12 months100x
Peak transactions per second1M
Annual revenue run rate$500M+
Enterprise code lines written per day100M+
Show all 12 reported metrics
load growth in 12 months100x
peak transactions per second1M
annual revenue run rate$500M+
enterprise code lines written per day100M+
share of 1,000 largest US companies using Cursormore than 50%
Series C funding raised$900M
company valuation$9.9B
daily lines of code written by all usersjust fewer than a billion
number of engineers50
codebase file count25,000
codebase line count7 million
index sync frequencyevery 3 minutes
Reported stack
TypeScriptRustElectronturbopufferPineconeWarpstreamDatadogPagerDutySlackSentryAmplitudeStripeWorkOSVercelLinearTerraformAWSAzureEC2AWS FirecrackerVisual Studio CodeOpenAI's embedding models
Source
https://newsletter.pragmaticengineer.com/p/cursor
Read source ↗

Frequently asked questions

What did this team achieve with this AI workflow?

Cursor reached $500M+ in annual revenue and 100x growth in load within 12 months, serving over 1M transactions per second and used by more than 50% of the 1,000 largest US companies.

What tools did this team use?

TypeScript, Rust, Electron, turbopuffer, Pinecone, Warpstream, Datadog, PagerDuty, Slack, Sentry.

What results were reported?

Load growth in 12 months: 100x; Peak transactions per second: 1M; Annual revenue run rate: $500M+; Enterprise code lines written per day: 100M+ (source-reported, not independently verified).

What failed first in this deployment?

Cursor's initial database Yugabyte did not scale as expected and had to be migrated to PostgreSQL; a separate large indexing outage forced an emergency migration to turbopuffer.

How is this workflow AI workflow structured?

Context collected and encrypted locally → In-house LLM generates autocomplete → Tab suggestion displayed to user → Chat query triggers codebase search → Vector search on codebase embeddings → Source code fetched from client → Server answers with retrieved context → Merkle tree sync keeps index current.