Deno 2.0

Spanish audio is available in the player settings
Rate this content
Bookmark

Deno 2.0 is imminent and it's bringing some big changes to the JavaScript runtime. In this talk, we'll introduce the new features including import maps, package.json auto-discovery, and bare specifiers. We'll discuss how these improvements will help address issues like duplicate dependencies and disappearing dependencies. Additionally, we'll delve into the built-in support for deno: specifiers on the deno.land/x registry and its role in providing a recommended path for publishing. Come learn about how these updates will shape the future of the JavaScript ecosystem and improve backwards compatibility with Node applications.

This talk has been presented at Node Congress 2023, check out the latest edition of this Tech Conference.

FAQ

The main goal of Deno is to build optimal cloud services and servers by providing a system that is maximally accessible, has excellent latency worldwide, is serverless, and is secured by default.

Deno ensures security by default by restricting access to the underlying system. Every time a program tries to access the file system or network, Deno prompts the user for permission.

Deno KV is an advanced key-value database built directly into Deno. It allows you to store JavaScript objects and supports normal key-value operations like get, set, list, and delete, as well as atomic transactions. It's backed by SQLite and can be used to build stateful applications without needing external dependencies.

Yes, Deno has built-in support for NPM packages, allowing you to use the entire JavaScript ecosystem. You can import packages directly and Deno handles compatibility and security through its permission system.

Key features of Deno 2.0 include built-in support for NPM packages, a robust compatibility layer with Node.js, and the introduction of Deno KV, an advanced key-value database. It aims to make building and deploying cloud services easier and more secure.

Deno, like Node.js, primarily uses asynchronous I/O to build optimal servers. This approach helps in managing non-blocking I/O operations, making the system more efficient and performant.

The compatibility layer in Deno allows developers to use Node.js built-in modules and NPM packages, providing a smoother transition for those who are used to the Node.js ecosystem.

Deno Deploy extends Deno's capabilities by providing a serverless Edge Functions platform that runs in multiple data centers worldwide. It allows for fast, georeplicated, and scalable deployment of applications with zero configuration.

While you can self-host Deno and deploy it to various cloud providers, the georeplicated, strongly consistent database backend powered by FoundationDB is specific to Deno Deploy and not available for self-hosting.

JavaScript is chosen for its accessibility, making it easy for a large developer base to use Deno. Additionally, JavaScript's sandboxing capabilities enhance security, restricting unauthorized access to the underlying system.

Ryan Dahl
Ryan Dahl
36 min
14 Apr, 2023

Comments

Sign in or register to post your comment.

Video Summary and Transcription

The Talk discusses forced optimization with Node and Deno, with Deno aiming to pursue the same goals in a more expansive and modern way. Deno has built-in support for NPM and enforces security constraints. It also has a key-value database called Deno KV, which will be a core part of the Deno 2 API. Deno Deploy is a serverless Edge Functions platform powered by FoundationDB, optimized for fast reading and ideal for building eCommerce sites or application servers at the edge. Deno 2.0 is coming soon with more features under development.
Available in Español: Deno 2.0

1. Forced Optimization with Node and Deno

Short description:

My talk is about forced optimization, the original goal with Node was to force developers to easily build optimal servers by using async IO. These days, building optimal servers requires more than just async IO. With Deno, the goal is to continue pursuing the same goals but in a more expansive and modern way. The system needs to be maximally accessible, have excellent latency, and be serverless.

My talk is not called Dino 2.0, it's called forced optimization. There's this trick you do when you apply for conference talks where you give some title and some description and the night before you make it up as you're going along.

Yeah, so Node is quite old at this point. Maybe 13, 14 years old. My original goal with Node was to force developers to easily build optimal servers by forcing them to only use async IO. Not 100% true. There's synchronous IO in Node, but to a large extent, at least with network IO, you're kind of forced to use non-blocking IO. This is really standard these days. Essentially, any platform is making use of non-blocking IO. But in 2008, this was not the case. There was a lot of people writing kind of threaded, blocking IO servers.

