Gleam
A type-safe functional language for the Erlang VM and JavaScript runtimes, with friendly syntax and a focus on simplicity.
Created by Louis Pilfold
Gleam is a type-safe functional programming language that compiles to both Erlang (BEAM bytecode) and JavaScript. Created by Louis Pilfold, it brings static typing and friendly error messages to the battle-tested Erlang virtual machine while maintaining a deliberately small and simple language design.
History & Origins
Gleam was created by Louis Pilfold in 2016, initially developed for a conference talk. Pilfold saw an opportunity to combine the reliability and concurrency of the Erlang VM with modern language features like static typing and helpful compiler errors that were missing from existing BEAM languages.
The first numbered release (v0.1) came on April 15, 2019. The language steadily evolved through the 0.x series, adding a JavaScript compilation target in 2021 (v0.16), which allowed Gleam code to run in browsers and Node.js alongside the traditional BEAM target.
The Gleam v1.0.0 milestone was reached on March 4, 2024, signaling language stability and a commitment to backward compatibility.
The Problem Gleam Solves
The Erlang VM (BEAM) is renowned for building concurrent, fault-tolerant systems. However, existing BEAM languages had limitations:
- Erlang has dynamic typing and unfamiliar syntax for many developers
- Elixir brought modern syntax but remained dynamically typed
- Alpaca explored static typing on BEAM but didn’t gain traction
Gleam addresses these by providing:
- Static type checking with helpful error messages at compile time
- Type inference so you rarely need to write type annotations
- No null values and no exceptions for safer code
- Familiar C-family syntax that’s approachable for most developers
- Full interoperability with Erlang and Elixir libraries
The Name
The name “Gleam” was chosen because it is both a synonym of and rhymes with “BEAM” - the name of the Erlang virtual machine that Gleam runs on.
Language Design Philosophy
Gleam takes a deliberately minimalist approach. The official FAQ describes it as aiming to be “small” and “consistent.” Notable design choices include:
- No macros - Code is explicit and predictable
- No type classes or traits - Simplicity over abstraction power
- No mutable state - All data structures are immutable
- No null - The
Optiontype handles missing values - No exceptions - The
Resulttype handles errors - Pattern matching - The primary control flow mechanism
This philosophy means Gleam is easy to learn and read, even if you’ve never seen it before.
Dual Compilation Targets
One of Gleam’s distinctive features is compiling to both Erlang and JavaScript:
Erlang/BEAM target:
- Access to Erlang’s actor-based concurrency model
- Millions of lightweight processes
- Hot code upgrades
- Decades of telecom-grade reliability
JavaScript target:
- Runs in browsers and Node.js
- Share code between server and client
- Access to the JavaScript ecosystem
The same Gleam code can target either platform, though platform-specific code uses conditional compilation.
The Type System
Gleam’s type system catches errors at compile time:
| |
Pattern matching with exhaustiveness checking ensures you handle every case:
| |
Tooling
Gleam includes a comprehensive built-in toolchain (written in Rust):
gleam new- Create new projectsgleam run- Compile and executegleam test- Run testsgleam add- Manage dependenciesgleam format- Auto-format codegleam docs- Generate documentation
The toolchain includes a built-in Hex client for package management (sharing the same package repository as Erlang and Elixir) and a Language Server Protocol (LSP) implementation for editor support.
Gleam vs. Other BEAM Languages
| Feature | Gleam | Erlang | Elixir |
|---|---|---|---|
| Type system | Static | Dynamic | Dynamic |
| Null values | None | Atoms | nil |
| Error handling | Result type | Exceptions | Exceptions |
| Macros | None | Limited | Extensive |
| Syntax style | C-family | Prolog-derived | Ruby-inspired |
| JS target | Built-in | No | No |
Gleam complements rather than replaces Erlang and Elixir - it can call into both ecosystems directly.
The Gleam Community
Gleam has a growing and welcoming community:
- gleam.run - Official website with language tour and documentation
- Gleam Discord - Active community chat
- packages.gleam.run - Package discovery
- Hex.pm - Package repository (shared with Erlang/Elixir)
- Gleam Gathering - Community conference (inaugural event in February 2026)
The language appeared in the Stack Overflow Developer Survey in 2025, where it ranked as the second most admired language (behind Rust) among developers who use it.
Timeline
Notable Uses & Legacy
Lustre
A web framework for building HTML templates, single-page applications, and real-time server components in Gleam.
Wisp
A practical backend web framework for Gleam with composable middleware and type-safe routing.
Gleam Package Index
The official package discovery site (packages.gleam.run) for the Gleam ecosystem, built with Gleam.
Gloogle
A search engine for the Gleam ecosystem, built with Lustre and Wisp.
Language Influence
Influenced By
Running Today
Run examples using the official Docker image:
docker pull ghcr.io/gleam-lang/gleam:v1.14.0-erlang-alpineExample usage:
docker run --rm -v $(pwd):/work ghcr.io/gleam-lang/gleam:v1.14.0-erlang-alpine sh -c 'gleam new hello --skip-git > /dev/null 2>&1 && cp /work/hello.gleam hello/src/hello.gleam && cd hello && gleam run'