Since the release of Deno 2.0, I have been increasingly excited about this runtime with each update. Recently, I discovered the ability to compile your project into a binary, which is quite impressive.
If you haven’t installed Deno yet, visit the Deno installation guide.
Quick Example:
1. Initialize a Project:
Create a new folder and run deno init. This command automatically generates a main.ts file with some example code. Let’s modify it to create a simple HTTP server:
// main.ts
Deno.serve({ port: 3000 }, (_req) => {
return new Response("Hello, World!");
});2. Compile the Project:
Inside the folder, run the following command to compile your project into a binary:
deno compile — allow-net main.ts
# or less secure way
deno compile -A main.tsThis creates a binary file named after your project folder, in my case, deno-http-server.
3. Run the Binary:
Execute the binary with:
./deno-http-serverThat’s it!
Running Inside a Docker Container
To test the binary without having Node.js or Deno installed, we can use a Docker container. First, let’s compile the project for a specific platform:
# For ARM64 architecture:
deno compile - allow-net - target aarch64-unknown-linux-gnu main.ts
# For x86_64 architecture:
deno compile - allow-net - target x86_64-unknown-linux-gnu main.tsNext, let’s start an Ubuntu instance, map the current folder to /app, map the ports, and start the binary process:
docker run -it — rm -p 3000:3000 -v ./:/app ubuntu /app/deno-http-serverAnd voilà! The server is running without any Node or Deno runtime.

There is much more to explore about compiling with Deno. I wanted to introduce you to this feature in the simplest way possible. Be sure to check out the Deno documentation on compiling for more details.
web: https://kracik.sk
X: https://x.com/peterkracik
LinkedIn: https://www.linkedin.com/in/peterkracik/
In Plain English 🚀
Thank you for being a part of the In Plain English community! Before you go:
Be sure to clap and follow the writer ️👏️️
Follow us: X | LinkedIn | YouTube | Discord | Newsletter | Podcast
More content at PlainEnglish.io
Have a story to share? Join our global community of writers today!



