A minimal Node web service backed by an isolated PerSQL SQLite database. Each page load writes a row and reads the count — that round trip is the whole integration.
-
Get a database. Visit railway.persql.com/connect, sign in, and provision a database. You'll get three values:
Var What PERSQL_API_URLhttps://api.persql.comPERSQL_DATABASE<namespace>/<db-slug>PERSQL_TOKENa token scoped to that one database -
Deploy. Click the button above. Railway prompts for
PERSQL_DATABASEandPERSQL_TOKEN— paste the values from step 1 (PERSQL_API_URLis pre-filled). Prefer the dashboard? New Project → Deploy from GitHub repo →persql/railway-starterworks too;railway.jsonpins the build, start command, and healthcheck. -
Open the service URL. The visit counter increments on each refresh.
import { PerSQL } from "@persql/sdk";
const db = new PerSQL({
token: process.env.PERSQL_TOKEN,
baseURL: process.env.PERSQL_API_URL, // defaults to https://api.persql.com
}).database(process.env.PERSQL_DATABASE); // "namespace/db-slug"
await db.query("SELECT count(*) AS n FROM visits");See server.js for the full example and
docs.persql.com/integrations/railway
for the integration guide, including per-PR preview databases.
PerSQL is usage-metered against a prepaid balance — no per-database fee. A schema-only database that you don't query costs effectively nothing; you pay for the requests, rows, and storage you actually use.