Registry / database / sqlfu
library0.0.3-15jsnpmunverified

SQL-first toolkit for SQLite (v0.0.3-15, pre-release, active development). Provides a client, migrator, diff engine, TypeScript type generator, formatter, and admin UI. Designed for teams who prefer SQL as the source of truth over ORM abstractions. Key differentiators: SQL files as schema and migrations, TypeScript generation from .sql queries, agent-friendly tooling, and an admin UI. Requires Node >=22 and peer deps @effect/sql, effect, better-auth, and @sqlfu/ui. Rolling releases with high churn; breaking changes expected.

npm install sqlfu
INSTALL
IMPORT
SIG · SQLFU
S
sqlfu
databasejavascriptv0.0.3-15
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.

Client
import { Client } from 'sqlfu'
const Client = require('sqlfu')
ESM-only package (Node>=22). CommonJS require will fail.
createClient
import { createClient } from 'sqlfu'
import { createClient } from 'sqlfu/client'
createClient is exported from the root package, not a subpath.
draftMigration
import { draftMigration } from 'sqlfu'
import { draftMigration } from 'sqlfu/migrator'
All public APIs are re-exported from the main 'sqlfu' entry point.
typegen
import { typegen } from 'sqlfu'
Returns an Effect that processes .sql files. Use with Effect.runSync or runPromise.

Creates a SQLite client, runs queries, and demonstrates type generation from SQL files.

import { createClient, typegen } from 'sqlfu' import { SqliteClient } from '@effect/sql-sqlite-node' // Create a client using @effect/sql's SqliteClient const sqlite = SqliteClient.make({ filename: ':memory:', }) // Create a sqlfu client wrapper const client = createClient(sqlite) // Run a raw SQL query const rows = await client.query('SELECT 1 AS value') console.log(rows) // [{ value: 1 }] // Type generation from .sql files // Assumes you have a 'sql/my-query.sql' file const genResult = await typegen({ sourceDir: './sql', })() console.log(genResult) // Generated TypeScript types // Existing client operations await client.execute('CREATE TABLE test (id INTEGER PRIMARY KEY)') await client.execute('INSERT INTO test VALUES (1)') const result = await client.query('SELECT * FROM test') console.log(result) // [{ id: 1 }]
Debug
Known issues
breakingAPI surface is unstable (pre-release v0.0.x). Breaking changes occur frequently without deprecation warnings.
fix
Pin to exact version and follow changelog on GitHub.
affects: >=0.0.0
breakingPeer dependency @effect/sql must be exactly ^0.51.1 or compatible range. Incompatible versions cause runtime errors in query execution.
fix
Ensure package.json includes @effect/sql@^0.51.1.
affects: >=0.0.0
breakingRequires Node >=22 (ESM only). CommonJS projects cannot import this package.
fix
Use Node 22+ with ESM (type:module in package.json or .mjs files).
affects: >=0.0.0
breakingAdmin UI requires better-auth and @sqlfu/ui as peer deps. Skipping them causes missing peer warnings and potential runtime errors.
fix
Install all peer deps: npm install @effect/sql better-auth @sqlfu/ui
affects: >=0.0.0
deprecatedThe experimental outbox pattern may be removed or reworked in future versions.
fix
Avoid reliance on outbox feature for production usage.
affects: >=0.0.0
Errors
Common errors & fixes
Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'sqlfu'
Package is ESM-only but project is using CommonJS (require) or Node version <22.
fix
Switch to ESM (type:module in package.json) and upgrade Node to 22+.
Cannot find module '@effect/sql' or 'effect'
Missing peer dependencies.
fix
Run npm install @effect/sql@^0.51.1 effect@^3.21.2
TypeError: client.query is not a function
Client created with adapter factory but adapter not properly wrapped.
fix
Use createClient(yourDatabaseAdapter) where yourDatabaseAdapter matches the @effect/sql interface.
Error [ERR_REQUIRE_ESM]: require() of ES Module not supported
Using CommonJS require() to import sqlfu which is ESM-only.
fix
Use dynamic import() or switch project to ESM.
Upgrade
Version history
0.0.3-15latest on npm
Audit
Dependencies
@effect/sqlrequiredRuntime client for SQLite connections and queries.
effectrequiredEffect-TS ecosystem for typed errors, observability, and outbox pattern.
better-authoptionalAuthentication for the admin UI.
@sqlfu/uioptionalAdmin UI package for browser-based inspection.
Agent activity
15 hits · last 30 days
node
12
Meta
2
OpenAI (training)
1
Resources
packagesqlfu
sqlfu — npm install sqlfu · libregistry