// the find
elixir-plug/plug
Compose web applications with functions
Plug is the HTTP middleware/connection spec that Phoenix and most of the Elixir web ecosystem sit on top of — a tiny contract (init/1 + call/2) plus a connection struct and a set of webserver adapters (Cowboy, Bandit). It's for Elixir developers building anything HTTP, whether that's a full Phoenix app or a bare-metal service that doesn't need a framework.
The plug contract is genuinely minimal — two functions and an immutable struct — so pipelines are easy to trace and test without mocking a framework. Plug.Router compiles routes into a single function that the BEAM turns into a tree lookup instead of linear matching, so routing stays fast as routes grow. It abstracts the webserver layer cleanly: switching Cowboy for Bandit is a one-line supervisor change, not a rewrite. Ships with the boring-but-necessary middleware already done — CSRF, SSL enforcement, static files, request IDs, telemetry hooks — so you're not rebuilding that layer yourself.
Plug.Router requires a catch-all match block or you get a raw function clause error instead of a 404, which is a sharp edge for anyone who hasn't internalized that routing is just pattern matching. Support is thin for anything beyond the current release: only the latest minor gets bug fixes, the last four get security patches only, so pinning an older version ages out fast. It's intentionally low-level — no opinion on request logging format, rate limiting, or structured error pages beyond Plug.Debugger/ErrorHandler, so anyone using it outside Phoenix ends up hand-rolling conventions Phoenix would otherwise give for free. Multipart parsing and body parsers are configuration-heavy and the defaults (upload limits, allowed content types) are easy to leave unexamined until a bad request exposes them.