Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fast-http-server

Super fast, zero configuration command line HTTP Server written in Crystal.

Stars CI Release Crystal License Built with Crystal


Quick Start

crystal run src/fast-http-server.cr

Or build and run:

shards build --release
./bin/fast-http-server

Open http://localhost:3000 - done. 🚀


Features

  • Zero config - Run and go, defaults to port 3000
  • 📁 Static file serving - Serves files from current directory or specified path
  • 🔗 Index redirect - Automatically redirects /blog/ to /blog/index.html
  • 📂 Directory listing - Browse directories in browser (can be disabled)
  • 🚀 25K req/sec - Fast enough for most use cases

Why fast-http-server?

Problem Solution
"I just need to serve static files quickly" One command, no config
"Python http.server is slow" Crystal native speed, 25K req/sec
"I don't want Node/npm for a static server" Single binary, no dependencies
"I need directory listing" Built-in, toggle on/off

Usage

fast-http-server [port]
Argument Default Description
port 3000 Port to listen on
-d, --directory . Directory to serve
-l, --listdir yes Enable/disable directory listing

Examples

# Serve on port 5050
fast-http-server 5050

# Serve a specific directory
fast-http-server -d ./public

# Disable directory listing
fast-http-server -l no -d ./public

Installation

Option 1: Build from source

Requires Crystal 1.0+.

git clone https://github.com/sdogruyol/fast-http-server
cd fast-http-server
shards build --release
mv bin/fast-http-server /usr/local/bin/fast-http-server

Option 2: Quick alias

Add to your .bashrc, .zshrc, or config file:

alias fhs='fast-http-server'

Performance

~25,000 requests/sec on modest hardware.

wrk -c 100 -d 20 -t 4 http://localhost:3000

Requests/sec:  25102.60
Transfer/sec:  22.81MB
Latency (avg): 3.98ms
Latency (p99): 5.86ms

FAQ

How is this different from Python's http.server?

fast-http-server is ~50x faster, written in Crystal, and supports directory listing with index redirect out of the box.

Does it support HTTPS?

Not yet. For production, put it behind a reverse proxy like nginx or Caddy.

Can I use it in production?

It's designed for development and quick file sharing. For production, use nginx or Caddy.


Sponsors

If fast-http-server helps you, consider sponsoring. Every dollar helps me keep building open source tools full time.

Sponsor


License

MIT

About

Super fast, zero configuration command line HTTP Server.

Resources

Stars

169 stars

Watchers

4 watching

Forks

Releases

Packages

Used by

Contributors

Languages