A Whole Website in a Single JavaScript File
A demo multi-page website fits entirely in one JavaScript file and is server-rendered on demand at the edge with Deno. Routing uses a small `router` module built on `URLPattern`, and JSX is rendered server-side with `nanossr`, which styles via twind. Triple-slash reference comments select exactly which TypeScript libs (dom, dom.asynciterable, deno.ns) are loaded. Hosted on Deno Deploy, the site gets a perfect PageSpeed score and is served from 29 data centers over an anycast IP at no cost.
Related posts
- Fresh 1.0
Deno mediumAdeptFresh is a full stack web framework for Deno that renders pages just-in-time on the server and ships zero JavaScript to the client by default, using the islands architecture so only explicitly opted-in components are hydrated in the browser. It uses Preact and JSX/TSX on both server and client, has file-system routing with handlers for custom responses and async data loading, and has no build step: TypeScript and JSX are transpiled on demand, so deployments are near-instant. Version 1.0 is declared production-ready and is well suited to edge runtimes such as Deno Deploy, Netlify Edge Functions and Supabase Edge Functions.
- A Whole Website in a Single JavaScript File, cont'd
Deno mediumAdeptA complete bagel-search web app with server-side rendered JSX, dynamic routes and form handling fits in one Deno JavaScript file. The landing page looks up the visitor's IP through IP-API to render their city and local time. Per-bagel pages use router's URLPattern-based `/bagels/:id` matching. Search is a plain GET form whose querystring the server parses to filter results, so the site needs no client-side JavaScript or build step.
- Build and Ship Astro Sites with Deno and Deno Deploy
Deno mediumAdeptAstro sites can be built with the Deno runtime and hosted on Deno Deploy in two modes. Static output from `npm run build` is served via the Deno standard library file server and auto-deployed from GitHub Actions. Server-rendered apps use Astro's `output: "server"` mode with a Deno adapter, a generated `server/entry.mjs` entrypoint, and npm scripts rewritten to run Astro through `deno run -A --unstable npm:astro`. A template app shows SSR form handling in component scripts, client-side delete calls to an API route, and data persistence that can be switched to Deno KV.
- Build an Astro site with Deno
Deno mediumAdeptDeno 2's Node and npm compatibility lets you scaffold and run an Astro project entirely with Deno tooling: `deno -A npm:create-astro@latest` to scaffold, `deno install --allow-scripts` for dependencies, and `deno task dev` to run package.json scripts. The walkthrough builds a small dinosaur site with an index page generated from a JSON file and a dynamic SSR route (`[dinosaur].astro`) that reads `Astro.params` and redirects to 404 for unknown entries. One caveat: the Deno language server doesn't yet support `.astro` files, so editors may show false errors.
- Deno 1.35: A fast and convenient way to build web servers
Deno mediumAdeptDeno.serve() is now stable, replacing the connection-iterator Deno.serveHttp() pattern with a one-line handler built on web-standard Request and Response objects. Deno's benchmarks against Node 18.12.1 on a bare-metal Xeon show roughly twice the hello-world throughput, with better tail latency and memory use, and npm packages using node:http get the same speedup. The release also expands Node compatibility (http, https, http2, zlib Brotli), so axios, aws-sdk, puppeteer and astro now work. Other changes include LSP auto-imports for npm and import-map specifiers, an immutable rewrite of std/semver, new std html/entities and http/user_agent modules, V8 11.6 and TypeScript 5.1.6.