惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Palo Alto Networks Blog
P
Proofpoint News Feed
GbyAI
GbyAI
Microsoft Azure Blog
Microsoft Azure Blog
B
Blog
Google DeepMind News
Google DeepMind News
N
Netflix TechBlog - Medium
Recorded Future
Recorded Future
M
MIT News - Artificial intelligence
罗磊的独立博客
J
Java Code Geeks
月光博客
月光博客
F
Full Disclosure
博客园 - 聂微东
人人都是产品经理
人人都是产品经理
U
Unit 42
WordPress大学
WordPress大学
A
About on SuperTechFans
C
Cyber Attacks, Cyber Crime and Cyber Security
SecWiki News
SecWiki News
Security Latest
Security Latest
C
Check Point Blog
C
CERT Recently Published Vulnerability Notes
小众软件
小众软件
I
InfoQ
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
B
Blog RSS Feed
V
Visual Studio Blog
博客园_首页
NISL@THU
NISL@THU
I
Intezer
Spread Privacy
Spread Privacy
AWS News Blog
AWS News Blog
The Register - Security
The Register - Security
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Latest news
Latest news
Project Zero
Project Zero
博客园 - 叶小钗
C
Cybersecurity and Infrastructure Security Agency CISA
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
P
Privacy International News Feed
博客园 - 【当耐特】
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
T
Threat Research - Cisco Blogs
Simon Willison's Weblog
Simon Willison's Weblog
T
Tor Project blog
V
Vulnerabilities – Threatpost
博客园 - 司徒正美
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
雷峰网
雷峰网

Deno

