What is Deno
Hey and welcome everyone to this guide on Deno! I’m so excited to have you here. In this guide, we’re going to dive deep into Deno, exploring its features, APIs, and tools. By the end of this guide, you’ll have a solid understanding of Deno and be ready to start building your own projects with it.
This guide is a living document, which means I’ll be updating it regularly with new content and examples. I’m here to help you learn and answer any questions you might have. So, let’s get started!
If you’re interested in being notified about new parts or in general about things I do and write about, head over to my newsletter and subscribe. I would really appreaciate it!
The modules of this guide are:
- Introduction to Deno
- Setting up Deno
- Deno toolchain
- Deno on the CLI (added October 7th, 2024)
- Deno and the file system (added November 18th, 2024)
- Work with HTTP in Deno (added December 24th, 2024)
- Send Deno to the Cloud (added January 4th, 2025)
What is Deno
Let’s start with the official definition of the Deno website and break it up afterwards:
Deno is the open-source JavaScript runtime for the modern web. Built on web standards with zero-config TypeScript, unmatched security, and a complete built-in toolchain, Deno is the easiest, most productive way to JavaScript.
At its heart, Deno is a runtime that lets us run JavaScript, much like Node.js if you’re familiar with that. But here’s where it gets interesting: Deno is built with TypeScript in mind. We’ll be using TypeScript a lot in this guide, and I’ll show you why that’s actually a good thing, even if you’re more comfortable with plain JavaScript.
Now, I know what you might be thinking: “Great, another JavaScript runtime to learn.” But trust me, Deno has some tricks up its sleeve that make it really stand out. We’re going to talk about its approach to security, which is pretty cool. It uses these things called runtime flags that give you more control over what your code can do.
And here’s something I’m personally excited about - Deno comes with a bunch of built-in tools that make our lives as developers so much easier. No more spending hours setting up your development environment!
Throughout this guide, we’ll explore all of these aspects of Deno. I’m here to guide you, answer your questions, and hopefully make the learning process enjoyable. So, ready to start this Deno journey with me?
How is this Guide structured
I’ve designed this Deno guide to be your fast track into the world of Deno, focusing on the APIs and tools you’ll use most often in your projects.
My goal? To get you up and running with Deno as quickly as possible. I’ve distilled the most important topics into a concise package, giving you everything you need to get a solid grasp of Deno. Think of it as an 80/20 approach (Pareto Principle) - we’re covering the 80% of Deno that you’ll use most of the time. If you want to know more about this type of approach, check out the Pareto principle article on Wikipedia.
Before we dive in, let’s talk prerequisites. You’ll need:
- A good foundation in JavaScript
- Ideally, some experience with TypeScript
Don’t worry if you’re not quite there yet! If you need to brush up on your JavaScript, we highly recommend the JavaScript course at freeCodeCamp.org. For TypeScript, the official TypeScript documentation is an excellent starting point.
Once you’ve got those basics down, you’re all set to jump into Deno with us!
I’ve built this guide drawing from multiple sources:
- The official Deno documentation
- Various supporting websites
- Open-source projects
- My personal experiences with Deno
Throughout the guide, I’ll provide plenty of in-depth resources for each topic. These are there to help you dive deeper into areas that particularly interest you or that you find challenging.
Ready to get your feet wet with Deno? Let’s dive in!
Install deno and set it up
Let’s get Deno up and running on your machine! The installation process is straightforward, and I’ll walk you through it step by step for different platforms.
macOS / Linux
For macOS and Linux users, it’s as simple as running a shell script. Here’s how you do it:
curl -fsSL https://deno.land/install.sh | sh
This script automatically detects your system and installs the appropriate Deno binary.
🚨 Safety First: Before running any script from the internet, it’s crucial to review its contents. Even if it’s from a trusted source like Deno’s official website, it’s a good habit to verify what you’re executing on your system.
Homebrew
It is also possible to install Deno via homebrew. It is as simple as the script above:
brew install deno
💡 Note: You have to note that upgrading Deno via homebrew is not done with the
deno upgrade
command. Instead you have to use brew upgrade deno
.
Windows
Windows users, you’re not left out! The process is just as straightforward:
irm https://deno.land/install.ps1 | iex
This PowerShell command downloads and runs the Deno installation script tailored for Windows.
Docker
For the Docker enthusiasts out there, Deno offers a variety of official images. These are based on popular distributions, giving you flexibility in your containerized environments.
Here’s a quick reference of available Docker images:
Base | Docker Tag |
---|---|
Alpine Linux | denoland/deno:alpine |
Debian | denoland/deno:debian (default) |
Distroless | denoland/deno:distroless |
Ubuntu | denoland/deno:ubuntu |
Binary only | denoland/deno:bin |
For more details on Dockerfiles and usage, check out the Deno Docker GitHub repository.
Need More Info?
If you want to dive deeper into installation options or troubleshoot any issues, the official Deno installation guide is an excellent resource. There you’ll find alternative installations as well.
Now that we’ve covered installation, are you ready to start building with Deno? Let’s move on to your first Deno project!
Setting Up Your Deno Development Environment
One of Deno’s great features is its built-in language server (LSP), making it compatible with a wide range of editors. While we’ll focus on three popular options here, remember that there are many more. For a comprehensive list, check out the official Deno docs on Setting Up Your Environment.
Visual Studio Code: The Popular Choice
VSCode users, you’re in luck! There’s an official Deno extension waiting for you in the Visual Studio Marketplace.
Here’s how to set it up:
- Install the extension from the marketplace.
- Open the command palette (Cmd/Ctrl + Shift + P).
- Type and select “Deno: Initialize Workspace Configuration”.
- Answer a few quick questions, and you’re done!
This creates a configuration file in the .vscode
subdirectory, perfect for
switching between Deno, Bun and Node.js projects, as the settings are only valid
for this workspace.
JetBrains IDEs: For the IntelliJ Lovers
If you’re a fan of JetBrains IDEs, you’re covered. The official Deno extension is available in the JetBrains Marketplace.
Setup is straightforward:
- Install the extension in your IDE.
- Settings should auto-configure, but you might need to tweak a few things.
For a detailed guide, check out the WebStorm Blog post on Deno support.
Zed: The New Kid on the Block
Zed users, don’t feel left out! While the setup might feel a bit trickier, it’s definitely doable.
Here’s your game plan:
- Open the command palette and search for “zed: extensions”.
- Find and install the community-built Deno extension.
- Create a
.zed/settings.json
file in your workspace with the following content:
{
"languages": {
"TypeScript": {
"language_servers": [
"deno",
"!typescript-language-server",
"!vtsls",
"!eslint"
]
},
"TSX": {
"language_servers": [
"deno",
"!typescript-language-server",
"!vtsls",
"!eslint"
]
}
}
}
This configuration tells Zed to use Deno’s LSP instead of the standard TypeScript ones. Need more help? I’ve got a detailed guide on setting up the Deno language server in Zed that I keep updated.
Remember, whichever editor you choose, the goal is the same: a smooth, efficient Deno development experience. Happy coding and now let’s set up our project and start right in.