TalaDB
raw JSON → 0.7.10 verified Mon Apr 27 auth: no javascript
TalaDB is a local-first document and vector database for React, React Native, and Node.js, powered by a Rust/WASM core with zero GC pauses. Current stable version is 0.7.10, released with regular weekly patches. It provides a MongoDB-style document API that runs entirely on-device: in the browser via WASM + OPFS, in React Native via JSI, and in Node.js via a native module. Key differentiators include built-in vector search, offline-first architecture, no cloud dependency, and automatic platform detection with platform-specific backend packages (@taladb/web, @taladb/node, @taladb/react-native). Ships TypeScript types and requires Node >=18.
Common errors
error Cannot find module '@taladb/web' (or '@taladb/node', '@taladb/react-native') ↓
cause Platform-specific backend package not installed alongside taladb.
fix
Install the appropriate package: npm install @taladb/web (for browser), @taladb/node (for Node.js), or @taladb/react-native (for React Native).
error require() of ES Module taladb from not supported ↓
cause Using CommonJS require() to import an ESM-only package.
fix
Convert to ES modules: use import statements and set 'type': 'module' in your package.json, or use dynamic import() inside a CommonJS file.
error Error: This constructor is no longer supported. Use openDB() instead. ↓
cause Using the deprecated new Database() constructor removed in v0.6.0.
fix
Replace with: const db = await openDB('name');
Warnings
gotcha Must install the appropriate platform-specific backend package (@taladb/web, @taladb/node, or @taladb/react-native) in addition to taladb. ↓
fix Install both: pnpm add taladb @taladb/web (for browser), or pnpm add taladb @taladb/node (for Node).
breaking Node.js >=18 is required. Earlier versions will fail to load the native module. ↓
fix Upgrade Node.js to version 18 or later.
gotcha The package is ESM-only; CommonJS require() will throw an error. ↓
fix Use import syntax or dynamic import() in Node.js with type: 'module' in package.json.
deprecated The old API using 'new Database()' constructor was removed in v0.6.0. Use openDB() instead. ↓
fix Replace 'new Database()' with 'await openDB()'.
Install
npm install taladb yarn add taladb pnpm add taladb Imports
- openDB wrong
import openDB from 'taladb'correctimport { openDB } from 'taladb' - runMigrations wrong
const runMigrations = require('taladb').runMigrationscorrectimport { runMigrations } from 'taladb' - type Collection wrong
import { Collection } from 'taladb'correctimport type { Collection } from 'taladb' - TalaDB
import type { TalaDB } from 'taladb'
Quickstart
import { openDB, runMigrations } from 'taladb';
async function main() {
const db = await openDB('quickstart.db');
// Run migrations
await runMigrations(db, [
{
fromVersion: 0,
toVersion: 1,
description: 'add default role',
async up(col) {
await col('users').updateMany({}, { $set: { role: 'viewer' } });
},
},
]);
const users = db.collection('users');
// Create index
await users.createIndex('email');
// Insert
const id = await users.insert({ name: 'Alice', email: 'alice@example.com', age: 30 });
console.log('Inserted with id:', id);
// Find one
const alice = await users.findOne({ email: 'alice@example.com' });
console.log('Found:', alice);
// Update
await users.updateOne({ email: 'alice@example.com' }, { $inc: { age: 1 } });
// Find all adults
const adults = await users.find({ age: { $gte: 18 } });
console.log('Adults:', adults);
await db.close();
}
main().catch(console.error);