Skip to content

Instantly share code, notes, and snippets.

@bartlomieju
Created March 12, 2026 10:17
Show Gist options
  • Select an option

  • Save bartlomieju/f32ef233f3b6a1617eb57ecb0ae90504 to your computer and use it in GitHub Desktop.

Select an option

Save bartlomieju/f32ef233f3b6a1617eb57ecb0ae90504 to your computer and use it in GitHub Desktop.

What is a Dev Server?

A dev server is a local HTTP server optimized for the development loop. Its job is to serve your application locally with features that make iteration fast.

Core Features

  • Hot Module Replacement (HMR) — when you save a file, only the changed module is swapped in the browser without a full page reload. State (like form inputs, scroll position) is preserved.
  • On-demand transformation — instead of bundling everything upfront, modules are transformed (TypeScript → JS, JSX → JS, etc.) only when the browser requests them. This makes startup near-instant even for large projects.
  • File watching — monitors the filesystem and triggers rebuilds/HMR updates.
  • Error overlay — compilation errors are shown directly in the browser.

How Vite Does It

  • Uses native ES modules in the browser during dev. The browser sends import requests, and Vite intercepts them, transforms the file on the fly, and serves it.
  • Pre-bundles dependencies (node_modules) with esbuild for speed, but your source code is served unbundled.
  • Injects a small HMR client via WebSocket that listens for updates.
  • vite dev starts the server, typically on localhost:5173.

How Bun Does It

  • bun --hot runs a script and hot-reloads it on file changes (server-side HMR).
  • For frontend, Bun's bundler can serve files, but it's less mature than Vite's dev server.
  • The pitch is speed — Bun's native TypeScript/JSX support means less transformation overhead.

What Would a Deno Dev Server Entail?

Deno already has some pieces:

  • deno serve — runs an HTTP server from a file exporting a fetch handler. It watches for changes with --watch and restarts.
  • Native TypeScript/JSX — no transpilation step needed for server-side code.
  • --watch flag — available on deno run, restarts the process on file changes.

What's Missing Compared to a Full Vite-like Dev Server

  1. Frontend asset serving with on-demand transforms — serving .tsx/.ts files to the browser as ES modules, transpiled on the fly. The browser can't consume TypeScript natively, so something needs to transform it before serving.

  2. HMR protocol — a WebSocket connection to the browser that pushes granular module updates instead of full page reloads. This requires an HMR client runtime injected into the HTML and an HMR API (like import.meta.hot).

  3. CSS/asset handling — processing CSS imports, CSS modules, static assets, etc.

  4. Dependency pre-bundling — npm packages with CJS or many small files need bundling for browser performance (hundreds of individual HTTP requests are slow even with HTTP/2).

Should Deno Have One?

Arguments For

  • Deno already transpiles TS/JSX natively — it could serve browser-ready code with minimal overhead, no extra tooling needed.
  • "Zero config" story: deno dev could just work for a frontend project without installing Vite, webpack, etc.
  • Bun is marketing this as a differentiator, so there's competitive pressure.
  • Aligns with Deno's "batteries included" philosophy.

Arguments Against

  • Vite is excellent and widely adopted. Building a competitive dev server is a massive surface area (plugins, framework integrations, CSS preprocessors, etc.).
  • Deno could focus on being a great Vite backend instead (Vite already has experimental Deno support).
  • Maintenance burden — frontend tooling moves fast and has many edge cases.

How Users Would Use It (Hypothetically)

# Start dev server for a frontend project
deno dev

# Or with explicit entry
deno dev --port 3000 index.html

It would scan your HTML for <script> tags, serve those files with on-demand TS/JSX transformation, inject an HMR client, and watch for changes. Frameworks like Fresh already do a version of this within Deno's ecosystem.

Pragmatic Middle Ground

The pragmatic middle ground (which Deno seems to be pursuing with Fresh and deno serve --watch) is: provide great server-side DX natively, and integrate well with Vite for frontend-heavy projects rather than reinventing the entire frontend dev server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment