Description
Plug is a specification for composing web applications from functions in Elixir, and a set of connection adapters for the web servers that run on the Erlang VM. It lets you build a web application from small pieces and run it on different servers, and it is the layer that web frameworks such as Phoenix use to handle requests, responses and WebSockets. Plugs are either module plugs, which define init and call functions, or function plugs. The README gives a hello-world example with the Cowboy server through the plug_cowboy package, and another that uses the Bandit server with the websocket_adapter project for WebSocket support. Plug.Router gives a simple way to define routes and steps, such as request logging, that run on every request. For production, the README shows how to start the pipeline under an application's supervision tree. Version 1.14 added a connection upgrade API for WebSocket support. The project is open source on GitHub.…
Highlights
- Compose web apps from functions in Elixir
- Adapters for Cowboy and Bandit servers
- WebSocket support through connection upgrades
- Plug.Router for routes and request steps
Ratings & Reviews
No ratings yet
Be the first to rate Plug.
People also visit
Plug FAQ
What is Plug?
A specification and library for composing web applications from functions in Elixir, with adapters for web servers on the Erlang VM.
Which servers can I use?
Cowboy through the plug_cowboy package, or Bandit through the bandit package, according to the installation section.
Does it support WebSockets?
Yes. Plug v1.14 includes a connection upgrade API, and the README shows a WebSocket example with Bandit.
Is it free?
Yes. The source is public on GitHub, so it is open source.
What are the best Plug alternatives?
Popular alternatives to Plug include Broadway Dashboard, Desktop and Keter. See all Plug alternatives





