---
title: Deploy Deno KV with AI on Blossom
url: "/deploy/deno-kv/"
canonical_url: https://blossom88.com/deploy/deno-kv/
markdown_url: https://blossom88.com/deploy/deno-kv.md
summary: Give a Deno app a private key-value store and keep its records across Container
  updates.
categories:
- deployment
- database
- deno
stack:
- Deno
- TypeScript
- Rust
- SQLite
---

# Deploy Deno KV with AI on Blossom

[Deno KV](https://github.com/denoland/denokv) lets a Deno app store values
with `Deno.openKv`. Use a workshop inventory record to try the remote
API.

## Ask Your Agent

> **Ask your AI agent:** Deploy Deno KV on Blossom. Help me save and reopen a sample record from my Deno app.
>
> Follow this guide: https://blossom88.com/deploy/deno-kv/

[Install the Blossom CLI and skill](https://docs.blossom88.com/learn/getting-started/install/) on your agent's machine and [choose a Location in your cloud account](https://docs.blossom88.com/learn/getting-started/choose-your-cloud/#blossom-byoc).

## How It Runs

| Part | Role | Where |
|---|---|---|
| Deno KV | Serve the authenticated key-value API | Private Persistent Service |
| Volume | Keep SQLite data across Container replacement | Mounted at /data |
| Deno client | Read and write sample records on the private network | Client Service in the same Environment |

## Deploy a Private Deno KV Service

Mount a Volume at `/data` and keep the Service private. Give your client
Service a stable access token and the KV Service's internal hostname.

<details class="optional-reading" markdown="1">
<summary>Notes for your agent</summary>

Use the official Deno KV image on port 4512 and set
`DENO_KV_SQLITE_PATH=/data/denokv.sqlite`. Store a random
`DENO_KV_ACCESS_TOKEN` as a private variable shared by the KV Service and
the client. Use a TCP health check. Find the actual internal hostname
before running the client commands.

</details>

<details class="optional-reading" markdown="1">
<summary>Commands your agent runs</summary>

    blossom app_plan:preview --data deno-kv-plan.yml
    blossom service:create --data deno-kv-service.yml
    blossom env_var:push --environment environment-100 --file deno-kv.env
    blossom environment:deploy --id environment-100 --follow

</details>

<details class="optional-reading" markdown="1">
<summary>Run the sample client</summary>

Save the [sample client](/deploy/recipes/deno-kv/demo-kv.ts) in your
client Service. Run these commands on the private network and replace
`kv.internal` with the Service's actual hostname.

    deno run --unstable-kv --allow-net=kv.internal:4512 --allow-env=DENO_KV_ACCESS_TOKEN demo-kv.ts http://kv.internal:4512 write
    deno run --unstable-kv --allow-net=kv.internal:4512 --allow-env=DENO_KV_ACCESS_TOKEN demo-kv.ts http://kv.internal:4512 read

</details>

## Save and Reopen a Record

Write the workshop inventory, then run the read command from a fresh
client session. Confirm that both responses have the same value and
versionstamp.

![Save the workshop inventory and see its versionstamp.](/deploy/assets/images/deno-kv/deno-kv-record-written.webp)

> **Ask your AI agent:** Write a sample inventory record to Deno KV, then use a fresh client session to read the value and its versionstamp.

> Follow this guide: https://blossom88.com/deploy/deno-kv/



## Try It After an Update

Keep the Volume and access token across updates. Replace the KV
Container and run the read command again. The same versionstamp tells
you that the client found the original record.

![Read the same record after the Container is replaced.](/deploy/assets/images/deno-kv/deno-kv-record-reopened.webp)


> **Ask your AI agent:** Replace the Deno KV Container. Read the workshop record again and compare its value and versionstamp.

> Follow this guide: https://blossom88.com/deploy/deno-kv/



## What You Get

- A Deno KV endpoint on your private Environment network
- A structured record read through Deno.openKv
- The same record and versionstamp after a Container update

Tested on Blossom: A fresh Deno client read the same value and versionstamp after replacing the KV Container on its original Volume.
