API reference
High-level API
Drizzle-style fluent API
The high-level API wraps the database in a Kite instance with a Drizzle-style fluent interface. Methods take the node and edge definitions from your schema.
kite()
Open a database. kite() returns a promise; kiteSync() is the synchronous version.
TypeScript
import { kite } from '@kitedb/core';const db = await kite(path, options);MVCC options
kite(), kiteSync(), and Database.open() take the same MVCC options:
| Option | Default | Description |
|---|---|---|
mvcc | true | Snapshot-isolated transactions; concurrent write transactions with conflict detection at commit |
mvccGcIntervalMs | 5000 | Milliseconds between background version-history cleanups |
mvccRetentionMs | 0 | How long to keep version history beyond what open transactions need |
mvccMaxChainDepth | 10 | Version chain depth that cleanup truncates to |
mvcc: false is deprecated and will be removed in a later release; it logs no warning. Without MVCC, write transactions run one at a time and transactions read the latest committed state instead of a snapshot. The file format is the same in both modes. See MVCC and transactions.
Node methods
TypeScript
// Create nodesdb.insert(user).values({ key: "alice", name: "Alice" }).returning()db.insert(user).valuesMany([{ key: "a" }, { key: "b" }]).execute()// Upsert by keydb.upsert(user).values({ key: "alice", email: "a@x.com" }).execute()// Readdb.get(user, "alice")db.getRef(user, "alice")// Update by key (setAll returns void, so call execute() separately)const update = db.update(user, "alice")update.setAll({ name: "Alice V2" })update.execute()// Delete by keydb.delete(user, "alice")// List / countdb.all(user)db.countNodes()db.countNodes(user)Edge methods
TypeScript
// Create edgedb.link(src, follows, dst, { since: 2024 })db.link(src).to(dst).via(follows).props({ since: 2024 }).execute()// Delete / checkdb.unlink(src, follows, dst)db.hasEdge(src, follows, dst)// Update edge propsconst edgeUpdate = db.updateEdge(src, follows, dst)edgeUpdate.setAll({ weight: 0.8 })edgeUpdate.execute()// List / countdb.allEdges()db.allEdges(follows)db.countEdges()db.countEdges(follows)Next steps
- Low-level API: direct database primitives
- Vector API: similarity search