Deploying a JavaScript/TypeScript server usually means: Dockerfile, build steps, CI pipeline, cloud config. Deno Deploy means: deployctl deploy.
Why Deno Deploy
- Zero config — no Dockerfile, no build step, no bundler
- Globally distributed — runs in 35+ regions
- Instant deploys — under 2 seconds
- Native TypeScript — no transpilation needed
- Web standard APIs — fetch, Request, Response, crypto
Free Tier
- 1M requests/month
- 100 GiB data transfer/month
- KV storage included
- Custom domains + auto-SSL
Hello World
// main.ts
Deno.serve((req: Request) => {
const url = new URL(req.url);
if (url.pathname === "/api/hello") {
return Response.json({
message: "Hello from Deno Deploy!",
timestamp: new Date().toISOString(),
});
}
return new Response("Not Found", { status: 404 });
});
deployctl deploy --project=my-api main.ts
# Live at https://my-api.deno.dev in ~2 seconds
Deno KV (Built-in Database)
const kv = await Deno.openKv();
// Set
await kv.set(["users", "alice"], { name: "Alice", email: "alice@test.com" });
// Get
const entry = await kv.get(["users", "alice"]);
console.log(entry.value); // { name: "Alice", ... }
// List with prefix
const users = kv.list({ prefix: ["users"] });
for await (const entry of users) {
console.log(entry.key, entry.value);
}
// Atomic transactions
await kv.atomic()
.check({ key: ["users", "alice"], versionstamp: entry.versionstamp })
.set(["users", "alice"], { ...entry.value, verified: true })
.commit();
KV is globally replicated — reads are fast from anywhere.
Queues (Background Jobs)
const kv = await Deno.openKv();
// Enqueue a job
await kv.enqueue({ type: "send-email", to: "user@test.com", subject: "Welcome" });
// Process jobs
kv.listenQueue(async (msg) => {
if (msg.type === "send-email") {
await sendEmail(msg.to, msg.subject);
}
});
Cron Jobs
Deno.cron("cleanup", "0 * * * *", async () => {
const kv = await Deno.openKv();
const old = kv.list({ prefix: ["sessions"] });
for await (const entry of old) {
if (isExpired(entry.value)) {
await kv.delete(entry.key);
}
}
});
Built-in cron. No external scheduler needed.
Fresh Framework (Full-Stack on Deno Deploy)
deno run -A https://fresh.deno.dev my-app
cd my-app && deno task start
Fresh is Islands Architecture + Preact + file-based routing — perfect for Deno Deploy.
npm Compatibility
import express from "npm:express@4";
import { PrismaClient } from "npm:@prisma/client";
import Stripe from "npm:stripe";
Most npm packages work out of the box with npm: prefix.
Need serverless APIs or data automation? I build web tools and scraping solutions. Email spinov001@gmail.com or check my Apify developer tools.
Top comments (0)