Registry / database / allez-orm

allez-orm

JSON →
library1.2.0jsnpmunverified

Lightweight browser SQLite ORM (sql.js) with schema generator CLI. Current stable version: 1.2.0. Released weekly. Key differentiators: spec-anchored schemas (SHA-256 pinned), persistent SQLite in IndexedDB, zero server dependencies, CLI for drift detection and schema generation. Alternative to localForage or raw sql.js for client-first apps requiring real foreign keys and prepared statements.

npm install allez-orm
INSTALL
IMPORT
SIG · ALLEZ-ORM
A
allez-orm
databasejavascriptv1.2.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.

AllezORM
import { AllezORM } from 'allez-orm'
const AllezORM = require('allez-orm')
ESM-only; Node >=18 and modern browsers. Does not support CommonJS require.
usersSchema (default export)
import usersSchema from './users.schema.js'
import { usersSchema } from './users.schema.js'
Generated schema files use default export; named export will be undefined.
init
await AllezORM.init({ dbName: 'myapp.db', schemas: [] })
new AllezORM()
Factory method (async). Direct constructor is not exposed.

Initializes an in-browser SQLite database with two schemas, inserts data, and runs a JOIN query.

import { AllezORM } from 'allez-orm'; import users from './schemas/users.schema.js'; import posts from './schemas/posts.schema.js'; const orm = await AllezORM.init({ dbName: 'myapp.db', schemas: [users, posts] }); await orm.table('users').upsert({ id: 1, email: 'a@b.co', display_name: 'Ada' }); await orm.table('posts').insert({ user_id: 1, title: 'Hello world' }); const recent = await orm.query( 'SELECT u.email, p.title FROM posts p JOIN users u ON u.id = p.user_id ORDER BY p.id DESC LIMIT 10' ); console.log(recent);
Debug
Known issues
gotchaRequires Node >=18 for CLI; browser usage requires WebAssembly support (all modern browsers).
fix
Ensure Node.js version >=18, or use a polyfill for older browsers.
affects: >=1.0.0
gotchaDatabase persists in IndexedDB on write; clearing browser storage deletes all data.
fix
Implement backup/export if persistence is critical.
affects: >=1.0.0
gotchaSchemas must be passed at init; dynamic table creation after init is not supported.
fix
Predefine all tables in schema files and regenerate them with the CLI.
affects: >=1.0.0
gotchaThe 'upsert' method is not a standard SQL UPSERT; it performs INSERT OR REPLACE on conflict.
fix
Use 'insert' with ON CONFLICT handling or manually write SQL for complex upserts.
affects: >=1.0.0
gotchaGenerated schema files are SHA-256 pinned; editing them manually will trigger drift detection failures.
fix
Edit the spec JSON and regenerate schemas via 'allez-orm from-json spec.json'.
affects: >=1.0.0
Errors
Common errors & fixes
ReferenceError: AllezORM is not defined
Using CommonJS require instead of ES module import.
fix
Change 'const AllezORM = require("allez-orm")' to 'import { AllezORM } from "allez-orm"'.
SyntaxError: The requested module 'allez-orm' does not provide an export named 'default'
Trying to import default instead of named import.
fix
Use 'import { AllezORM } from "allez-orm"' instead of 'import AllezORM from "allez-orm"'.
TypeError: orm.table is not a function
Calling 'table' on an uninitialized orm object before 'init' resolves.
fix
Ensure 'await AllezORM.init(...)' completes before accessing 'orm.table().
Error: Foreign key constraint failed
Inserting a row with a foreign key referencing a non-existent parent key.
fix
Verify parent record exists before inserting child; use transactions or batch upserts.
Upgrade
Version history
1.2.0latest on npm
Audit
Dependencies
sql.jsrequiredSQLite WebAssembly engine required for database operations
Agent activity
30 hits · last 30 days
node
24
OpenAI (training)
1
Resources
allez-orm — npm install allez-orm · libregistry