Skip to content

Use any ORM

Sypnia Data is plain Postgres. Use plain SQL, Prisma, Drizzle, Sypnorm or nothing at all, and mix them.

Applies to EngineCloud
View as Markdown
On this page
  1. Plain SQL
  2. Prisma or Drizzle
  3. Sypnorm, with Cases

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.

OptionTalks to Sypnia Data throughGood for
@sypnia/data/clientthe Data API, with the person’s token, under row-level securityapps in a browser or a phone, with no server of your own
Plain SQL/sql/v1 with a secret key, or a direct connectionservers, reports, migrations
Prismaa direct connectionteams that already use it
Drizzlea direct connectiontyped SQL close to the database
Sypnormthe Data API or a direct connectionwriting the app as use cases; it comes with Sypnia Cases

Plain SQL

TypeScript
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).

Terminal
DATABASE_URL="postgres://<user>:<password>@<host>:5432/postgres" npx prisma db pull

Migrations 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).

  1. Plain SQL
  2. Prisma or Drizzle
  3. Sypnorm, with Cases

    Search pages, sections and terms