Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Deno 4 min read How-to mediumAdept

A Whole Website in a Single JavaScript File, cont'd

A 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.

Assumes: JSXHTTP request handlingHTML forms

Related posts

  • A Whole Website in a Single JavaScript File

    Deno mediumAdept

    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.

  • Build an Astro site with Deno

    Deno mediumAdept

    Deno 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.

  • Build and Ship Astro Sites with Deno and Deno Deploy

    Deno mediumAdept

    Astro 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.

  • How to Build a Blog with Fresh

    Deno mediumAdept

    A markdown blog can be built with Fresh, Deno's edge-first framework that ships zero client JavaScript by default, using file-based routes, custom GET handlers and server-side rendering. Posts are read from a posts directory with Deno.readDir, front matter is parsed with the std library's extract, and individual posts are served via a dynamic [slug].tsx route that renders markdown through the gfm module with its stylesheet. The finished site deploys to Deno Deploy by linking a GitHub repo with main.ts as the entry point.

  • Build a dinosaur runner game with Deno, pt. 1

    Deno mediumAdept

    Part one of a series building a browser dinosaur runner game sets up a Deno project that serves static files and deploys it. It covers `deno init`, adding the Oak framework from JSR, defining `dev` and `start` tasks in deno.json with explicit `--allow-net`/`--allow-read`/`--env-file` permissions, and a minimal Oak server that serves `public/` via `context.send`. It also adds an `/api` router with a health check endpoint, then deploys with `deno deploy` using `src/main.ts` as the entry point.

The quest for software engineering knowledge.

Look:
Layout: