Registry / database / effect-db

effect-db

JSON →
library0.19.0jsnpmunverified

effect-db (v0.19.0) is a Postgres schema tooling library and CLI for the Effect ecosystem. It provides a migration-based workflow with push, pull, and migrate commands, and focuses on managing canonical table and enum declarations. Unlike Prisma or Kysely, it is fully integrated with Effect's typed functional programming paradigm, requiring @effect/cli, @effect/platform, @effect/sql, and effect as peer dependencies. It supports TypeScript 6.x and Bun >=1.3.5.

npm install effect-db
INSTALL
IMPORT
SIG · EFFECT-DB
E
effect-db
databasejavascriptv0.19.0
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.

defineConfig
import { defineConfig } from 'effect-db'
const { defineConfig } = require('effect-db')
ESM-only package; CommonJS require is not supported.
effectdb (CLI binary)
bunx effectdb push
npx effectdb push
The CLI is designed for Bun. Using npx may fail if dependencies are not resolved correctly.
ConfigFile
import type { ConfigFile } from 'effect-db'
Type import for TypeScript; available for type-checking your config.

Creates a config file for effect-db. Run `bunx effectdb push` to apply schema changes to Postgres.

// effectdb.config.ts import { defineConfig } from "effect-db" export default defineConfig({ dialect: "postgres", db: { url: process.env.DATABASE_URL ?? "postgres://user:pass@localhost:5432/mydb" }, source: { include: ["src/**/*.ts"] }, migrations: { dir: "migrations", table: "effect_qb_migrations" }, safety: { nonDestructiveDefault: true } })
Debug
Known issues
gotchaThe CLI binary is only available via Bun; using npx may cause resolution failures.
fix
Use `bunx effectdb` or install globally with `bun install -g effect-db`.
affects: >=0.0.0
gotchaeffect-db manages only tables and enums; views, triggers, stored procedures, functions, policies, grants, extensions are not owned and will not be pulled/pushed.
fix
Manage those objects outside the effectdb loop, e.g., with separate SQL scripts.
affects: >=0.0.0
breakingPeer dependencies require TypeScript ^6.0.2; TypeScript 5.x is not supported.
fix
Upgrade TypeScript to version >=6.0.2.
affects: >=0.19.0
gotchaThe `--allow-destructive` flag must be used explicitly to apply destructive changes; without it, push will fail.
fix
Use `effectdb push --allow-destructive` after verifying backup.
affects: >=0.0.0
gotchaMigration rollback with `down` only replays known migration history; it does not reconstruct data removed by push.
fix
Prefer restoring from backup after a destructive push.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module 'effect-db'
Package not installed or not correctly resolved.
fix
Install: `bun add effect-db`
error: Unknown binary: effectdb
Using npx instead of bunx.
fix
Use `bunx effectdb`.
TypeError: defineConfig is not a function
Attempted to import via CommonJS require.
fix
Use `import { defineConfig } from 'effect-db'` (ESM).
Upgrade
Version history
0.19.0latest on npm
Audit
Dependencies
effectrequiredCore Effect library for effectful computation
@effect/clirequiredCLI framework used by the effectdb binary
@effect/platformrequiredPlatform abstractions for Effect
@effect/platform-bunrequiredBun-specific platform bindings
@effect/sqlrequiredSQL toolkit for Effect
@effect/sql-pgrequiredPostgres driver for Effect SQL
typescriptrequiredTypeScript peer dependency (v6.0.2+)
Agent activity
7 hits · last 30 days
node
6
Resources
effect-db — npm install effect-db · libregistry