Compare
Stratum + Drizzle
Lightweight TypeScript ORM with SQL-like syntax
Drizzle ORM is a lightweight, SQL-first TypeScript ORM. Its thin abstraction over SQL makes it a natural fit for Stratum's PostgreSQL-native features. Drizzle handles your schema and queries. Stratum handles tenant hierarchy, config, isolation, and compliance — both operating on the same database without conflicts.
Feature comparison
| Capability | Drizzle | Stratum |
|---|---|---|
| Schema management | Drizzle Kit (push/migrate) | Stratum manages tenant tables only |
| RLS isolation | Manual via sql`` template | Automatic policy generation |
| Schema-per-tenant | Schema parameter in table definitions | Automatic search_path switching |
| Raw SQL access | First-class — sql`` tagged templates | Uses pg Pool directly |
| Config inheritance | Not available | Built-in, root-to-leaf resolution |
| Audit logging | Build it yourself | Every mutation, actor-attributed |
| Connection overhead | Shares pg Pool | Shares pg Pool |
| Bundle size | Minimal (~30KB) | Minimal — no heavy dependencies |
Getting started
drizzle-with-stratum.ts
import { drizzle } from "drizzle-orm/node-postgres"; import { Pool } from "pg"; import { Stratum } from "@stratum-hq/lib"; // Shared connection pool const pool = new Pool(); // Drizzle for app queries const db = drizzle(pool); // Stratum for tenancy — same pool const stratum = new Stratum({ pool }); await stratum.initialize(); // Both use the same PostgreSQL connection const tenant = await stratum.createTenant({ name: "Acme", slug: "acme" });
Things to know
- Drizzle and Stratum share a pg Pool — set pool max connections to account for both.
- Drizzle's schema-aware table definitions work well with Stratum's schema-per-tenant mode.
Start building with Drizzle + Stratum
npm install @stratum-hq/lib pg