Registry / database / anondb

anondb

JSON →
library0.0.21jsnpmunverified

A generic database interface supporting SQLite, PostgreSQL, and IndexedDB with a unified query API. Version 0.0.21 is the current release; the library is in early development with active changes. It provides a schema-based document store with complex where clauses (AND/OR, comparison operators), ordering, and relational includes. Unlike ORMs like Sequelize or TypeORM, it offers a minimal, cross-platform abstraction that works both in Node.js and the browser via IndexedDB. Ships TypeScript types.

npm install anondb
INSTALL
IMPORT
SIG · ANONDB
A
anondb
databasejavascriptv0.0.21
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.

DB
import { DB } from 'anondb'
const DB = require('anondb')
DB is a type interface; for runtime constructors use specific connectors like SQLiteConnector or IndexedDBConnector.
SQLiteConnector
import { SQLiteConnector } from 'anondb/node'
import { SQLiteConnector } from 'anondb'
Node-specific connectors are exported from 'anondb/node' to avoid bundling in browser.
IndexedDBConnector
import { IndexedDBConnector } from 'anondb/web'
import { IndexedDBConnector } from 'anondb'
Browser-specific connector is exported from 'anondb/web'.

Creates an in-memory SQLite database with a User schema, inserts a document, and retrieves it.

import { SQLiteConnector } from 'anondb/node'; const schema = [ { name: 'User', primaryKey: 'id', rows: [ { name: 'id', type: 'String', default: () => require('nanoid').nanoid() }, { name: 'createdAt', type: 'Int', default: () => +new Date() }, ['username', 'String', { unique: true }] ] } ]; async function main() { const db = await SQLiteConnector.create(schema); const doc = await db.create('User', { username: 'Chance' }); console.log(await db.findOne('User', { where: { username: 'Chance' } })); } main().catch(console.error);
Debug
Known issues
breakingImport paths changed from top-level to subpath exports (e.g., 'anondb/node') in v0.0.15+
fix
Use 'anondb/node' for Node connectors, 'anondb/web' for IndexedDB, and 'anondb' for types only.
affects: >=0.0.15
gotchaPrimary keys are required; if not provided, the default function must return a unique value.
fix
Ensure every schema includes a primaryKey field with a unique default, e.g., using nanoid.
affects: >=0.0.1
gotchaWhere clause 'nin' operator is case-sensitive and requires an array of values.
fix
Use { field: { nin: ['value1', 'value2'] } } with exact case matches.
affects: >=0.0.1
Errors
Common errors & fixes
Cannot find module 'anondb/node'
Using a version older than 0.0.15 that didn't have subpath exports.
fix
Update anondb to >=0.0.15 (npm install anondb@latest) and use correct import paths.
SQLiteConnector.create is not a function
Importing from 'anondb' instead of 'anondb/node'.
fix
Import SQLiteConnector from 'anondb/node'.
TypeError: db.create is not a function
Using a raw connection object instead of the wrapped DB instance returned by create.
fix
Call SQLiteConnector.create(schema) or IndexedDBConnector.create(schema) to get the DB object.
Upgrade
Version history
0.0.21latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
23 hits · last 30 days
node
18
OpenAI (training)
1
Resources
packageanondb
anondb — npm install anondb · libregistry