Deno 2.8 | Deno Claw Patrol: an open-source security firewall for agents | Deno Fresh 2.3: Zero JS by default, View Transitions, and Temporal support | Deno Deno 2.7: Temporal API, Windows ARM, and npm overrides | Deno Build a dinosaur runner game with Deno, pt. 6 | Deno Build a dinosaur runner game with Deno, pt. 5 | Deno Deno Deploy is Generally Available | Deno Introducing Deno Sandbox | Deno Build a dinosaur runner game with Deno, pt. 4 | Deno Build a dinosaur runner game with Deno, pt. 3 | Deno Build a dinosaur runner game with Deno, pt. 2 | Deno React / Next.js Denial-of-Service Vulnerability: Deno Deploy users protected | Deno Deno 2.6: dx is the new npx | Deno Build a dinosaur runner game with Deno, pt. 1 | Deno React Server Functions / Next.js Vulnerability: Deno Deploy users protected | Deno My highlights from the new Deno Deploy | Deno Deno's Other Open Source Projects | Deno How Deno protects against npm exploits | Deno Help Us Raise $200k to Free JavaScript from Oracle | Deno Deno 2.5: Permissions in the config file | Deno Fresh 2.0 Graduates to Beta, Adds Vite Support | Deno Deno 2.4: deno bundle is back | Deno JavaScript™ Trademark Update | Deno What's coming to JavaScript | Deno A brief history of JavaScript | Deno Reports of Deno's Demise Have Been Greatly Exaggerated | Deno An Update on Fresh | Deno How Plaid migrated 100 services to a new database platform 5x faster with Deno | Deno Deno 2.3: Improved deno compile, local npm packages, and more | Deno Add JSR packages with pnpm and Yarn | Deno Zero-config Debugging with Deno and OpenTelemetry | Deno Exploring Art with TypeScript, Jupyter, Polars, and Observable Plot | Deno Deno v Oracle Update 3: Fighting the JavaScript Trademark | Deno Build a custom RAG AI agent in TypeScript and Jupyter | Deno How to get deep traces in your Node.js backend with OTel and Deno | Deno toranoana.deno #20 登録受付中(2025年3月14日) | Deno Node just added TypeScript support. What does that mean for Deno? | Deno The Dino 🦕, the Llama 🦙, and the Whale 🐋 | Deno Publish a lint rule, get a prize | Deno Deno 2.2: OpenTelemetry, Lint Plugins, node:sqlite | Deno If you're not using npm specifiers, you're doing it wrong | Deno How Deno's documentation is evolving | Deno Oracle justified its JavaScript trademark with Node.js—now it wants that ignored | Deno Introducing the JSR open governance board | Deno Intro to Wasm in Deno | Deno Announcing OpenAI on JSR | Deno Deno in 2024 | Deno Goodbye WinterCG, welcome WinterTC | Deno Build a SolidJS app with Deno | Deno Run your Next.js SSR app on Deno Deploy | Deno Solve Advent of Code 2024 with Deno and Win Prizes! | Deno Deno v. Oracle: Canceling the JavaScript Trademark | Deno Deno 2.1: Wasm Imports and other enhancements | Deno Build a Typesafe API with tRPC and Deno | Deno Self-contained Executable Programs with Deno Compile | Deno Build a Database App with Drizzle ORM and Deno | Deno Introducing your new JavaScript package manager: Deno | Deno Announcing Growthbook on JSR | Deno Build an Astro site with Deno | Deno How to convert CommonJS to ESM | Deno Announcing Deno 2 | Deno The Final Touches: What’s New In v2.0.0-rc.10 | Deno Announcing Stable V8 Bindings for Rust | Deno Deno 2.0 Release Candidate | Deno Secure, efficient private npm registries with Cloudsmith and Deno | Deno Painting the Plane as We Fly It: Designing JSR | Deno Introducing Web Cache API support on Deno Deploy | Deno Deno 1.46: The Last 1.x Release | Deno Protect your cloud spend with new Deno Deploy spend limits | Deno What we got wrong about HTTP imports | Deno Benchmarking AWS Lambda Cold Starts Across JavaScript Runtimes | Deno Announcing Supabase on JSR | Deno Deno 1.45: Workspace and Monorepo Support | Deno Introducing KV Backup for Deno Subhosting | Deno A Gentle Intro to TypeScript | Deno Announcing Hono on JSR | Deno How We Made the Deno Language Server Ten Times Faster | Deno How the Guardian uses Deno to audit accessibility and performance across their 2.7 million articles | Deno Introducing More Flexible Domain Association for Deno Subhosting | Deno The stabilization process of the Standard Library has begun | Deno Deno 1.44: Private npm registries, improved Node.js compat, and performance boosts | Deno How we built a secure, performant, multi-tenant cloud platform to run untrusted code | Deno The Deno Standard Library is now available on JSR | Deno How to document your JavaScript package | Deno Your Low Code Solution Needs an Escape Hatch | Deno Deno 1.43: Improved Language Server performance | Deno How Slack used Deno to save months of engineering effort in launching their new platform | Deno JSR Is Not Another Package Manager | Deno Announcing the Hookdeck SDK on JSR | Deno Announcing the Neon Serverless Driver on JSR | Deno An intro to TSConfig for JavaScript Developers | Deno How we built JSR | Deno How Netlify used Deno Subhosting to build a successful edge functions product | Deno Introducing Simpler Project Creation in Deno Deploy | Deno Deno 1.42: Better dependency management with JSR | Deno Introducing deployctl, the command line interface for Deno Deploy | Deno Introducing JSR - the JavaScript Registry | Deno How to add Monaco to a Next.js app and securely run untrusted user code | Deno Survey Results and Roadmap | Deno Deno 1.41: smaller deno compile binaries | Deno
Use Deno KV in Node with the new official npm package | Deno
2023-12-12 · via Deno

Since we’ve launched Deno KV, our globally-managed serverless database built right into the Deno runtime, developers love how simple it is to add state to their applications without configuration or provisioning a database:

const kv = await Deno.openKv();
Add state with Deno KV in a single line of code.

In addition to the ability to connect remotely to a managed Deno KV instance, we’ve also published a standalone open source denokv binary for self-hosting - including continuous backup to S3 or GCS with point-in-time recovery.

Today, we’re excited to bring Deno KV access to Node.js with our official Deno KV npm package. Now you can use Deno KV’s simple API to add a globally-distributed, ACID-supported database to your Node projects.

In this post, we’ll cover:

  • Installation and usage
  • Opening a KV instance
  • The API surface
  • Provisioning a KV database on Deno Deploy
  • Supported runtimes
  • Open source credits
  • What’s next

