Happy new year from the Deno team! Last month, we released 1.39 with WebGPU support, released a whole new set of features for Deno KV including the new .watch()
function, kicked off a Deno Subhosting hackathon, and more.
The WebGPU API gives developers a low level, high performance, cross architecture way to program GPU hardware in JavaScript. It was included in Deno back in early 2021, but was removed due to performance issues. We’re happy to announce that those issues were resolved, leading to its inclusion in 1.39.
WebGPU enables support not only for image rendering and gaming, but also machine learning algorithms. For examples on using WebGPU with Deno, check out our examples repository.
Watch the video or Read the full announcement ⇒
kv.watch
The new kv.watch
API allows you to listen to changes to your Deno KV keys, making it easier to build:
Here’s an example of using kv.watch
to build a real-time chat application:
let seen = "";
for await (const [messageId] of kv.watch([["last_message_id", roomId]])) {
const newMessages = await Array.fromAsync(kv.list({
start: ["messages", roomId, seen, ""],
end: ["messages", roomId, messageId, ""],
});
await websocket.write(JSON.stringify(newMessages));
seen = messageId;
}
Watch the video or check out the blog announcement for more details ⇒
We’ve been working hard to broaden access to Deno KV, by releasing a standalone open sourced binary, supporting the ability to connect to a Deno KV instance remotely, and also enabling continuous replication to S3 or GCS. Now, you can access Deno KV in Node with our new official npm package.
Install the package:
npm install @deno/kv
Then import the openKv
function, use your KV connect url
(which you can grab from your Deno Deploy dashboard) and you’re off to the races:
import { openKv } from "@deno/kv";
const kv = await openKv(<KV Connect URL>);
// use the Deno KV api: https://deno.land/api?s=Deno.Kv&unstable
const key = [ "users", crypto.randomUUID() ];
const value = { name: "Alice" };
await kv.set(key, value);
const result = await kv.get(key);
console.log(result.value); // { name: "Alice" }
The npm supports the same methods as the Deno KV API, even the new kv.watch
method.
Learn more about Deno KV npm module ⇒
It’s becoming increasingly popular to include development environments directly in your web applications:
There’s a great chance your customers could benefit from code-level customization in your platform. But building a cloud IDE can be daunting. The Deno Subhosting API simplifies that process, by allowing you to programmatically deploy and run code within seconds on Deno Deploy’s globally distributed V8 isolate cloud.
To show you the capabilities of the Deno Subhosting API, we’ve recently kicked off our Deno Subhosting Hackathon, where we invite you to either build your own cloud IDE or integrate a cloud IDE into your existing product.
We want to thank our wonderful community for sharing their projects to the Deno ecosystem. Here are some of the projects shared in the past month!
We’re also posting short videos to our YouTube that feature some of these projects.
For more projects created and shared by the community, check out our Discord’s #showcase channel.
In case you missed it, here are other resources and updates that we’ve shipped last month:
And that’s it for this issue! If you think someone could benefit from this, please forward it along.
— Andy