PerSQL / Railway

PerSQL for Railway

Edge SQLite for your Railway services.

An isolated database per service, a branch per PR environment. Provision one, wire three variables with the Railway CLI, and query with the SDK.

How it works

1

Connect

Sign in and provision an isolated SQLite database in your namespace.

2

Set three vars

railway variables --set for each, or paste them under Service → Variables.

3

Query

Read the vars with @persql/sdk and run SQL. PR environments get their own branch.

Wire it up

railway variables \
  --set "PERSQL_API_URL=https://api.persql.com" \
  --set "PERSQL_DATABASE=<namespace>/<db-slug>" \
  --set "PERSQL_TOKEN=psql_live_…"
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 PR environment

Point a coding agent at the Railway MCP. preview_recipe returns the CI snippet that spawns a preview-pr-<n> branch when a PR environment opens and deletes it on close.

https://railway.persql.com/mcp

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