Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions content/docs/guides/cursor-origin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
title: Cursor Origin
subtitle: Give every Origin pull request its own database branch
summary: >-
origin-neon is an open-source Cursor Origin app that creates a database branch
on Neon for each Origin pull request and deletes it when the pull request
closes. Stacked pull requests branch from their parent pull request's branch
rather than from production. You deploy the app yourself as a Neon Function and
register your own Origin app. Agents and CI read the branch credentials with
`neon env pull`.
enableTableOfContents: true
updatedOn: '2026-08-18T08:55:00.000Z'
---

[Cursor Origin](https://cursor.com/docs/origin) hosts repositories and pull requests, including the ones Cursor agents open. [origin-neon](https://github.com/neon-solutions/origin-neon) is an Origin app that gives each of those pull requests an isolated database branch, so a pull request never runs against production data.

<Admonition type="note">
`origin-neon` is an open-source project, not a Neon-managed integration. You deploy it yourself and register your own Origin app.
</Admonition>

## How it works

Install the app on an Origin-hosted repository. It then acts on pull request events:

- Opening, reopening, or pushing to a pull request creates or reuses a branch named `origin-<repo>-pr-<number>`.
- A stacked pull request branches from its parent pull request's branch.
- Closing or merging a pull request deletes its branch, once no open pull request depends on it.

Each pull request receives a comment linking to its branch in the Neon Console. Agents and CI read that branch's credentials themselves:

```bash
neon env pull
```

Origin apps cannot reach repositories that Origin mirrors in from GitHub. Use the [Neon GitHub integration](/docs/guides/neon-github-integration) for those.

## Deploy the app

```bash
git clone https://github.com/neon-solutions/origin-neon
cd origin-neon
cp .env.example .env.production
neon link
neon deploy
```

Set `NEON_API_KEY`, `NEON_PROJECT_ID`, and `ORIGIN_REPO_ALLOWLIST` in `.env.production`. Use a project-scoped API key for the project that receives the pull request branches.

Then register an Origin app at [cursor.com/codebase/settings/apps](https://cursor.com/codebase/settings/apps), point its webhook at your deployed Function URL, and install it on the repository. The repository [README](https://github.com/neon-solutions/origin-neon#auth) covers the signing key and the required scopes.
2 changes: 2 additions & 0 deletions content/docs/navigation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1384,6 +1384,8 @@
items:
- title: Convex
slug: https://neon.com/guides/convex-neon
- title: Cursor Origin
slug: guides/cursor-origin
- title: GitHub integration
slug: guides/neon-github-integration
- title: Knex
Expand Down
Loading