Deno January Update: the return of WebGPU in 1.39, easy real-time updates with Deno KV watch, and the Subhosting Hackathon


image.png

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.

Deno 1.39: the return of WebGPU

image.png

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 ⇒

Real-time apps made easy with Deno kv.watch

image.png

The new kv.watch API allows you to listen to changes to your Deno KV keys, making it easier to build:

  • real-time UI updates, such as social media newsfeeds or notifications
  • chat applications or chat rooms, like Slack or Discord
  • collaborative editors like Google Docs.

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 ⇒

Use Deno KV in Node with the new npm package

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 ⇒

Build a Cloud IDE for the Deno Subhosting Hackathon

image.png It’s becoming increasingly popular to include development environments directly in your web applications:

  • SaaS companies like Salesforce include a browser-based dev environment to customize their platform with code.
  • Developer tool companies like Twilio and Retool enable developers to write JavaScript in the browser to power workflows and handle system events.
  • Educational platforms like Codecademy provide browser-based development tools for students.
  • Even professional developers use platforms like repl.it to develop and share code snippets in the browser, with some companies opting to move full development environments to the cloud.

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.

Learn more about submission guidelines, prizes, and resources to help you to get started in our announcement post ⇒

Around the community

image.png

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.

Other updates

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


Get the latest Deno articles, projects, and other resources.