Deno
The Deno adapter wraps Deno.serve: the stable, modern entry point that replaced the old Deno.serveHttp. It handles SIGTERM/SIGINT for you and also accepts an AbortSignal, the pattern Deno itself recommends.
When to choose Deno
- You want a web-standard runtime with TypeScript built in and no transpile step.
- You self-host in a container running the official Deno image.
- You like Deno's permissions model and don't need the full npm ecosystem.
- You are fine with an upstream runtime in maintenance mode. For a new project with a long life ahead, Node, Bun, or Cloudflare Workers are the safer picks today.
Scaffold
The deno-basic template ships a Deno-native server with a deno.json import map, watch-mode dev, and deno test.
Install
The same source ships to two registries: npm as @daloyjs/core and JSR as @daloyjs/daloy. The deno-basic template loads the npm package through Deno's npm: specifier, the same package the Node, Bun, Workers, and Vercel templates install, so it does not depend on JSR's hosting:
Prefer JSR? It is still published from every release, with the same import names:
Minimal server
That is all you need for graceful shutdown. serve() listens for SIGTERM and SIGINT itself (handleSignals defaults to true), drains your app.onShutdown hooks for up to shutdownTimeoutMs (default 10 seconds), and then stops Deno.serve so in-flight requests can finish. Do not add your own Deno.addSignalListener calls on top.
To stop the server from your own code, for example in a test, use the handle serve() returns or pass an AbortSignal:
Other options: onError returns a fallback Response when the handler itself throws, and shutdownTimeoutMs changes the drain budget. The full list is in the API reference.
Run it
Dockerfile
The container route keeps working whatever happens to Deno Deploy. Run it on any container host: Fly.io, Render, Railway, Google Cloud Run, Azure Container Apps, or your own Kubernetes.
Moving off Deno Deploy
Your DaloyJS app does not change when you move: routes, schemas, and hooks only ever see Request -> Response. Only the entry file changes. Pick a target:
Cloudflare Workers
The closest match to Deno Deploy (global, per-request, no servers), and Cloudflare offers migration help to paying Deno Deploy customers. Swap the entry file for the Workers one:
Then follow the Cloudflare Workers guide for wrangler.jsonc, secrets, and bindings. Replace Deno.env.get(...) with Worker bindings and Deno.* file APIs with R2 or KV.
Self-hosted Deno in a container
Keep src/server.ts exactly as it is and ship the Dockerfile above. This is the smallest change, but you stay on a runtime in maintenance mode.
Node or Bun
Import serve from @daloyjs/core/node or @daloyjs/core/bun instead of /deno, swap the jsr:/npm: import map for a package.json, and replace Deno.* APIs with their Node equivalents. See the Node and Bun guides.
Whichever you pick, run your contract tests against the new entry before you switch traffic. The app should answer the same way it did on Deno Deploy.
Gotchas
- Do not use
Deno.serveHttp. It is deprecated. The DaloyJS adapter usesDeno.serveexclusively. - Platform-managed hosts (Deno Deploy, Netlify Edge Functions, Supabase Edge Functions) never send your code
SIGTERM. The built-in signal handling only matters when you run the Deno process yourself. - Use
--allow-net(and others) explicitly, Deno's default-deny permissions are the point.
Request target and Host
Deno.serve builds request.url from the raw Host header and request line. The adapter checks it before your app runs: a Host that is not a plain host[:port] (userinfo, a backslash, an escape) is answered with 400, and a path that URL parsing would rewrite (\, .., %2e) is canonicalized first. The router and path-based guards such as except() therefore always see the same path. The scaffolded deno.json also sets "minimumDependencyAge": "P1D", the 24-hour cooldown the other templates get from their package manager.
See also
- Adapters overview
- Cloudflare Workers: the usual next home for Deno Deploy apps.
- Netlify Edge Functions: also Deno-based.