Announcing Deno KV
Deno KV is a strongly consistent key-value database built into the Deno runtime. It is backed by SQLite when run locally and by FoundationDB when managed on Deno Deploy, where it is globally replicated across 35 regions. The API stores structured-serializable JavaScript values under array keys, supports prefix listing with cursor pagination, and offers atomic multi-key transactions using check-and-set. Reads are strongly consistent (serializable and linearizable) by default and can opt into eventual consistency for lower latency, for example 7ms versus 94ms in Frankfurt during the beta.
Related posts
- Deno KV internals: building a database for the modern web
Deno hardMasterDeno KV's production backend runs on FoundationDB, with a custom "transaction layer" in front of it that handles multi-tenant configuration, JavaScript-native types such as bigint sums, and cross-region replication. To keep latency low, every atomic operation is non-interactive: a single bag of versionstamp checks, set/delete writes and conflict-free mutations that completes in one or two network trips. A sequencer assigns monotonic transaction sequence numbers, and an evaluator turns each batch into a dataflow graph of AND/MUX operations and evaluates it concurrently. Results are reused speculatively before a writer commits them to FoundationDB, which raises throughput without locks.
- How to Build a CRUD API with Oak and Deno KV
Deno mediumAdeptDeno KV, a key-value database built into the Deno runtime, can back a simple CRUD API for users and addresses served by Oak's Router. The walkthrough models a secondary index on email as a separate key prefix that maps email to user ID. It uses kv.atomic() with .check() to keep the primary and index keys consistent under concurrent writes, and paginates kv.list() with limit and cursor. The code runs with the --unstable flag in Deno 1.33+ and is tested with curl.
- Use Deno KV in Node with the new official npm package
Deno mediumAdeptDeno KV is now usable from Node.js through the official @deno/kv npm package, which exposes the same API as Deno's built-in KV through a single openKv function. That function can connect to a managed Deno Deploy database backed by FoundationDB, a self-hosted denokv server, a local SQLite file, or an in-memory store for tests. Most methods are supported, including atomic, enqueue and watch, but listenQueue does not work against remote databases yet. The package targets Node 18+, has no third-party dependencies, ships platform-specific SQLite binaries built with NAPI-RS from the Rust denokv codebase, and stores values in V8's serialization format.
- Announcing self-hosted Deno KV, continuous backups, and replicas
Deno mediumAdeptDeno KV can now be self-hosted via an open-source, MIT-licensed `denokv` binary backed by SQLite and reachable from `Deno.openKv` over KV Connect. Databases hosted on Deno Deploy (backed by FoundationDB) can also stream continuous backups to S3 or GCS, and `denokv --sync-from-s3` runs a read-only local replica from those buckets. The replica keeps full mutation history, so `denokv pitr list` and `pitr checkout` give point-in-time recovery by versionstamp. Self-hosters own backups, replication and HA themselves, and Litestream or LiteFS is recommended for the SQLite file.
- Deno 1.33: Deno 2 is coming
Deno mediumAdeptDeno 1.33 ships a built-in, unstable KV database (Deno.openKv) that persists to disk locally and is geo-replicated on Deno Deploy. It also flattens the deno.json schema, drops permission checks for statically analyzable dynamic imports, and polyfills many node:crypto, node:http and node:vm APIs. Deno.run is deprecated in favour of Deno.Command, and one Deno.serve overload is removed ahead of stabilization. Deprecated std/encoding paths are deleted, with an import-map workaround for transitive dependencies. The release also adds LSP document preloading, deno bench --no-run, an unset command for deno task, and V8 11.4, all framed as steps toward Deno 2.