DB0 is a lightweight SQL connector for Node.js and edge environments, currently at version 0.3.4 (early development). It provides a unified query API over multiple SQL databases (SQLite, PostgreSQL via PGlite, MySQL, and LibSQL) and integrates with ORMs like Drizzle ORM. Unlike full ORMs or heavy query builders, DB0 focuses on a minimal API surface for direct SQL execution, making it suitable for serverless, edge, and framework-agnostic applications. The library is developed by unjs and supports both CommonJS and ESM but defaults to ESM. Key differentiators: zero dependencies, TypeScript-first, and connector-based architecture that allows swapping backends without changing application code.
npm install db0No compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a SQLite database using the sqlite connector and runs a simple query and a parameterized query.
Use exact version in package.json (e.g., "db0": "0.3.4") and lock file.
Use import statements or dynamic import() instead.
Always use the full subpath import for connectors.
Call db.close() when the database is no longer needed, e.g., in a finally block or after serverless function completion.
Install the required connector package (e.g., 'npm install better-sqlite3' for sqlite connector).
Change to import statement or use dynamic import().
Install the missing connector: npm install better-sqlite3
Use: import { createDatabase } from 'db0'Verify the path: 'db0/connectors/sqlite' (note: sqlite, not sqlite3).