xyproto/algernon

Small self-contained pure-Go web server with Lua, Teal, Markdown, HTTP/2, QUIC, Redis, TypeScript, npm-less React 19, SQLite, and PostgreSQL support ++

Algernon – a single‑binary web server with built‑in scripting and optional LLM support

What it is – Algernon is a self‑contained Go executable that serves HTTP/1, HTTP/2 and HTTP/3 (QUIC) traffic. It can render a wide range of file types (Markdown, Pongo2, Amber, Sass/SCSS, GCSS, JSX/TSX, Lua, Teal, etc.) and can run Lua/Teal scripts as request handlers. It ships with an embedded key‑value store (BoltDB) and can also talk to Redis, Valkey, PostgreSQL, SQLite, MariaDB/MySQL, or MSSQL. A small plugin system lets you extend the server with external programs.

Why it matters – For developers who want a quick, zero‑dependency way to prototype a web site or API, Algernon removes the need for a separate web server, build pipeline, and database server. All the tooling (template engines, CSS preprocessors, JSX/TSX bundling via esbuild, auto‑refresh via Server‑Sent Events) lives inside the binary, so you can drop a single file on a machine and start serving content.

Key capabilities

  • Protocol support – HTTP/2 over TLS by default, optional HTTP/3 (QUIC), plain HTTP fallback.
  • Scripting – Lua (via gopher‑lua) and Teal (typed Lua) can be used as request handlers; a data.lua file can expose functions to templates.
  • Template & markup – Markdown → HTML, Pongo2, Amber, Sass/SCSS, GCSS, JSX/TSX (transpiled with esbuild), HyperApp, React‑style JSX.
  • Database back‑ends – Built‑in BoltDB, or external Redis/Valkey, PostgreSQL, SQLite, MariaDB/MySQL, MSSQL.
  • Rate limiting – Integrated tollbooth middleware.
  • Auto‑refresh – Server‑sent events automatically reload the browser when source files change (Linux/macOS).
  • Plugin system – Any language can provide a plugin that implements Lua.Code and Lua.Help over JSON‑RPC (pie library).
  • LLM integration – When an Ollama server is reachable, Lua scripts can call ollama() or OllamaClient to generate text, run code, or compute vector distances between prompts.
  • Packaging – Applications can be zipped (.zip or .alg) and launched directly; a Docker image (~17 MiB) is provided.

Typical workflow

  1. Create a directory for your site.
  2. Add an index.lua, index.md, index.pongo2, index.jsx, etc., depending on the language you prefer.
  3. Optionally add a data.lua to expose data‑access functions to the templates.
  4. Run algernon -e (dev mode) or algernon --autorefresh to start the server.
  5. Edit files; the browser refreshes automatically.
  6. For production, supply TLS certificates (--cert, --key) and switch to HTTP/2 or HTTP/3.

Who should use it – Hobbyists, educators, and small‑team developers who want a fast‑to‑prototype web stack without configuring Nginx, Node, or separate build tools. It also appeals to Lua/Teal enthusiasts and to anyone who wants to experiment with on‑the‑fly LLM calls via Ollama.

Limitations

  • Not a high‑performance CDN‑grade server; specialized servers will beat it in raw throughput.
  • Auto‑refresh works only on Linux/macOS.
  • The embedded Lua interpreter cannot load native libraries (package.loadlib).
  • LLM features depend on an external Ollama server; the binary itself does not ship any model.

Getting startedgo install github.com/xyproto/algernon@latest or pull a pre‑built binary, create an index.lua with print("Hello, World!"), and visit http://localhost:3000/. The repository includes a welcome.sh script and a samples collection to explore all supported file types.


TL;DR – Algernon is a Go‑written, all‑in‑one web server that lets you serve static files, run Lua/Teal scripts, render modern front‑end assets, and optionally call Ollama LLMs, all from a single executable.

Related

  • Project
  • Project
  • Project
  • Project
  • Project