One database. Everywhere your app runs.

An embedded document and vector database with a Rust core,

for browser, server and mobile apps.

Documentation · Get started · Web demo · Changelog

TalaDB stores JSON documents and their vector embeddings in one embedded engine. You query them with MongoDB-style filters, secondary indexes, and vector, full-text and hybrid search, all inside your app process. There is no server to run and no cloud round-trip. The same Rust core runs in the browser, on Node.js, and in React Native, Android, iOS and macOS apps.

Browser example. Node.js uses @taladb/node and React Native uses @taladb/react-native with the same code. Kotlin, Swift and Rust are covered under Platforms.

pnpm add taladb @taladb/web
js
import { openDB } from 'taladb'

const db = await openDB('app.db') // OPFS in the browser, a file elsewhere
const articles = db.collection('articles')

await articles.createVectorIndex('embedding', { dimensions: 384 })
await articles.insert({
  title: 'How to reset your password',
  locale: 'en',
  embedding: await embed('How to reset your password'), // any embedding model
})

// Structured query
const english = await articles.find({ locale: 'en' })

// Filter on metadata first, then rank the matches by similarity
const similar = await articles.findNearest('embedding', await embed('forgot my login'), 5, {
  locale: 'en',
})

Browser apps also need a small bundler setup (cross-origin isolation headers for the OPFS worker). See the browser guide.

Each platform has a thin binding over the taladb crate: WebAssembly in the browser, napi-rs on Node.js, and the C FFI behind React Native (JSI), Kotlin (JNI) and Swift. Filters, indexes and search behave the same everywhere. Storage and API style follow each platform's conventions. More in Introduction.

  • Documents and queries. Collections of JSON documents with MongoDB-stylefilters ,updates ,aggregation and secondary indexes picked by the

query planner.

  • Vector search. Exact k-NN (cosine, dot, euclidean) by default, optional HNSW, and

metadata filters applied before ranking. Seevector search .

  • Full-text and hybrid search. BM25 ranking withsearchText , andhybridSearch that fuses keyword and vector rankings with reciprocal rank fusion. Seesearch .
  • Transactions and persistence. ACID writes onredb .

Optional AES-GCM-256encryption at rest .

filter, and version your data withmigrations that run on open.

  • Change webhook. TalaDB does not replicate. If your backend needs to hear about

local writes, awebhook can send each committed change (JavaScript runtimes).

| Platform | Package | Binding | Guide | |---|---|---|---| | Browser | taladb +@taladb/web | WebAssembly in a worker; OPFS, IndexedDB fallback | Browser | | Node.js | taladb +@taladb/node | napi-rs native module | Node.js | | React Native | taladb +@taladb/react-native | JSI over the C FFI | React Native | | Android (Kotlin) | dev.taladb:taladb-android (taladb-kotlin ) | JNI over the C FFI | Android | | iOS & macOS (Swift) | taladb-swift via SwiftPM | C FFI | Swift | | Rust | taladb | The engine crate | Rust |

React apps can add @taladb/react for hooks (guide). @taladb/node ships prebuilt binaries for linux-x64, darwin-arm64 and win32-x64.

Install commands for native apps

Android (Kotlin), minSdk 24, Kotlin 2.2+:

dependencies {
    implementation("dev.taladb:taladb-android:0.2.3")
}

iOS & macOS (Swift), iOS 13+ / macOS 10.15+, Swift 5.9+:

.package(url: "https://github.com/taladb/taladb-swift", from: "0.2.3")
// target dependency: .product(name: "TalaDB", package: "taladb-swift")

Rust, 1.90+:

cargo add taladb

You need Rust 1.90+ (the repo pins its toolchain in rust-toolchain.toml), Node.js 18+, pnpm 9+ and wasm-pack.

pnpm install
pnpm build              # every package
cargo test --workspace  # Rust tests
pnpm docs:dev           # docs site at http://localhost:5173

CONTRIBUTING.md has the full workflow, including the browser (WASM) tests and the Node.js native build.

Bug reports, pull requests and feedback are welcome. Please open an issue before starting a large feature or an architectural change.

Dual-licensed under either of

at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project shall be dual-licensed as above, without any additional terms or conditions.

原文来源:github.com