Install Deno v2.1.2
curl -fsSL https://deno.land/install.sh | sh
Native TypeScript support
interface Person {
name: string;
age: number;
}
function greet(person: Person): string {
return "Hello, " + person.name + "!";
}
const alice: Person = {
name: "Alice",
age: 36
};
console.log(greet(alice));
Modern language features, built-in
Built on web standards
Consistent code from browser to backend
Batteries included
The essential tools you need to build, test, and deploy your applications are all included out of the box.
Code linter
Deno ships with a built-in code linter to help you avoid bugs and code rot.
Learn more$ deno lint --watch
Test runner
Deno provides a test runner and assertion libraries as a part of the runtime and standard library.
Learn more// server_test.ts
Deno.test("1 + 2 = 3", () => {
const x = 1 + 2;
console.assert(x == 3);
});
$ deno test server_test.ts
Standalone executables
Instantly create standalone executables from your Deno program. It even supports cross-compiling for other platforms!
Learn moreDeno.serve(req => new Response("Hello!"));
$ deno compile --allow-net server.ts
Compile file:///tmp/server.ts to server
$ ./server
Listening on http://localhost:8000/
Code formatter
Deno's built-in code formatter (based on dprint) beautifies JavaScript, TypeScript, JSON, and Markdown.
Learn more$ deno fmt --line-width=120
Secure by default
Prevent supply chain attacks
Stop worrying about npm modules introducing unexpected vulnerabilities. Deno restricts access to the file system, network, and system environment by default, so code can access only what you allow.
Other runtimes
$ node random.jsExecuting random.js...🚨 File system compromised!
Deno
$ deno random.js⚠️ Deno requests write accessAllow? [y/n/A]$ n❌ Denied write accessExited
Backwards compatible with Node.js
import express from "npm:express@4";
const app = express();
app.get("/", function (_req, res) {
res.send("hello");
});
app.listen(3000, () => {
console.log("Express listening on :3000");
});
$ deno run --allow-net --allow-read --allow-env server.js
Compatible with millions of npm modules
npm:
specifiers.High-performance networking
- HTTPS (encryption)
- WebSocket
- HTTP2
- Automatic response body compression
Bigger is better
Throughput, requests per sec
Built for the cloud
Deno runs on
Go further with Deno cloud products
Deno Deploy
For developers looking for the simplest way to host web apps and APIs
- Fully managed serverless solution
- Globally distributed
- Built-in key/value database, queues, cron, and more
- Integrated directly with GitHub
Deno Subhosting
For SaaS companies looking to run user code securely
- Secure sandboxed functions
- Automatic scaling and provisioning
- Globally distributed
- Manage via a simple API
The Freshest web framework
Build fast sites fast
export default function HomePage() {
return (
<div>
<h1>HTML fresh from the server!</h1>
<p>
Delivered at
{new Date().toLocaleTimeString()}
</p>
</div>
);
}
import { useSignal } from "@preact/signals";
export default function Counter() {
const count = useSignal<number>(0);
return (
<button onClick={() => count.value += 1}>
The count is {count.value}
</button>
);
}