Use any ORM
Sypnia Data is plain Postgres. Use plain SQL, Prisma, Drizzle, Sypnorm or nothing at all, and mix them.
On this page
Sypnia Data is the data layer: sign-in, tables, the Data API, SQL, row-level security and MCP. Your tables are ordinary Postgres tables, so the way you write your app is yours to choose. You can mix several on the same project.
| Option | Talks to Sypnia Data through | Good for |
|---|---|---|
@sypnia/data/client | the Data API, with the person’s token, under row-level security | apps in a browser or a phone, with no server of your own |
| Plain SQL | /sql/v1 with a secret key, or a direct connection | servers, reports, migrations |
| Prisma | a direct connection | teams that already use it |
| Drizzle | a direct connection | typed SQL close to the database |
| Sypnorm | the Data API or a direct connection | writing the app as use cases; it comes with Sypnia Cases |
Plain SQL
import { createClient } from '@sypnia/data/server';
const admin = createClient('https://<ref>.data.sypnia.com', { secretKey: process.env.SYPNIA_SECRET_KEY! });
const rows = await admin.sql`select id, total from orders where status = ${'paid'}`;Prisma or Drizzle
They need a direct connection: your own Postgres, or a dedicated database in Sypnia Cloud (Projects and databases). Managed shared databases have no direct connection; there, use the Data API or SQL. Put the connection string in DATABASE_URL and use the tool as you would on any Postgres (Any Postgres).
DATABASE_URL="postgres://<user>:<password>@<host>:5432/postgres" npx prisma db pullMigrations can stay with your tool, or go through npx @sypnia/data migrate (SQL and migrations); pick one so the history lives in one place.
Sypnorm, with Cases
Sypnorm is the ORM where your app is a set of use cases: who does what, with which tables, and how it can fail. It belongs to Sypnia Cases, because the use cases it derives are the code side of your Cases map. It runs on Sypnia Data, through the Data API with each person’s token or with a direct connection, and on any other Postgres. A case some other case listens to runs in its area’s service, which the app calls with the person’s session, so its event is saved with its data (Runners).
- Use cases, typed tables, runners and the map from your code.
- One Data project ↔ one Cases project, both ways.