PerSQL / Vercel

PerSQL for Vercel

A SQLite branch per Vercel preview.

Connect a project and PerSQL sets PERSQL_TOKEN, PERSQL_DATABASE, and PERSQL_API_URL for you across production, preview, and development. Every preview deployment spins up its own isolated branch.

How it works

1

Add to Vercel

Authorize the integration and pick the projects to connect to your PerSQL namespace.

2

Env auto-set

The three variables land on each project across production, preview, and development — nothing to paste.

3

Query

Read the vars with @persql/sdk and run SQL. Preview deployments fork their own branch.

Then query it

import { PerSQL } from "@persql/sdk";

const db = new PerSQL({
  token: process.env.PERSQL_TOKEN,
  baseURL: process.env.PERSQL_API_URL,
}).database(process.env.PERSQL_DATABASE);

const { data } = await db.query("SELECT 1 AS ok");

A database per preview deployment

Point a coding agent at the Vercel MCP. preview_recipe returns the CI snippet that spawns a preview-pr-<n> branch per preview deployment and cleans it up on close.

https://vercel.persql.com/mcp

Authenticate with a PerSQL bearer token. Tools: preview_list, preview_recipe.