These days, easily building servers and optimal servers needs more than just async IO. There's a lot that goes into this. You're managing cloud configurations. You're choosing a database. You're thinking about how data might be replicated around the world. Especially if you're using Node, you're navigating a plethora of tool chains and workflows that may or may not work nicely together. You're dealing with supply chain security. Just doing non-blocking IO isn't getting you all of the way there. With Deno, the goal is really a continuation of this original goal, but a little bit more expansive and modern. Deno continues the pursuit of the same goals, but thinking about this kind of holistically as a service that you're building and deploying to a public cloud. In order to achieve this, there are certain requirements that I think are obvious. First and foremost, I'm interested in building systems that are maximally accessible, that have a very large developer base. That is why JavaScript. JavaScript is not necessarily the greatest language on earth, but it is the most accessible language on earth. This system needs to have excellent latency everywhere. Whether you're accessing the system from Japan or you're accessing it from New York City, you should not be penalized for where you are in the world. This system should, I don't know if you're in agreement with this, but the system should be serverless. You want things that scale down to zero and scale up to as large as necessary. This is a big deal these days is that there is a lot of configuration that goes in here.

2. Deno: Frameworks, Security, and Compatibility

Short description:

You're dealing with Terraform, config files, and frameworks in Deno. The goal is to reduce boilerplate and improve security. Deno 2.0 is under development and aims to address compatibility issues with Node. Deno provides a prompt for file system access and takes a hard line stance on import specifiers. Node built-in modules are available in Deno.

You're dealing with Terraform, you're dealing with various config files from every possible library. You're dealing with lots of boilerplate, lots of frameworks. What are frameworks anyways? It's just boilerplate that you kind of lay down in advance in order to get running. We want to reduce that as much as possible in order to move people forward.

It should be secured by default, right? JavaScript is a great language for security because it is actually a sandbox and has the ability to restrict people from accessing the underlying system. Deno is attempting to meet these requirements and ever more getting closer to this. Deno 2.0 is coming out this summer and we're working towards this, right? We're kind of ever thinking about this in terms of how do we build kind of optimal cloud services, optimal servers.

I want to go through a couple of aspects of this and a couple of features of Deno 2.0 that are under development and demo them, and just give you a sense for how this thing works. So first and foremost, Deno, when we started a couple years ago, was very much on a parallel track to Node. And this has been difficult for people to adopt. Because a lot of the JavaScript ecosystem depends on NPM libraries, depends on Node APIs, and implementing these built-in modules is relatively important for people to get up and running quickly.

So yeah, let me just try to demo some of this. Is that visible? Okay. So builtin.js. And you can import readfilesync from node colon fs. And you can readfilesync, say, some file. Etsy password doesn't actually have any nefarious details in it these days, but it is nevertheless kind of a good example of security. So let's just log out this file here. So when we run this with Deno, of course, Deno's big thing is that there is no security by default. There's no access to the system by default, rather. And so every time you try to access the file system, you're going to get a prompt. And what it's asking me here is, do you want to actually allow this? And you can say, no, I don't, in which case the program's going to fail. Or you can say, yes, I do want that, in which case you kind of get out this buffer. In Node, you're probably used to this without a Node specifier. And Node these days is moving, is encouraging people to use the Node schema in that import specifier. Deno kind of takes a hard line stance here that we are not going to have these kind of FSBear specifiers and whatnot. So this induces a little bit of incompatibility with Node. But I think for good reason, right? This is this is not not too big and it gives you kind of a nice error message that kind of tells you what to do. So hopefully hopefully it's not too confusing for people. So we've got Node built in Node modules.

QnA

Available in other languages:

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

