Shitty Go HTTP server designed for static sites with RAM caching.
  • Go 75.9%
  • Shell 24.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-08-14 08:54:45 +00:00
.gitignore working server with RAM cache, file watcher, and --bind/--port/--serve flags 2026-08-09 23:42:33 -05:00
cache.go add logging levels (--log normal/detail/error) and security hardening (symlink escape prevention, path traversal fix) 2026-08-09 23:50:50 -05:00
go.mod working server with RAM cache, file watcher, and --bind/--port/--serve flags 2026-08-09 23:42:33 -05:00
go.sum working server with RAM cache, file watcher, and --bind/--port/--serve flags 2026-08-09 23:42:33 -05:00
install.sh Make sure fsnotify watches dir changes 2026-08-14 02:54:50 -05:00
logging.go add --log none and release.sh 2026-08-10 00:51:03 -05:00
main.go add logging levels (--log normal/detail/error) and security hardening (symlink escape prevention, path traversal fix) 2026-08-09 23:50:50 -05:00
README.md Re-work readme 2026-08-14 08:54:45 +00:00
release.sh Make release.sh read token from .env and auto-increment version 2026-08-14 02:58:11 -05:00
server.go add logging levels (--log normal/detail/error) and security hardening (symlink escape prevention, path traversal fix) 2026-08-09 23:50:50 -05:00
utils.go add go.mod, utils.go (ported from gohttpserver), and cache.go (InMemoryFileSystem) 2026-08-09 23:31:42 -05:00
watcher.go Make sure fsnotify watches dir changes 2026-08-14 02:54:50 -05:00

Crankshaft

a minimal, Go high-performance HTTP static file server with RAM caching.

loads your entire site into memory on startup, serves it from RAM (for speed on static sites)

usage

Default:
./crankshaft
(serves site/, on port 80. on all addresses)
Arguements:
--port (Select with port to serve on) Default: 80
--bind (which address to serve on) Default: 0.0.0.0
--serve (select which folder or file to serve) Default ./site
Examples:
# serve a specific directory on a custom port and address
./crankshaft --port 8080 --bind 127.0.0.1 --serve ./my-site

# serve a single file
./crankshaft --port 8080 --serve ./index.html

how it works

  1. on startup, walks the serve directory and loads every file into RAM (under 50mb)
  2. files are stored in a map[string]*cacheEntry with their content, content-type, and a pre-compressed gzip variant
  3. a background goroutine runs to watch for file changes and updates the cache instantly

building

go build -o crankshaft .

requires Go 1.26+ and fsnotify.

performance

by serving from RAM instead of disk, you eliminate:

  • disk i/o latency on every request
  • kernel context switches for file reads
  • filesystem metadata lookups pre-compression means gzip is done once at load time, not per-request. This is GREAT for slow disks, or/and slow CPUs.

license

MIT