[go: up one dir, main page]

Skip to main content
Deno 2 is finally here 🎉️
Learn more

Deno KV Beta
A Global Database for Global Apps

Read your data in milliseconds, worldwide. Enjoy seamless data consistency with ACID transactions. Develop and test locally using Deno CLI, where KV is built right in.

Setup? No thank you

Open a KV store in any Deno program with one line of code.

It doesn't matter whether your code runs locally, or in any of our data centers around the world. Deno KV works anywhere, with zero setup and zero provisioning.

A database for JavaScript

Deno KV is built for JavaScript and TypeScript. Store any JavaScript value, from strings to objects, without having to worry about serialization.

The intuitive promise-based API makes storing, retrieving, and deleting data a breeze.

const kv = await Deno.openKv();

const key = ["users", crypto.randomUUID()];
const value = { name: "Alice" };
await kv.set(key, value);

const result = await kv.get(key);
result.value; // { name: "Alice" }
Scale effortlessly

Go from a side project to an enterprise platform with zero config, zero provisioning, zero orchestration. We'll handle it.

Deno KV is built on FoundationDB, capable of handling millions of operations per second. You know what else is built on FoundationDB? iCloud, Snowflake, and more.

Transact with confidence

Deno KV writes data using ACID transactions, so you never have to worry about partial writes or inconsistent data. Even when you are mutating multiple keys at once.

Data is instantly durable once a transaction is committed, so you can be sure that your data is safe at all times.

const kv = await Deno.openKv();
const change = 10;

const bob = await kv.get(["balance", "bob"]);
const liz = await kv.get(["balance", "liz"]);
if (bob.value < change) {
  throw "not enough balance";
}

const success = await kv.atomic()
  .check(bob, liz) // balances did not change
  .set(["balance", "bob"], bob.value - change)
  .set(["balance", "liz"], liz.value + change)
  .commit();
Customizable consistency

Find the right balance between latency and consistency for your application with our customizable consistency levels. Deno KV can adapt to your unique needs, so you can focus on your users.

await kv.get(key, { consistency: "eventual" });

Read with eventual consistency from the nearest region. Reads are fast, but may return stale data.

await kv.get(key, { consistency: "strong" });

Read with strong consistency from the primary region. Reads are slower, but always return the latest data.

Watch for real-time updates

You can watch for changes to given keys in your database, which makes building real-time applications like newsfeeds, notifications, analytics and more easier than before.

const db = await Deno.openKv();

for await (const entries of db.watch([["foo"]])) {
  entries[0].key; // ["foo"]
  entries[0].value; // "bar"
  entries[0].versionstamp; // "0100001dc33546270000"
}
Access Deno KV anywhere

Use Deno KV how you like with the standalone open source binary and ability to remotely connect to any Deno KV instance. There's even an official npm module so you can access it in Node.

import { openKv } from "@deno/kv";

Use Deno KV in Node with our official @deno/kv npm module.

const kv = await openKv(<KV Connect URL>);

Connect remotely to any KV instance.

Streamlined local development

Developing locally and deploying to production is simple with KV on Deno CLI. Backed by SQLite, KV on Deno CLI ensures consistency and durability during local development.

Don't want to use Deno Deploy? Deno KV works on any VPS, so you can deploy to your favorite cloud hosting service.

Docs
Examples
Multi-player Tic-Tac-Toe
  • GitHub authentication
  • Saved user state
  • Real-time sync using BroadcastChannel

SourceLive preview

Pixelpage
  • Persistent canvas state
  • Multi-user collaboration
  • Real-time sync using BroadcastChannel

SourceLive preview

Todo
  • Zod schema validation
  • Built using Fresh
  • Real-time collaboration using BroadcastChannel

SourceLive preview

KV Pricing

Get started for free with everything you need to launch your project in just a few clicks

  • Free

    • KV storage:
      1 GiB
    • KV read units/mo (4KiB):
      450,000
    • KV write units/mo (1KiB):
      300,000
    • Number of DB regions:
      1
    • Select your write region:
      No
  • Pro

    • KV storage:
      5 GB (then $0.75/GiB)
    • KV read units/mo (4KiB):
      1,300,000 (then $1/M)
    • KV write units/mo (1KiB):
      900,000 (then $2.50/M)
    • Number of DB regions:
      Custom
    • Select your write region:
      No
  • Enterprise

    • KV storage:
      Custom
    • KV read units/mo (4KiB):
      Custom
    • KV write units/mo (1KiB):
      Custom
    • Number of DB regions:
      Custom
    • Select your write region:
      Yes
All pricing info
Get Started

Turbocharge App Development with the Next-Gen Serverless Database