React Compiler - Understanding Idiomatic React (React Forget)
React Advanced Conference 2023React Advanced Conference 2023
33 min
React Compiler - Understanding Idiomatic React (React Forget)
Top Content
Watch video: React Compiler - Understanding Idiomatic React (React Forget)
Joe Savona
Mofei Zhang
2 authors
The Talk discusses React Forget, a compiler built at Meta that aims to optimize client-side React development. It explores the use of memoization to improve performance and the vision of Forget to automatically determine dependencies at build time. Forget is named with an F-word pun and has the potential to optimize server builds and enable dead code elimination. The team plans to make Forget open-source and is focused on ensuring its quality before release.
Speeding Up Your React App With Less JavaScript
React Summit 2023React Summit 2023
32 min
Speeding Up Your React App With Less JavaScript
Top Content
Watch video: Speeding Up Your React App With Less JavaScript
Mishko, the creator of Angular and AngularJS, discusses the challenges of website performance and JavaScript hydration. He explains the differences between client-side and server-side rendering and introduces Quik as a solution for efficient component hydration. Mishko demonstrates examples of state management and intercommunication using Quik. He highlights the performance benefits of using Quik with React and emphasizes the importance of reducing JavaScript size for better performance. Finally, he mentions the use of QUIC in both MPA and SPA applications for improved startup performance.
SolidJS: Why All the Suspense?
JSNation 2023JSNation 2023
28 min
SolidJS: Why All the Suspense?
Top Content
Suspense is a mechanism for orchestrating asynchronous state changes in JavaScript frameworks. It ensures async consistency in UIs and helps avoid trust erosion and inconsistencies. Suspense boundaries are used to hoist data fetching and create consistency zones based on the user interface. They can handle loading states of multiple resources and control state loading in applications. Suspense can be used for transitions, providing a smoother user experience and allowing prioritization of important content.
From GraphQL Zero to GraphQL Hero with RedwoodJS
GraphQL Galaxy 2021GraphQL Galaxy 2021
32 min
From GraphQL Zero to GraphQL Hero with RedwoodJS
Top Content
Tom Pressenwurter introduces Redwood.js, a full stack app framework for building GraphQL APIs easily and maintainably. He demonstrates a Redwood.js application with a React-based front end and a Node.js API. Redwood.js offers a simplified folder structure and schema for organizing the application. It provides easy data manipulation and CRUD operations through GraphQL functions. Redwood.js allows for easy implementation of new queries and directives, including authentication and limiting access to data. It is a stable and production-ready framework that integrates well with other front-end technologies.
Jotai Atoms Are Just Functions
React Day Berlin 2022React Day Berlin 2022
22 min
Jotai Atoms Are Just Functions
Top Content
State management in React is a highly discussed topic with many libraries and solutions. Jotai is a new library based on atoms, which represent pieces of state. Atoms in Jotai are used to define state without holding values and can be used for global, semi-global, or local states. Jotai atoms are reusable definitions that are independent from React and can be used without React in an experimental library called Jotajsx.
The Epic Stack
React Summit US 2023React Summit US 2023
21 min
The Epic Stack
Top Content
Watch video: The Epic Stack
This Talk introduces the Epic Stack, a project starter and reference for modern web development. It emphasizes that the choice of tools is not as important as we think and that any tool can be fine. The Epic Stack aims to provide a limited set of services and common use cases, with a focus on adaptability and ease of swapping out tools. It incorporates technologies like Remix, React, Fly to I.O, Grafana, and Sentry. The Epic Web Dev offers free materials and workshops to gain a solid understanding of the Epic Stack.

Workshops on related topic

Building a Hyper Fast Web Server with Deno
JSNation Live 2021JSNation Live 2021
156 min
Building a Hyper Fast Web Server with Deno
WorkshopFree
Matt Landers
Will Johnston
2 authors
Deno 1.9 introduced a new web server API that takes advantage of Hyper, a fast and correct HTTP implementation for Rust. Using this API instead of the std/http implementation increases performance and provides support for HTTP2. In this workshop, learn how to create a web server utilizing Hyper under the hood and boost the performance for your web apps.
Unveiling Next.js Secret Sauce on the Edge
React Summit 2024React Summit 2024
48 min
Unveiling Next.js Secret Sauce on the Edge
Workshop
Mustafa Azim
Mustafa Azim
Next.js on the Edge with its new secrets sauce for better user experience and high performance. We will unveil Next.js secret sauce and the way of working to deliver the best user experience in Edge network and the new features including partial pre-rendering. How to make use of the Server component and its high performance on Edge network.
Table of the contents:- Intro to the Edge network- Edge runtime in V8- Use cases of the edge functions- Deploy a service on the edge network
Writing Universal Modules for Deno, Node and the Browser
Node Congress 2022Node Congress 2022
57 min
Writing Universal Modules for Deno, Node and the Browser
Workshop
Luca Casonato
Luca Casonato
This workshop will walk you through writing a module in TypeScript that can be consumed users of Deno, Node and the browsers. I will explain how to set up formatting, linting and testing in Deno, and then how to publish your module to deno.land/x and npm. We’ll start out with a quick introduction to what Deno is.