Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zero Dependencies Web Server (ZWS)

Development web server in a single Java source file on top of the JDK's built-in jdk.httpserver: serves static files, disables caching, and opens the browser automatically.

Prerequisites

Java 25 or later

Quick Start

curl -O https://raw.githubusercontent.com/AdamBien/zws/main/zws
chmod +x zws
./zws [root-directory]

The file has no .java extension, so launching it with java directly requires the source flag: java --source 25 zws [root-directory] — or use zws.sh, which does exactly that. Copy zws and zws.sh to a directory in your PATH for system-wide use.

  • Serves files from the current directory (or the specified root)
  • Listens on http://localhost:3000 (loopback only)
  • Opens the default browser
  • Sends no-cache headers on every response

Single Page Applications

Pass --single to serve SPAs with client-side routing:

./zws [root-directory] --single

GET requests for paths that do not exist on disk and have no file extension (client-side routes like /add) are answered with index.html, so deep links and reloads reach the application. Requests with a file extension (assets) still return 404, keeping typos visible.

Live Reload

Pass --live to reload connected browsers on file changes:

./zws [root-directory] --live

The site root is watched recursively, and served HTML pages get a one-line script injected before the closing body tag that listens on the /reload server-sent events endpoint and calls location.reload() on every change — pure web standards, no WebSockets, no client library. --live composes with --single: SPA-fallback responses reload too.

Example Projects

bce.design — vanilla WebComponents

ZWS is also bundled as the local dev server in airails.dev skills.

Demo

ZWS Demo

powered by airhacks.industries

About

Serve and Open (the browser). A zero-dependency development webserver shipping with a single Java file. No compilation, no installation required.

Topics

Resources

Stars

Watchers

Forks

Contributors