About
Elixir by Example is a hands-on introduction to Elixir, OTP and distributed systems through small, annotated programs, in the spirit of Go by Example. It is written and maintained by Maheep Kumar.
How it works
Every example is a plain .exs file. When the site is built, each one
runs on Elixir 1.20.5 / Erlang/OTP 29 and the
output you see on the page is the output of that run. An example that fails,
times out or prints a compiler warning stops the build.
The Run buttons boot the Erlang virtual machine in your browser, compiled to WebAssembly, and run the example there. Your code never leaves your browser; the only thing sent is an anonymous count of runs per page (no cookies, no IP addresses). Before every deploy, each example is also run in a headless browser and its output compared with the native run.
Spotted a mistake or want an example? Open an issue or send a pull request; the source is MIT licensed.
Built on
This site exists thanks to these open-source projects and their maintainers:
- Elixir, the language, created by José Valim and developed by the Elixir team and community.
- Erlang/OTP, the BEAM virtual machine and the OTP libraries, originally from Ericsson and maintained by the OTP team.
- Popcorn by Software Mansion, which runs the BEAM in the browser via WebAssembly. Earlier versions were built on AtomVM, the lightweight BEAM implementation for microcontrollers.
- Emscripten and WebAssembly, which make that possible.
- Makeup for syntax highlighting, the same highlighter ExDoc uses.
- MDEx (built on comrak) for Markdown.
- Phoenix LiveView's HEEx templates for the pages, and Bandit for local previews.
- Credo and Dialyxir for keeping the generator honest, and Playwright for testing every example in a real browser.
- Go by Example by Mark McGranaghan and Eli Bendersky for the format, and Livebook for the idea of connected, runnable cells.
Elixir and Erlang are trademarks of their respective owners. This is an independent project, not affiliated with or endorsed by the Elixir team, the Erlang/OTP team or Software Mansion.