Skip to content

peteretelej/dserve

Repository files navigation

dserve

Serve any directory. Static file server that is fast, zero-config, and a single binary with support for live reload, TLS, SPAs, uploads, and more.

CI GitHub release Go Report Card license

Install

Download the latest release for Windows, macOS, Linux, or other platforms from Releases.

Or with Go:

go install github.com/peteretelej/dserve/v3@latest

Quick Start

dserve                    # Serve current directory
dserve --dir ./public     # Serve specific directory
dserve --live             # With live reload

Visit http://localhost:9011

Features

  • Zero config - Works out of the box
  • HTTPS - Auto-generated TLS certificates (-tls)
  • Live reload - Browser refresh on file changes (-live)
  • SPA mode - Fallback routing for React/Vue/etc (-spa)
  • File uploads - Drag & drop via web UI (-upload)
  • Directory download - Download folders as zip (-zip)
  • Compression - Gzip for text content (-compress)
  • Basic auth - Password protection (-basicauth)
  • Web UI - Modern directory listing with dark mode (-webui)

Examples

# Development with live reload
dserve --live

# Single-page application
dserve --spa --live

# Share files on local network
dserve --webui --upload --zip

# Secure with HTTPS (self-signed) and auth
dserve --tls --basicauth admin:secret123

# Custom TLS certificates
dserve --tls --tls-cert server.crt --tls-key server.key

All Flags

dserve -help
  -basicauth string
    	basic auth credentials (user:pass)
  -compress
    	enable gzip compression
  -dir string
    	directory to serve (default "./")
  -dotfiles
    	show and allow access to dotfiles (use with caution)
  -live string
    	enable live reload with watch pattern (default: * if flag present)
  -local
    	serve on localhost only
  -max-size string
    	maximum upload size (default "100MB")
  -port int
    	port to serve on (default 9011)
  -spa string
    	enable SPA mode with fallback file (default: index.html if flag present)
  -timeout duration
    	server timeout (default 3m0s)
  -tls
    	enable HTTPS
  -tls-cert string
    	TLS certificate file
  -tls-key string
    	TLS key file
  -upload
    	enable file uploads
  -upload-dir string
    	upload destination directory
  -webui
    	enable web UI for directory listing
  -zip
    	enable directory download as zip

Documentation

See docs/design.md for technical details.

Requirements

  • Go 1.21+ (for building from source)
  • Windows 10+ / macOS / Linux

Windows 7/8 users: use v2.2.4

License

MIT

About

dserve: Serve any directory. Static file server that is fast, zero-config, and a single binary with support for live reload, TLS, SPAs, uploads, and more.

Topics

Resources

License

Stars

Watchers

Forks

Packages