Skip to content

Lesson 7 of 9 · 25m

Deploy Targets and Runtime Shapes

Compare Deno Deploy, containers, VMs, edge platforms, and serverless-shaped workloads by control plane, isolation, networking, and operational ownership.

"Can I deploy Deno?" is the wrong question. You can deploy almost anything somewhere. The right question is which runtime shape matches the workload: long-lived TCP service, request/response web app, scheduled batch job, edge middleware, queue consumer, or compiled utility. Deno is flexible enough to make that choice deliberately — and flexible enough to let you choose badly.

Deno Deploy is optimized for the edge request shape

Deno Deploy runs JavaScript and TypeScript close to users with a web-native programming model:

export default {
  async fetch(req: Request): Promise<Response> {
    const url = new URL(req.url);
    if (url.pathname === "/healthz") return new Response("ok");
    return new Response("hello", { headers: { "content-type": "text/plain" } });
  },
};

This is excellent for globally distributed request handling, lightweight APIs, and edge routing. It is not the natural home for arbitrary background daemons, large stateful jobs, or software that requires deep control of the host network.

Containers preserve operational control

A minimal container shape looks like:

FROM denoland/deno:2.1.4
WORKDIR /app
COPY deno.json deno.lock ./
COPY . .
RUN deno cache --frozen main.ts
USER deno
CMD ["run", "--frozen", "--allow-net=:8080", "--allow-env=DATABASE_URL", "main.ts"]

Containers let you control networking, filesystem layout, secrets injection, scaling, sidecars, observability, and runtime version. They also mean you own all of those things. Flexibility is not free.

VM deployment is still legitimate

For small teams, a VM with systemd can be simpler and safer than premature orchestration:

[Service]
User=app
WorkingDirectory=/opt/image-service
ExecStart=/usr/local/bin/deno run --frozen --allow-read=/var/lib/images --allow-net=:8080 main.ts
Restart=on-failure
AmbientCapabilities=
NoNewPrivileges=true

Deno permissions complement operating-system isolation; they do not replace it. NoNewPrivileges, dedicated users, filesystem permissions, and network policy still matter.

Match state and lifetime to the platform

Ask these questions before choosing:

Does the workload hold connections or in-memory state?
Does it need background execution after the response ends?
Does it require raw TCP, UDP, cron, or filesystem access?
Is latency sensitive to geography?
Does it need VPC/private network access?
Who owns patching, secrets, logs, metrics, and rollback?

The answer often produces a split architecture: edge handlers for geography, containers for private service logic, and jobs for batch work. That is not failure; it is correct sizing.

Field notes

  • Edge platforms can hide cold-start, execution-time, memory, and outbound-network constraints until production scale.
  • A compiled binary is portable packaging, not portable operating-system behavior.
  • Platform "Deno support" may mean a specific runtime subset; verify APIs before migrating.
  • Private networking is often the decisive constraint for managed edge deployment.
  • Choose rollback mechanics before deploy mechanics. If rollback requires a rebuild, you do not really have rollback.

Was this lesson helpful?

Sign in to rate