Redbean web server and the Fullmoon framework

I recently learned about Redbean, a single-file distributable web server authored by Justine Tunney.

redbean is an open source webserver in a zip executable that runs on six operating systems. The basic idea is if you want to build a web app that runs anywhere, then you download the redbean.com file, put your .html and .lua files inside it using the zip command, and then you’ve got a hermetic app you can deploy and share.

If the above sounds like magic that’s because it kind of is. Zip a directory of files, execute it, and you get the following running out of the box, across six operating systems:

  • A fast static-file server
  • Support for Lua scripts
  • Embedded SQLite
  • Integrated SSL support
  • HTTP/HTTPS client
  • Crypto and password hashing
  • DDOS protection

It doesn’t get any easier than this if you’re hosting a static website on a server. Generate some SSL certificates using cerbot, bind Redbean to port 80/443 and off you go!

Fullmoon

Paul Kulchenko authored Fullmoon, a zero depedency web framework based on Redbean. With it, you get:

  • Routing, redirects
  • Templating
  • Streamed responses
  • Cookies/Sessions
  • Form validation
  • Cron syntax
  • DB management with migrations

This is quite incredible. You can use this to build full-fledged web application.

The vertically integrated web server

A typical webapp using PHP, Python, or Node.js requires you to put a webserver like NGINX in front of it. This separation of concerns makes sense for many reasons, but it still represents extra complexity and overhead. A seasoned engineer might not fret, but less experienced developers tend to struggle here.

A web server like Caddy bridges this gap for certain use cases. Its built-in support for templated responses and custom plugins may allow you to forego a backend for dynamic responses. Yet, you’ll quickly hit the limits of what you can do as it is still first and foremost a web server.

What excites me about Redbean and Fullmoon is that you get a vertically integrated web server and web application. Of course, there are many other considerations to account for a serious project but this makes sense for a lot of projects out there. Throw in htmx to the mix and you get an accessible, minimal yet capable stack that is easy to deploy.