Installation and usage

To install the package:

Once you’ve added the package to your Node project, you can import the openKv function (supports both ESM import and CJS require-based usage):

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

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


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

const result = await kv.get(key);
console.log(result.value); 

By default, the access token used for authentication comes from the DENO_KV_ACCESS_TOKEN environment variable. You can also pass it explicitly via options:

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

const kv = await openKv(<KV Connect URL>, { accessToken: myToken });

KV Connect URLs to Deno Deploy KV databases look like:

https://api.deno.com/databases/<database-id>/connect

The database-id for your project can be found in the Deno Deploy dashboard, under the project’s KV tab.

Opening a KV instance

The Deno KV npm package allows you to connect to four kinds of databases using a single function:

  • a globally-managed Deno Deploy KV instance, powered by FoundationDB and optimized for read and write latencies
const kv = await openKv(
  "https://api.deno.com/databases/<database-id>/connect",
);
  • a denokv service hosted on your own infrastructure, powered by SQLite
const kv = await openKv("http://localhost:4512");
  • a local database powered by SQLite
const kv = await openKv("kv.db");
  • or an in-memory KV database for testing
const kv = await openKv();

API

No matter which kind of database you choose, the returned kv instance has the same methods for database operations — following the KV API provided in Deno itself.

The get, getMany, set, delete, atomic, enqueue, and close methods are supported, even the new watch method!

  • The listenQueue method is supported for in-memory and SQLite databases, but not for remote databases (it’s not yet supported by the underlying protocol).

Check out an annotated example of how to interact with the KV API.

Provisioning a KV database on Deno Deploy

Deno KV on Deno Deploy is a globally-distributed, highly-performant database (built on FoundationDB) that scales without any provisioning or orchestration.

If you don’t have an existing Deno Deploy project, you can create a new Deno KV database for free without needing to deploy a project:

  • From your project page, create a new playground
  • Click on the settings icon, then “Project Settings”
  • Select the KV tab to copy out the database ID needed to construct the associated KV Connect URL to pass to openKv (see above)
Currently this process requires creating an empty project, we’re working to further simplify this flow in the future.

To remotely connect to your new Deno KV database, you’ll also need to create an access token and set that as the DENO_KV_ACCESS_TOKEN environment variable:

  • Go to your account settings
  • Scroll down to your Access Tokens and click “New Access Token”
  • Enter a description, like “Deno KV Access Token”
  • Copy the newly-generated access token

Finally, set your new token as the environment variable DENO_KV_ACCESS_TOKEN when running your Node project. Now you can connect remotely to a globally-managed Deno KV instance!

Supported runtimes

@deno/kv is targeted to Node 18+, optimized for performance and compatibility with databases created by Deno itself. It has no third-party npm package dependencies, and uses a single platform-specific binary for SQLite access on the four native architectures supported by Deno itself. The architecture-appropriate native dependency is selected and installed at npm install time using the standard peer dependency mechanism.

Deno KV uses V8’s serialization format for storing values in local and remote databases, available by default in Deno, and by default in Node via the built-in v8 module. This package will run on other Node-compatible runtimes, provided a compatible V8 serializer is available. See Other runtimes for more details.

Open source credits

The source code for this package is freely available, and utilizes:

  • protobuf code generated with pb
  • npm package generation with dnt
  • platform-specific binaries supporting the standard Node Node-API native interface, leveraging our existing denokv Rust codebase via the excellent NAPI-RS framework
  • an initial codebase contributed by John Spurlock, adapted from his open source kv-connect-kit project

What’s next

The release of the @deno/kv npm package means that you can now access Deno KV in your Node projects, whether that is the globally-managed Deno KV built on FoundationDB or a local one backed by SQLite. Building with Deno KV’s simple API makes it easy to add state to your projects. With Deno KV, along with other cloud primitives built into the Deno runtime such as Deno Queues and Deno Cron, creating a scalable, production-ready application is simpler than ever.

We just announced Deno Cron 🦕️🕒️, a zero config approach to adding and managing scheduled tasks, available in 1.38 or later and on Deno Deploy.