On this page

Use the tools you already have

Client libraries, tools and code made for the open-source Postgres backend stack work with StitchDB: change the project URL and keys.

A StitchDB project speaks the same protocols as the open-source Postgres backend stack: the REST API generated from your schema (PostgREST), the Auth API, the Storage API, Realtime channels and Deno Edge Functions, with the same paths, headers, JWT roles and error formats. Libraries, UI kits, templates and tools written for that stack keep working: point them at your project and use its keys.

#What to change

SettingUse
Project URLhttps://<project-ref>.p.stitchdb.com (Settings › API)
Public keyThe anon key: a JWT with the anon role, for browsers and mobile apps
Secret keyThe service_role key, for servers only: it bypasses Row Level Security
JWT secretFor servers that verify user access tokens themselves (Settings › API)
DatabaseThe connection string from Settings › Database: port 5432 (session) or 6543 (transaction pooling), TLS required. See Connect to Postgres

Most apps keep these in environment variables, so the switch is a change of two or three values, no code change.

.env
# before
API_URL=https://<old-project>.example.co
ANON_KEY=eyJhbGciOi...
# after
API_URL=https://<project-ref>.p.stitchdb.com
ANON_KEY=<the anon key from Settings › API>

#What works unchanged

KindDetails
Client librariesLibraries for this stack in JavaScript, Python, Dart/Flutter, Swift, Kotlin and C# talk to the same /rest/v1, /auth/v1, /storage/v1, /realtime/v1 and /functions/v1 paths. Our own SDKs have the same methods and add StitchDB features.
REST queriesFilters, embedding related tables, upserts, Prefer headers, ranges, CSV, RPC calls and exposed schemas. See Querying.
AuthSign-up and sign-in with passwords, magic links and codes, OAuth providers, phone, anonymous and Web3 sign-ins, MFA, the access token claims (sub, role, app_metadata), refresh tokens and Auth hooks. Ready-made sign-in UI components work too.
Row Level SecurityPolicies with auth.uid(), auth.jwt() and auth.role(), and the anon, authenticated and service_role roles.
StorageBuckets, uploads and downloads, public and signed URLs, image transformations, and access policies on storage.objects.
RealtimePostgres changes, broadcast and presence over the same channel protocol, with RLS on private channels.
Edge FunctionsDeno functions with Deno.serve deploy as they are. Functions get the project URL and keys both as STITCHDB_* variables and under the names this stack uses, so existing code that reads them keeps working. See Environment and secrets.
Postgres toolspsql, pg_dump, ORMs and migration tools (Prisma, Drizzle, Kysely, Flyway, Liquibase, Alembic), GUI clients and BI tools connect like to any Postgres.
Extensionspg_cron, pg_net, pgmq, vector, postgis, pg_trgm, Vault and many more under the same names.
Generated typesTypeScript types in the same shape: stitchdb types or Typed clients.

#What is different

  • The platform's own APIs. Tools that manage projects through another platform's management API, CLI or dashboard integrations (creating projects, deploying functions, branching) need the StitchDB equivalents: the StitchDB CLI and the Management API.
  • Project URLs look like https://<project-ref>.p.stitchdb.com. A tool that checks the URL against another platform's domain needs its URL check relaxed, or a custom domain.
  • No S3-compatible storage endpoint. Use the Storage API (all client libraries do).
  • Function secrets and provider keys are not shared between platforms: set them again under Edge Functions › Secrets and Authentication › Providers.
  • Limits follow your StitchDB plan. See Plans and limits.

#Check it in a minute

With the new URL and anon key, these return your data and the Auth settings:

Terminal
curl "https://<project-ref>.p.stitchdb.com/rest/v1/<table>?select=*&limit=1" \
  -H "apikey: <anon key>" -H "Authorization: Bearer <anon key>"
curl "https://<project-ref>.p.stitchdb.com/auth/v1/settings" -H "apikey: <anon key>"

Something written for this stack does not work on StitchDB? Tell support: it is treated as a bug.