How to Set Up a Deno Development Environment on Linux
Deno is a secure JavaScript and TypeScript runtime with built-in tooling. Set up a complete Deno development environment on your Breeze for server-side projects.
Install Deno
# Install using the official installer
curl -fsSL https://deno.land/install.sh | sh
# Add to your shell profile
echo 'export DENO_INSTALL="$HOME/.deno"' >> ~/.bashrc
echo 'export PATH="$DENO_INSTALL/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
deno --version
Create a Project
mkdir ~/my-deno-app && cd ~/my-deno-app
# Initialize with deno.json configuration
deno init
Build a Simple HTTP Server
// main.ts
const handler = (req: Request): Response => {
const url = new URL(req.url);
if (url.pathname === "/api/health") {
return new Response(JSON.stringify({ status: "ok" }), {
headers: { "Content-Type": "application/json" },
});
}
return new Response("Welcome to Deno on your Breeze!");
};
Deno.serve({ port: 8000 }, handler);
Run and Test
# Run with network permission
deno run --allow-net main.ts
# Run tests
deno test
# Format and lint
deno fmt
deno lint
Deploy as a Service
# /etc/systemd/system/deno-app.service
[Unit]
Description=Deno Application
After=network.target
[Service]
Type=simple
User=www-data
WorkingDirectory=/var/www/my-deno-app
ExecStart=/home/deploy/.deno/bin/deno run --allow-net --allow-read main.ts
Restart=on-failure
[Install]
WantedBy=multi-user.target
Deno's built-in permissions model provides an extra layer of security on your Breeze by default.