Web Design

Algernon – small self-contained pure-Go web server

Algernon is a mall self-contained pure-Go web server with Lua, Teal, Markdown, Ollama, HTTP/2, QUIC, Redis, SQLite and PostgreSQL support.

It uses Uses Bolt (built-in), MySQL, PostgreSQL, SQLite or Redis (recommended) for the database backend, permissions2 for handling users and permissions, gopher-lua for interpreting and running Lua, optional Teal for type-safe Lua scripting, http2 for serving HTTP/2, QUIC for serving over QUIC, gomarkdown/markdown for Markdown rendering, amber for Amber templates, Pongo2 for Pongo2 templates, Sass(SCSS) and GCSS for CSS preprocessing. logrus is used for logging, goja-babel for converting from JSX to JavaScript, tollbooth for rate limiting, pie for plugins and graceful for graceful shutdowns.

This is free and open source software.

Key Features

  • Supports HTTP/2, with or without HTTPS (browsers may require HTTPS when using HTTP/2).
  • Also supports QUIC and regular HTTP.
  • Can use Lua scripts as handlers for HTTP requests.
  • The Algernon executable is compiled to native and is reasonably fast.
  • Works on Linux, macOS and 64-bit Windows.
  • The Lua interpreter is compiled into the executable.
  • The Teal typechecker is loaded into the Lua VM.
  • Live editing/preview when using the auto-refresh feature.
  • The use of Lua allows for short development cycles, where code is interpreted when the page is refreshed (or when the Lua file is modified, if using auto-refresh).
  • Self-contained Algernon applications can be zipped into an archive (ending with .zip or .alg) and be loaded at start.
  • Built-in support for Markdown, Pongo2, Amber, Sass(SCSS), GCSS and JSX.
  • Redis is used for the database backend, by default.
  • Algernon will fall back to the built-in Bolt database if no Redis server is available.
  • The HTML title for a rendered Markdown page can be provided by the first line specifying the title, like this: title: Title goes here. This is a subset of MultiMarkdown.
  • No file converters needs to run in the background (like for SASS). Files are converted on the fly.
  • If -autorefresh is enabled, the browser will automatically refresh pages when the source files are changed. Works for Markdown, Lua error pages and Amber (including Sass, GCSS and data.lua). This only works on Linux and macOS, for now. If listening for changes on too many files, the OS limit for the number of open files may be reached.
  • Includes an interactive REPL.
  • If only given a Markdown filename as the first argument, it will be served on port 3000, without using any database, as regular HTTP. This can be handy for viewing README.md files locally.
  • Use -m to display it in a browser and only serve it once.
  • Full multi-threading. All available CPUs will be used.
  • Supports rate limiting, by using tollbooth.
  • The help command is available at the Lua REPL, for a quick overview of the available Lua functions.
  • Can load plugins written in any language. Plugins must offer the Lua.Code and Lua.Help functions and talk JSON-RPC over stderr+stdin. See pie for more information. Sample plugins for Go and Python are in the plugins directory.
  • Thread-safe file caching is built-in, with several available cache modes (for only caching images, for example).
  • Can read from and save to JSON documents. Supports simple JSON path expressions (like a simple version of XPath, but for JSON).
  • If cache compression is enabled, files that are stored in the cache can be sent directly from the cache to the client, without decompressing.
  • Files that are sent to the client are compressed with gzip, unless they are under 4096 bytes.
  • When using PostgreSQL, the HSTORE key/value type is used (available in PostgreSQL version 9.1 or later).
  • No external dependencies, only pure Go.
  • Requires Go >= 1.21 or a version of GCC/gccgo that supports Go 1.21.
  • The Lua implementation used in Algernon (gopherlua) does not support package.loadlib.

Website: github.com/xyproto/algernon
Support:
Developer: Alexander F. Rødseth
License: BSD 3-Clause “New” or “Revised” License

Algernon is written in Go and Lua. Learn Go with our recommended free books and free tutorials. Learn Lua with our recommended free books and free tutorials.


Related Software

Web Servers
nginxVery powerful and efficient web server powering the top web sites
ApacheLike nginx, Apache is a hugely popular web server
CaddyPowerful, enterprise-ready web server written in Go
LwanExperimental, scalable, high performance HTTP server
H2OOptimized HTTP/1.x, HTTP/2, HTTP/3 server
TengineDistribution of nginx
lighttpdFast, compliant and very flexible low memory footprint web server
FerronWeb server optimized for speed, security and efficiency
AngieScalable web server that was forked from nginx
AlgernonSmall self-contained pure-Go web server
Node.jsServer-side JavaScript environment for network applications
HiawathaWeb server that focuses on security
OpenLiteSpeedLightweight HTTP server
rwasaFull-featured high performance web server
devdLocal web server for developers
CherokeeFast, flexible and embeddable web server

Read our verdict in the software roundup.


Best Free and Open Source Software Explore our comprehensive directory of recommended free and open source software. Our carefully curated collection spans every major software category.

This directory is part of our ongoing series of informative articles for Linux enthusiasts. It features hundreds of detailed reviews, along with open source alternatives to proprietary solutions from major corporations such as Google, Microsoft, Apple, Adobe, IBM, Cisco, Oracle, and Autodesk.

You’ll also find interesting projects to try, hardware coverage, free programming books and tutorials, and much more.

Discovered a useful open source Linux program that we haven’t covered yet? Let us know by completing this form.
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments