I've been migrating most of my side projects (including this portfolio) from Node.js to Deno recently.
I found that setting up Deno on Windows is straightforward, and it comes with everything I need: a linter, a formatter, a test runner, and native TypeScript support.
1. Installation
I find the easiest way to install Deno on Windows is using PowerShell. I just open my terminal and run:
irm https://deno.land/install.ps1 | iexOnce installed, I verify it by checking the version:
deno --version
# deno 2.0.0
# v8 12.9.202.28-rusty
# typescript 5.6.22. Writing My First Script
I love that unlike Node.js, Deno doesn't require a package.json or
node_modules folder to get started. I can just create a .ts file and run it.
Here is how I write a simple HTTP server using Deno's native APIs:
// server.ts
const port = 8000;
const handler = (request: Request): Response => {
const url = new URL(request.url);
if (url.pathname === "/hello") {
return new Response("Hello from Deno on Windows!", {
status: 200,
headers: { "Content-Type": "text/plain" },
});
}
return new Response("Not Found", { status: 404 });
};
console.log(`Server is running on http://localhost:${port}`);
Deno.serve({ port }, handler);3. Running the Server
Because Deno is secure by default, it cannot access the network, file system, or environment variables unless I explicitly allow it.
To run my server, I have to pass the --allow-net flag:
deno run --allow-net server.tsIf I try to run it without the flag, Deno pauses and asks for my permission interactively, which is a lot more secure than how Node.js works by default.
Conclusion
Deno is worth trying if you're on Windows and tired of piecing together a Node.js toolchain. One install command, and the linter, formatter, test runner, and TypeScript support are already there. Read The Phantom Sandbox for more on how I run it in production.