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 }]
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.
fixSwitch to ESM (type:module in package.json) and upgrade Node to 22+.
Cannot find module '@effect/sql' or 'effect'
Missing peer dependencies.
fixRun 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.
fixUse 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.
fixUse dynamic import() or switch project to ESM.
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.