# Neon

Use Neon for a serverless Postgres database with auth and branching.

## [What is Neon](/content/docs/integrations/neon#what-is-neon/index.html)

Neon is a serverless, fully-managed Postgres platform with built-in auth. What makes it stand out:

- **Branching**: spin up an isolated copy of your data and schema in seconds. Iterate on a **development** branch, then promote changes to **production** without risking live data.
- **Time-travel**: automatic backups let you restore to any point in time.
- **Generous free tier**: up to 100 projects.

Neon integration is currently available for Next.js and Vite projects.

## [Setup](/content/docs/integrations/neon#setup/index.html)

Connecting to Neon only takes a couple of minutes.

### [Prompt Dyad for a database](/content/docs/integrations/neon#prompt-dyad-for-a-database/index.html)

Just start chatting. When you request a backend or database feature, Dyad asks if you'd like to connect a database, the fastest way to kick off setup:

> Add a database to store my todos

### [Choose Neon in the integration selector](/content/docs/integrations/neon#choose-neon-in-the-integration-selector/index.html)

When prompted to add a backend, pick **Neon** from the integration selector. You're taken to its connector in the **Configure** panel, where you can set everything up.

### [Connect your Neon account](/content/docs/integrations/neon#connect-your-neon-account/index.html)

Not connected yet? Click **Connect Neon**. Your browser opens to authorize Dyad via OAuth.

Only you can access your Neon resources through Dyad. Your access token is securely stored locally on your computer.

Once authorized, you're redirected back to Dyad and the connection is complete.

### [Choose or create a project](/content/docs/integrations/neon#choose-or-create-a-project/index.html)

Pick an existing Neon project for your app, or create a new one. You _can_ reuse one project across apps, but a separate project per app is simpler and safer.

### [Choose a branch](/content/docs/integrations/neon#choose-a-branch/index.html)

Next, pick which branch your app should use:

- **Use development database** (recommended): Develops against an isolated branch so your changes never affect live data. This is the safest option, but it means you'll need to run a **migration** step later to copy your schema to production before deploying.
- **Separate production database**: Uses the production branch directly. Faster, with no migration step needed, but development changes affect live data.

The development branch is recommended for most apps. Just remember that you'll have to migrate your schema to production when it's time to deploy.

### [(Optional) Enable required email verification](/content/docs/integrations/neon#optional-enable-required-email-verification/index.html)

Using Neon Auth? You can require users to verify their email on sign-up. Toggle it in your project settings for an extra layer of verification.

## [Development](/content/docs/integrations/neon#development/index.html)

Setup done. Now just keep chatting. Dyad handles your schema, queries, and auth using Neon.

On the **development** branch, every change stays isolated from production, so you can iterate freely. Open the Neon Console anytime to inspect tables and data.

## [Time to deploy](/content/docs/integrations/neon#time-to-deploy/index.html)

When your app is ready to go live, follow these steps.

### [If you chose the development branch](/content/docs/integrations/neon#if-you-chose-the-development-branch/index.html)

1. Open the **Publish** panel.
2. Choose which branch to deploy. It's recommended to choose **production**.
3. For production, click **Migrate to Production**. This copies your schema from the development branch to production so the live database matches what you built.

Make sure you have database backups enabled before migrating, otherwise the migration can't be undone.

### [If you chose the production branch](/content/docs/integrations/neon#if-you-chose-the-production-branch/index.html)

No migration needed. Your app is already on the production branch, so it deploys directly.

### [Publish your app](/content/docs/integrations/neon#publish-your-app/index.html)

Publish your app by following the steps in the [Publishing your app](/content/docs/getting-started/publishing-your-app/index.html) guide. During publishing:

- Your **environment variables will be injected automatically** into Vercel.
- Your deployment **domain will be added to Neon's auth redirect allowlist** automatically.

Once that's done, your app is deployed and fully functional. 🎉

## [Keeping Vercel in sync](/content/docs/integrations/neon#keeping-vercel-in-sync/index.html)

When you later **change an environment variable** or **switch the deployment branch**, click **Sync to Vercel** in the Database section. It pushes your database env vars to Vercel and adds your deployment domain to Neon's auth redirect allowlist.

After syncing, a **redeployment is still required** for your live app to pick up the new configuration.
