Deno September Update: Deno KV is in open beta, npm is natively supported on Deno Deploy, and more
It was a busy end of summer — Deno KV on Deno Deploy is now in open beta, npm is now natively supported on Deno Deploy, Fresh 1.4 is out with even faster page loads, and much more. Let's dive right in!
Deno KV is in open beta
Deno KV is a key-value database that works with zero configuration during local development, and scales to millions of operations on Deno Deploy. The API is also baked right into the runtime, so instead of having to provision a database and juggle API keys, you can add persistence to your applications with a few lines of code:
const kv = await Deno.openKv();
await kv.set(["scores", "player1"], 500);
const score = await kv.get<number>(["scores", "player1"]);
console.log("Player 1's score is:", score.value);
We've also released some new features to make it easier for you to use Deno KV:
- Connect to Deno KV locally for easy imports and migrations
- More read regions for even lower latency
- Simpler user OAuth 2.0 backed by Deno KV with the
deno_kv_oauth
module - Increased limit for mutations in an atomic operation
Read the announcement or watch the video to see what's next for Deno KV 👀 →
Deno Deploy now natively supports npm
Back in Deno 1.28, we added npm support so you could combine the modern zero-config development experience of Deno with the best of the npm ecosystem. Today, we’re excited to share that you can bring the best of npm with you to your apps running on the edge as well. Deno Deploy now natively supports running npm modules via npm specifiers!
Here’s an example of running an Express app on Deno Deploy:
// Import express and instantiate it
import express from "npm:express@4";
const app = express();
// Register a route
app.get("/", (req, res) => {
res.send("Hello World!");
});
// Run the server!
app.listen(3000);
Try it yourself in a playground →
But what does exactly does “native” support mean? It means there’s no transpilation, bundle step, source mapping, or polyfill injection taking place, providing a better developer experience and better compatibility:
- your local environment is the same as production environment on Deno Deploy
- your Deno Deploy stack trace and logs will show file names and line numbers that match up with your local environment — no more digging through unintelligible minified, bundled code
Read the announcement or watch the video →
Fresh 1.4: Faster page loads, Layouts, and more
Fresh has gotten even faster with ahead-of-time compilation and easier to use with layouts, route groups, and more.
Until this release, Fresh has compiled frontend assets on the fly. This allowed for lightning fast deployments with no build step. But we noticed just-in-time rendering with large islands was noticeably slower. So we decided to add a pre-compile solution that results in assets being served ~45-60x faster for a cold start of a serverless function with minimal impact on deployment times. Note ahead-of-time builds is optional. Learn more in the documentation.
In addition to faster page loads, we also added better ways to organize your code through Layouts. Previously, in order to share components across routes, you would need to add that to routes/_app.tsx
, but there was no way beyond that. Now, you can create _layout.tsx
files, which are routes local app wrapper:
routes/
_app.tsx
_layout.tsx
page.tsx # Inherits _app and _layout
sub-route/
_layout.tsx # Inherits _app and _layout
index.tsx # Inherits _app, _layout and sub-route/_layout
about.tsx # Inherits _app, _layout and sub-route/_layout
The _layout
file itself is similar to a route file or app wrapper:
// routes/_layout.tsx
import { LayoutProps } from "$fresh/server.ts";
export default function MyLayout({ Component }: LayoutProps) {
return (
<div class="my-layout">
<h2>This is rendered by a layout</h2>
<Component />
</div>
);
}
Read the blog post or watch the video →
Around the Community
Upcoming Conferences and Meetups
- September 21st: TypeScript Congress (Online): David Sherret will give a talk about replacing shell scripts with cross-platform TypeScript.
- October 2-6th: QConn (San Francisco, CA): Ryan Dahl will give a talk about what’s next for Deno.
- October 20th: Deno Fest (Tokyo, Japan): Partnered with Toranoana, the Deno team is holding its first mini conference! A full days’ worth of talks from the team as well as community members. If you’re in Tokyo, we’d love for you to join us! If not, we plan to stream the event and publish the talks as videos on our YouTube.
- November 6th: Node Conf (Kilkenny, Ireland): Kevin Whinnery will present on various cloud KV solutions, its benefits over other persistent data storage solutions, and more.
- November: JetBrains JavaScript Day (remote): Luca Casonato gives a talk about why modern JavaScript should include batteries.
Community #Showcase
You all have been active building with and writing about Deno! Here’s a (very incomplete) list of projects and articles.
- Want to use python libraries in Deno? Check out this awesome python-deno interpreter
- A neat alternative to Puppeteer/Playwright library written for Deno
- An ORM wrapper for Deno KV that supports secondary indexes and types
For more Deno projects, modules, and resources (or if you’d like to share yours), check out the Discord’s #showcase channel.
Other Deno updates
But that's not all — we’ve shipped more articles, videos, and more. Check them out below: