Registry / database / relq
library1.0.127jsnpmunverified

Relq is a type-safe TypeScript ORM supporting 14 SQL dialects including PostgreSQL, MySQL, MariaDB, Supabase, Neon, PlanetScale, and CockroachDB. Current stable version is 1.0.127, with active development and release cadence of ~weekly patches. Key differentiator: fully inferred types without code generation — schema defined in TypeScript yields compile-time column names, join shapes, and return types. Requires Node.js >=22.0.0 and a database driver like pg or mysql2. Works across Node.js, Bun, Deno, and edge runtimes with zero runtime dependencies beyond the driver. Companion packages @relq/kit (migrations, CLI) and @relq/zod (Zod validators) are available separately.

npm install relq
INSTALL
IMPORT
SIG · RELQ
R
relq
databasejavascriptv1.0.127
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

createDatabase
import { createDatabase } from '@relq/orm'
import { createDatabase } from 'relq'
Package is scoped under @relq/orm. 'relq' on npm is a different package.
table
import { table } from '@relq/orm'
Used to define schema tables in TypeScript.
sql
import { sql } from '@relq/orm'
import sql from '@relq/orm'
sql is a named export, not default.

Quickstart: initialize a PostgreSQL database, define a users table, insert a row, and select all rows.

import { createDatabase, table, text, integer, sql } from '@relq/orm' const db = createDatabase({ connection: { host: process.env.DB_HOST ?? 'localhost', port: Number(process.env.DB_PORT) || 5432, user: process.env.DB_USER ?? 'postgres', password: process.env.DB_PASSWORD ?? '', database: process.env.DB_NAME ?? 'mydb', }, dialect: 'postgresql', }) const users = table('users', { id: integer().primaryKey(), name: text(), email: text().unique(), }) async function main() { await db.query(users.insert({ name: 'Alice', email: 'alice@example.com' })) const allUsers = await db.query(users.select().orderBy('id')) console.log(allUsers) } main().catch(console.error)
Debug
Known issues
breakingNode.js >=22.0.0 required — older versions will fail with syntax errors or runtime errors.
fix
Update Node.js to 22+ or use an older version of the package if available.
affects: >=1.0.0
gotchaThe dialect must be specified explicitly; no auto-detection from connection string.
fix
Set the 'dialect' option to one of: 'postgresql', 'mysql', 'mariadb', 'supabase', 'neon', 'planetscale', etc.
affects: >=1.0.0
deprecatedThe `@relq/orm` package was previously named `relq` — the old package is deprecated and may contain breaking differences.
fix
Migrate to @relq/orm and follow the new API in the docs.
affects: <1.0.0
gotchaZod integration requires separate install of @relq/zod and zod; not bundled.
fix
Run npm install @relq/zod zod to use Zod validators from schema.
affects: >=1.0.0
gotchaConnection pooling is not built-in; reuse connection config for pooling via driver.
fix
Configure connection pooling via the driver (e.g., pg.Pool) and pass pool config to createDatabase.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module '@relq/orm'
Package not installed or wrong scope name.
fix
Run npm install @relq/orm
TypeError: createDatabase is not a function
Importing from 'relq' (unscoped) instead of '@relq/orm'.
fix
Use import { createDatabase } from '@relq/orm'
Error: Unsupported dialect: ''
Dialect not provided or empty string.
fix
Set dialect: 'postgresql' or another supported dialect.
Upgrade
Version history
1.0.127latest on npm
Audit
Dependencies
pgoptionalRequired for PostgreSQL connections — peer dependency, install separately.
mysql2optionalRequired for MySQL/MariaDB connections — peer dependency, install separately.
Agent activity
4 hits · last 30 days
node
4
Resources
packagerelq
relq — npm install relq · libregistry