Back to services

Algernon

Small self-contained pure-Go web server with Lua, Markdown, HTTP/2, QUIC, Redis and PostgreSQL support.

View alternatives to Algernon
Suggest edit
Open source
Self-hostable
BSD-3-Clause
Recent reviews

Alternatives

Tech stack

No tech stack added yet. Sign in to suggest some

Overview

Algernon is a web server written in pure Go, with all of its features packed into a single small, standalone executable. It supports QUIC, HTTP/2, Lua, Teal, Markdown, Pongo2, HyperApp, Amber, Sass (SCSS), GCSS, JSX and Ollama (large language models). For databases, it has BoltDB built in, and it can also connect to Redis/Valkey, PostgreSQL, SQLite, MariaDB/MySQL and MSSQL. It also offers rate limiting, graceful shutdown, plugins, and user and permission management. The project is open source under the BSD-3 license, and its author is Alexander F. Rødseth.

Key Features

  • Modern protocols: When a certificate and key are provided, it serves HTTP/2 over HTTPS by default. You can also enable QUIC (HTTP/3) with a flag, or use plain HTTP only. TLS 1.3 is supported.
  • Lua/Teal scripting for handling requests: It includes a built-in gopher-lua interpreter, and index.lua can serve directly as a directory's request handler. Teal adds type safety on top of Lua. Changes take effect when you refresh the page, so the development cycle is very short.
  • Live rendering of many page formats: It supports Markdown, Pongo2, Amber, HTML and JSX (React/HyperApp), and styles can be written in CSS, Sass (SCSS) or GCSS. Files are converted on the fly, on demand, so you don't need to run a separate conversion process in the background.
  • Database backends: It uses Redis by default, and automatically falls back to the built-in Bolt file database when Redis isn't available. Lua provides database-backed data structures such as Set, List, HashMap and KeyValue, and you can also query PostgreSQL and MSSQL directly.
  • Users and permissions: By default, /data and /repos require user permissions, /admin requires admin permissions, and all other paths are public; all of this is configurable. A full set of Lua APIs is provided for registration, confirmation codes, login, cookies and password hashing (bcrypt/sha256).
  • AI integration: It can call a local Ollama to generate content, describe images and calculate text similarity. .prompt files can use a large language model to generate web page content, and the results are cached.
  • Other: Auto-refresh (based on Server-Sent Events), an interactive Lua REPL, a plugin system (plugins can be written in any language and communicate over JSON-RPC), file caching and gzip compression, rate limiting, reverse proxying, Combined Log Format access logs (which work with goaccess), automatic Let's Encrypt certificates, file uploads, JSON document reading and writing, an HTTP client, and more.

Target Users and Use Cases

Algernon suits developers who want to build dynamic websites or prototypes quickly with minimal configuration, people who like writing backend logic in Lua, and users who need to preview Markdown documents locally. In the author's words, it isn't necessarily the best at any single thing; its strengths are its broad coverage and minimal configuration, combined with a plugin system and Lua programming capabilities.

Installation and Deployment

  • Go install (requires Go 1.21 or later): go install github.com/xyproto/algernon@latest
  • macOS: brew install algernon
  • Arch Linux: pacman -S algernon
  • Docker: The image is under 12MB, for example docker run -it -p4000:4000 -v .:/srv/algernon xyproto/algernon
  • The GitHub Releases page offers prebuilt binaries for many platforms and architectures.

Quick start: Run algernon -e to enter development mode (debug mode, built-in Bolt database, plain HTTP), then create an index.lua file containing print("Hello, World!") and open it in your browser. The default port is 3000. algernon -m README.md lets you preview a Markdown file directly in the browser.

Technical Requirements and Notes

  • It supports Linux, macOS and 64-bit Windows. It is implemented in pure Go with no external dependencies, and can also run on platforms such as NetBSD and the Raspberry Pi.
  • The auto-refresh feature currently only supports Linux and macOS, and requires port 5553 to be available.
  • The gopher-lua it uses does not support package.loadlib.
  • Applications can be packaged as .alg files (which are .zip files) and loaded directly, and the bundled alg2docker tool can turn them into Docker images.
  • It includes a built-in Lua runtime and can also be used as a standalone Lua interpreter (algernon -lua main.lua).