
Gleam Programming Language in 2026: Typed BEAM, Erlang, Elixir & Rust Compared
Explore the Gleam programming language in 2026 (v1.19): static types on the Erlang BEAM VM, JavaScript compilation, Elixir vs Rust trade-offs, and Wisp/Lustre.
For decades, backend engineers faced a frustrating architectural trade-off. If you wanted the battle-tested concurrency, soft real-time fault tolerance, and self-healing actor supervision of the Erlang virtual machine (BEAM), you had to accept dynamic typing in Erlang or Elixir. Conversely, if you wanted strict, ML-style compile-time type guarantees with algebraic data types and zero null errors, you had to leave the BEAM ecosystem for languages like Rust, OCaml, or Haskell.
The Gleam programming language eliminates that compromise. Created by Louis Pilfold and backed by a fast-growing open-source community and industrial sponsors, Gleam brings a fast, Rust-written static type checker with full Hindley-Milner type inference directly to the Erlang BEAM runtime—and also compiles cleanly to modern JavaScript (ECMAScript 2022+) with TypeScript type declarations.
In October 2026, following the release of Gleam v1.19.0 and v1.19.2, the language has reached a new level of compiler maturity: it now compiles directly to binary Erlang abstract forms rather than intermediate .erl source files, supports Erlang/OTP 29, and powers 1,690+ packages across web frameworks like Wisp, Mist, and Lustre.
In this technical guide, we examine how Gleam works under the hood, its type system and OTP actor model, how it compares against Elixir (including Elixir v1.20’s gradual type system) and Rust, verified code examples, and when Gleam is—and is not—the right choice for your production stack.
Quick Verdict: Gleam at a Glance (October 2026)
| Attribute | Verified Technical Details (October 2026) |
|---|---|
| Creator & Governance | Created by Louis Pilfold; open-source (Apache-2.0), sponsored by LambdaClass, NineFX, and community backers |
| Latest Stable Release | Gleam v1.19.2 (October 12, 2026) / v1.19.0 (October 5, 2026); 1.0 shipped March 4, 2024 |
| Compiler Implementation | Written in Rust (ships as a single, zero-dependency native binary with compiler, build tool, formatter, package manager, and LSP) |
| Primary Compilation Targets | BEAM VM (via binary Erlang abstract forms on OTP 28 & 29) and JavaScript (.mjs ES2022+ modules + .d.ts TypeScript definitions) |
| Type System | Static, sound within pure Gleam, Hindley-Milner type inference, algebraic data types (Custom Types), generics, no null/nil |
| Error Handling | Explicit value-based error handling via Result(value, error) and Option(a)—no unchecked exceptions in pure Gleam |
| Concurrency Model | Lightweight isolated BEAM processes (actors), typed Subject(msg) channels, and OTP supervision trees (gleam_otp) |
| Package Ecosystem | 1,690 packages on packages.gleam.run + full interoperability with tens of thousands of Erlang/Elixir packages on Hex.pm |
| Key Frameworks | Wisp (web framework), Mist (pure Gleam HTTP/2 & WebSocket server), Lustre (Elm-style SPA, SSR & Server Components), Pog (PostgreSQL) |
1. What Is the Gleam Programming Language?
Gleam is a statically typed, purely functional programming language designed for building scalable, fault-tolerant systems. Its design synthesizes three major influences in software engineering:
- The Erlang/OTP Runtime (BEAM): Like Erlang and Elixir, Gleam runs as a first-class citizen on the BEAM virtual machine, inheriting lightweight preemptively scheduled processes, per-process garbage collection, and OTP fault tolerance.
- Rust and ML-Family Type Systems: Inspired by Rust, Elm, and OCaml, Gleam enforces strict compile-time type safety using algebraic data types, exhaustive pattern matching, and complete type inference—meaning you rarely need to write explicit type annotations unless documenting public APIs.
- Radical Language Simplicity (Go/Elm Philosophy): Gleam intentionally avoids language bloat. There are no macros, no typeclasses or traits, no implicit type conversions, no method overloading, and no exceptions. A developer familiar with TypeScript, Rust, or Elixir can learn the entire Gleam language specification in a single afternoon using the interactive Gleam Language Tour.
The official Gleam website (gleam.run) highlights the language’s core value proposition: combining an expressive static type system with the fault-tolerant Erlang runtime.
2. Why Gleam Matters in 2026: Key Milestones & Industry Momentum
When Gleam 1.0 launched in March 2024, many engineering teams viewed it as an intriguing experiment. By late 2026, Gleam has matured into a serious production option for backend and full-stack teams:
- Top-Tier Developer Satisfaction: In the Stack Overflow Developer Survey, Gleam ranked as the second most admired programming language (70% admired score), trailing only Rust (72%) and scoring just ahead of Elixir (66%).
- The October 2026 Compiler Upgrade (
Gleam v1.18–v1.19.2): On October 5, 2026, the Gleam team announced a major architectural shift in Gleam v1.19.0 (“Gleam doesn’t compile to Erlang source anymore”). Previously, Gleam compiled.gleamsource code into textual.erlfiles before invoking the Erlang compiler. Engineered by core contributor Giacomo Cavalieri, the Gleam compiler now outputs Erlang abstract forms serialized in Erlang’s binary external term format—the exact same intermediate representation (IR) used by Elixir. - Why Binary Abstract Forms Matter: By bypassing the Erlang compiler’s tokenizer and parser stages, Gleam builds significantly faster and preserves exact
.gleamfile names and line numbers in runtime stacktraces, crash logs, and BEAM debuggers such as WhatsApp’sedb. - Erlang/OTP 29 Support & Flatter JavaScript Codegen: Starting in
v1.18+andv1.19.2, Gleam officially supports Erlang/OTP 29 and OTP 28, while John Downey’s JavaScript codegen optimization inv1.19.0flattens nested pattern-matching checks into combinedifconditions for smaller, faster.mjsbundles. - Verified Production Case Studies: Companies such as Uncover (building legal intelligence workflows with a rapid two-engineer team) and Strand have published official production case studies demonstrating how Gleam’s strict compiler eliminates entire classes of refactoring regressions.
3. Architecture & Dual-Target Compilation: BEAM VM and JavaScript
One of Gleam’s defining engineering strengths is its multi-target compiler architecture. Written in Rust for blistering compilation speed, the gleam CLI parses your code into a typed Abstract Syntax Tree (AST), performs full Hindley-Milner type inference and exhaustiveness analysis, and then lowers the validated AST to your chosen target runtime.
flowchart LR
subgraph Source["1. Gleam Source & Type Checker"]
A[".gleam Source Files"] --> B["Gleam Compiler (Rust)<br/>Lexer, Parser & AST"]
B --> C["Hindley-Milner Type Inference<br/>& Exhaustiveness Checker"]
end
subgraph BEAMTarget["2A. Erlang / BEAM Target (Default)"]
C --> D["Erlang Abstract Forms<br/>(Binary External Term Format)"]
D --> E["BEAM Bytecode (.beam)<br/>via Erlang Compiler (OTP 28/29)"]
E --> F["BEAM Virtual Machine<br/>Actors, OTP Supervisors, Hex.pm"]
end
subgraph JSTarget["2B. JavaScript Target (--target javascript)"]
C --> G["ES2022+ JavaScript (.mjs)<br/>+ TypeScript Declarations (.d.ts)"]
G --> H["JavaScript Runtimes<br/>Node.js, Deno, Bun, Browsers, Edge"]
end
Target 1: The Erlang BEAM Virtual Machine (Default)
When targeting Erlang/BEAM, Gleam compiles your modules into .beam bytecode executables via Erlang abstract forms. Your code runs alongside any Erlang or Elixir module in the same VM instance with zero serialization overhead. You gain immediate access to:
- Preemptive Scheduling: Unlike Node.js (which uses cooperative single-threaded event loops) or Go (where tight CPU loops could historically delay goroutine preemption), the BEAM scheduler allocates a fixed budget of reductions (roughly 4,000 function calls) to each process before preempting it. A single slow request or heavy regex calculation cannot block the rest of your server.
- Per-Process Garbage Collection: Each BEAM process has its own private heap. When a short-lived HTTP request process finishes, its memory is reclaimed immediately without triggering a stop-the-world garbage collection pause across the entire server.
Target 2: Modern JavaScript (ECMAScript 2022+)
By passing --target javascript (or setting target = "javascript" in gleam.toml), Gleam compiles the exact same .gleam source code into clean, human-readable ES2022 modules (.mjs) alongside optional TypeScript .d.ts declaration files.
- There is no heavy virtual machine emulated in the browser; Gleam types map cleanly to lightweight JavaScript classes and arrays.
- This allows teams to share domain models, validation logic, JSON decoders, and state machines between a Wisp/Mist backend on BEAM and a Lustre frontend running in the browser, or deploy Gleam directly to Cloudflare Workers, Deno Deploy, Bun, or Node.js.
4. Static Type System, Hindley-Milner Inference & Error Handling
If you have ever been paged at 3:00 AM because an Elixir function returned {:error, :timeout, metadata} where the caller only pattern-matched on {:error, reason}, or because a JavaScript property resolved to undefined, you already understand the problem Gleam solves.
Sound Compile-Time Inference
Gleam uses a Hindley-Milner-based type system. Every expression has a known static type at compile time, yet the compiler can deduce types automatically from how values are used. In practice, Gleam developers write type annotations on public function signatures for documentation clarity and let the compiler infer all local bindings and closures.
Algebraic Data Types (Custom Types) & Generics
Gleam models domain logic using Custom Types (tagged unions / sum types). Instead of scattering boolean flags (is_paid, is_refunded, has_error) across a mutable object—which permits impossible states—you define explicit variants that hold only the data valid for that state.
Zero null, Zero undefined, Zero Unchecked Exceptions
Gleam has no null or nil value. If a value might be absent, you use the standard library’s Option(a) type (Some(value) or None).
Similarly, Gleam does not use try / catch exception blocks for control flow. Any function that can fail returns the built-in Result(value, error) type:
pub type Result(value, error) {
Ok(value)
Error(error)
}
Because error is also a type parameter, your function signature tells callers exactly which domain errors can occur—and the compiler forces callers to handle both Ok and Error branches before the program will compile.
5. Functional Programming, Immutability & Exhaustive Pattern Matching
All values in Gleam are deeply immutable. When you update a record or prepend an item to a list, Gleam creates a new reference that shares unchanged memory structures with the original value (structural sharing). This makes concurrent programming vastly safer: two processes or closures can never corrupt shared state via a race condition.
Key Ergonomic Features in Gleam
- The Pipe Operator (
|>): Borrowed from Elixir and F#, the pipe operator passes the result of one expression as the arguments to the next function, turning deeply nested calls likeformat(validate(parse(raw)))into a linear top-to-bottom pipeline. - Exhaustive
casePattern Matching: Thecaseexpression inspects values, destructures nested tuples, lists, strings, or bit arrays, and supportsifguard clauses. If you add a new variant to a Custom Type six months later, every unhandledcaseexpression across your entire codebase immediately triggers a compile-time error. - The
useExpression (Flattening Callbacks & Error Pipelines): Deeply nestedcaseblocks (the functional equivalent of “callback hell” or Rust’s early?operator) are flattened in Gleam using theusekeyword. Combiningusewithresult.trylets you write clean, early-returning error pipelines without exceptions or monad syntax complexity.
6. Actor Model, Concurrency & Fault Tolerance (OTP)
While the BEAM virtual machine provides the raw concurrency primitives (spawn, send, receive), raw Erlang message passing is inherently untyped: any process with a Pid (Process Identifier) can send any arbitrary data term to another process’s mailbox.
Solving typed actor concurrency is notoriously difficult in computer science. Gleam solves this pragmatically through its official gleam_erlang and gleam_otp packages using typed Subject(message) channels.
flowchart TD
subgraph Supervision["OTP Supervisor Process (Static / Dynamic)"]
Sup["OTP Supervisor<br/>Restart Strategy: OneForOne"]
end
subgraph Client["Caller Process (e.g., Wisp HTTP Handler)"]
Req["HTTP Request Process"]
end
subgraph Worker["Isolated Gleam Actor Process"]
Subj["Typed Subject(PaymentMsg)<br/>Compile-Time Checked Channel"]
Mailbox["Process Mailbox<br/>Sequential Message Queue"]
Loop["Actor Handler Loop<br/>Immutable State + Pattern Match"]
Subj --> Mailbox --> Loop
end
Req -- "actor.call / actor.send<br/>Only PaymentMsg Allowed" --> Subj
Loop -- "Typed Reply via Subject" --> Req
Sup -. "Monitors & Automatically Restarts<br/>Isolated Process on Crash" .-> Loop
How Typed Actors Work in Gleam
- Custom Message Protocol: You define a Custom Type representing all valid messages an actor can receive (for example,
pub type CacheMessage { Get(key: String, reply_with: Subject(Option(String))) Set(key: String, value: String) }). - Typed
SubjectChannels: Instead of sending messages directly to an untypedPid, callers send messages through aSubject(CacheMessage). The Gleam compiler guarantees that no pure Gleam code can send an invalid message type to that actor. - Supervision Trees & “Let It Crash” with Static Types: A common question from newcomers is: “If Gleam is statically typed and has no exceptions, why do we still need OTP supervisors?” The answer lies in the difference between logic bugs and external infrastructure failures. Static typing eliminates logic bugs (
UndefinedFunctionError, unexpectednil, unhandled state variants) at compile time. However, in distributed production systems, hardware fails, TCP sockets drop mid-stream, databases restart, and third-party APIs time out. When an isolated Gleam actor encounters an unrecoverable external state or assertion failure (panic), its OTP Supervisor cleanly terminates that single actor process, resets its state to a known good baseline, and restarts it—without affecting thousands of other concurrent users connected to the node.
7. Interoperability with Erlang, Elixir & JavaScript (Plus FFI Risks)
Because Gleam compiles to standard BEAM bytecode (and ES modules on JS), it does not have to rebuild the world from scratch. You can tap into the entire Hex.pm ecosystem (Erlang and Elixir packages) or npm ecosystem using Gleam’s @external attribute.
Calling Erlang, Elixir, or JavaScript from Gleam
With a single attribute, you bind an external function to a strongly typed Gleam signature—and you can even provide both an Erlang implementation and a JavaScript implementation (or a pure Gleam fallback) on the same function:
// Uses Erlang's :crypto.strong_rand_bytes on BEAM,
// or falls back to a JS module when compiled to JavaScript
@external(erlang, "crypto", "strong_rand_bytes")
@external(javascript, "./crypto_ffi.mjs", "strong_rand_bytes")
pub fn random_bytes(count: Int) -> BitArray
Calling Gleam from Elixir or Erlang
A Gleam module named billing/invoice compiles to the BEAM module :billing@invoice. From an Elixir Phoenix application, you can call :billing@invoice.calculate_total(items) directly as if it were a native Erlang module.
Technical Warning: The FFI Boundary Risk
As an engineering team, you must understand where Gleam’s type guarantees stop: the compiler trusts your @external type annotations unconditionally.
- If you annotate an external Erlang function as returning
String, but at runtime that Erlang function returns an atom:undefinedor raises an Erlang exception (erlang:error/1), Gleam’s compile-time checker cannot prevent that mismatch. - Best Practice: Never bind untrusted external functions directly to complex Gleam types. Instead, receive untrusted external values, JSON payloads, or database rows as
gleam/dynamic.Dynamicand validate them at the boundary using the officialgleam/dynamic/decodemodule, which safely returns a typedResult.
8. Technical Comparison: Gleam vs. Elixir vs. Rust vs. Erlang vs. TypeScript
To understand where Gleam fits in the 2026 backend landscape—especially if you are comparing high-performance architectures in our Best Backend Frameworks guide or evaluating Django vs. FastAPI—it helps to compare its architectural trade-offs directly against Elixir, Rust, Erlang, and TypeScript.
Gleam vs. Elixir in 2026 (Including Elixir v1.20’s Gradual Type System)
Historically, the choice between Elixir and Gleam was simple: dynamic vs. static types. However, in June 2026, Elixir v1.20 shipped full type inference and gradual set-theoretic type checking across all Elixir code without requiring type annotations. How do they differ today?
- Elixir v1.20 (Gradual Set-Theoretic Types + Metaprogramming): Elixir remains a dynamic language at heart that now includes a powerful compile-time type checker with a
dynamic()escape hatch. Elixir embraces powerful AST macros, protocols, and DSLs—which enable massive, magical frameworks like Phoenix, Phoenix LiveView, Ecto, and Oban. - Gleam v1.19 (Strict ML/Hindley-Milner Static Types + Zero Macros): Gleam is strictly typed from the ground up. There are no macros, no hidden code injection, and no implicit dynamic fallbacks. Refactoring a 50,000-line domain model in Gleam feels like refactoring in Rust: the compiler guides you through every single affected file with deterministic precision. However, Gleam’s web ecosystem (Wisp + Mist + Lustre) is intentionally explicit and library-composed rather than a monolithic “batteries-included” framework like Phoenix.
Gleam vs. Rust
- Shared DNA: Both Gleam and Rust share algebraic data types (
enum/ Custom Types), exhaustivematch/caseexpressions,Result<T, E>error handling, nonull, and a fast, helpful compiler with first-class tooling. - Key Difference: Rust is a systems programming language with manual memory management via ownership, lifetimes, and borrow checking—giving you C-level CPU speed and zero garbage collection, at the cost of a steep learning curve and slower product iteration when building high-level async actor systems. Gleam runs on a garbage-collected VM (BEAM or JS) with immutable values and no lifetimes or borrow checker, making it vastly faster to write for I/O-bound web APIs, real-time messaging, and business logic while Rust handles raw CPU-bound workloads.
Master Comparison Table (2026)
| Feature / Dimension | Gleam (v1.19) | Elixir (v1.20) | Erlang (OTP 29) | Rust | TypeScript (Node/Bun) |
|---|---|---|---|---|---|
| Type System | Strict Static (Hindley-Milner + ADTs) | Gradual Set-Theoretic (Dynamic runtime roots) | Dynamic (Optional Dialyzer static analysis) | Strict Static (Affine types, Ownership, Traits) | Structural Static (Erased at runtime, unsound edges) |
| Primary Runtime | BEAM VM & JavaScript | BEAM VM | BEAM VM | Native Machine Code / WASM | V8 / JavaScriptCore |
| Concurrency Model | Preemptive BEAM Actors (Subject) |
Preemptive BEAM Processes (GenServer) |
Preemptive BEAM Processes | Async/Await (Tokio) or OS Threads |
Single-Threaded Event Loop + Workers |
| Memory Management | Per-Process GC (BEAM) / V8 GC (JS) | Per-Process GC (BEAM) | Per-Process GC (BEAM) | Compile-Time Borrow Checker (No GC) | Global Stop-the-World / Generational GC |
| Error Handling | Result(ok, err) values + OTP Supervisors |
{:ok, val} tuples + Exceptions + Supervisors |
Tagged tuples + Exceptions + Supervisors | Result<T, E> + panic! |
try / catch Exceptions (Untyped) |
| Metaprogramming | None (Explicit code generation only) | Extensive AST Macros (quote/unquote) |
Parse transforms / Header macros | Procedural & Declarative Macros | Decorators / Build-time plugins |
| Web Flagships | Wisp, Mist, Lustre | Phoenix, LiveView, Ash | Cowboy, Nova | Axum, Actix Web | NestJS, Hono, Next.js |
| Learning Curve | Low (Small syntax, no borrow checker) | Medium (OTP + Macro DSLs) | Medium-High (Prolog-derived syntax) | High (Lifetimes, Pin, Async traits) | Low-Medium (Complex type gymnastics) |
9. Practical Gleam Code Examples (Verified on Gleam v1.19.2)
To see how Gleam’s type system, pattern matching, Result pipelines, and @external FFI work together in real code, inspect the following module. We compiled and verified this exact module using Gleam v1.19.2 (gleam_stdlib v1.0.5).
import gleam/int
import gleam/io
import gleam/option.{type Option, None, Some}
import gleam/result
import gleam/string
/// 1. Algebraic Data Types (Custom Types)
/// Each variant holds only the data valid for that specific state.
pub type PaymentStatus {
Pending(invoice_id: String)
Settled(invoice_id: String, amount_cents: Int, processor_ref: String)
Failed(invoice_id: String, reason: PaymentError)
}
pub type PaymentError {
InvalidAmount(provided: Int)
EmptyInvoiceId
GatewayDeclined(code: String)
}
/// 2. Exhaustive Pattern Matching with Guards
pub fn describe_status(status: PaymentStatus) -> String {
case status {
Pending(invoice_id: id) -> "Invoice " <> id <> " is awaiting settlement."
Settled(invoice_id: id, amount_cents: cents, ..) if cents >= 100_000 ->
"High-value invoice " <> id <> " settled (" <> int.to_string(cents) <> " cents)."
Settled(invoice_id: id, amount_cents: cents, ..) ->
"Invoice " <> id <> " settled (" <> int.to_string(cents) <> " cents)."
Failed(invoice_id: id, reason: GatewayDeclined(code)) ->
"Invoice " <> id <> " declined by gateway: " <> code
Failed(invoice_id: id, reason: _) ->
"Invoice " <> id <> " failed validation."
}
}
/// 3. Pure Validation Functions Returning Result(value, PaymentError)
pub fn validate_invoice_id(raw_id: String) -> Result(String, PaymentError) {
let trimmed = string.trim(raw_id)
case string.is_empty(trimmed) {
True -> Error(EmptyInvoiceId)
False -> Ok(trimmed)
}
}
pub fn validate_amount(cents: Int) -> Result(Int, PaymentError) {
case cents > 0 {
True -> Ok(cents)
False -> Error(InvalidAmount(cents))
}
}
/// 4. Flattening Error Pipelines with the `use` Expression
/// Equivalent to Rust's `?` operator or Elixir's `with` block,
/// without exceptions or deeply nested case expressions.
pub fn settle_payment(
raw_id: String,
amount_cents: Int,
processor_ref: Option(String),
) -> Result(PaymentStatus, PaymentError) {
use valid_id <- result.try(validate_invoice_id(raw_id))
use valid_amount <- result.try(validate_amount(amount_cents))
let reference = case processor_ref {
Some(ref) -> ref
None -> "INTERNAL-LEDGER"
}
Ok(Settled(
invoice_id: valid_id,
amount_cents: valid_amount,
processor_ref: reference,
))
}
/// 5. Multi-Target @external FFI with Pure Gleam Fallback
/// Uses Erlang's string:uppercase/1 on BEAM, or falls back to body on JS.
@external(erlang, "string", "uppercase")
pub fn native_uppercase(text: String) -> String {
string.uppercase(text)
}
pub fn main() {
let outcome =
settle_payment(" inv_2026_994 ", 250_000, Some("stripe_ch_8821"))
|> result.map(describe_status)
case outcome {
Ok(summary) -> io.println(native_uppercase("ok: ") <> summary)
Error(_) -> io.println("Payment could not be processed.")
}
}
When executed via gleam run, the compiler verifies all types and branch exhaustiveness in milliseconds and outputs:
OK: High-value invoice inv_2026_994 settled (250000 cents).
10. Installation, Toolchain & Project Structure (gleam.toml)
One of the reasons developers love Gleam is its zero-configuration single-binary toolchain. Unlike older ecosystems where you have to stitch together separate tools for compiling, dependency management, formatting, testing, and language server support, the gleam binary includes everything out of the box.
The official Gleam documentation portal (gleam.run/documentation) provides structured guides for language syntax, CLI tooling, FFI externals, and cheatsheets for Elixir, Rust, Python, and PHP developers.
Step 1: Install Gleam and Erlang/OTP
To run Gleam on the BEAM virtual machine, install Gleam (v1.19+) and Erlang/OTP (28 or 29) via your system package manager or version manager (mise or asdf):
# macOS (Homebrew - automatically installs Erlang as a dependency)
brew install gleam
# Windows (Winget or Scoop)
winget install Gleam.Gleam
scoop install gleam
# Cross-platform version manager (mise)
mise use --global erlang@29 gleam@1.19.2
Step 2: Create and Run a New Project
Run three commands to scaffold, test, and execute a new project:
gleam new my_service
cd my_service
gleam test
gleam run
Standard Gleam Project Structure
Instead of complex nested configuration files, every Gleam project uses a clean, standardized layout controlled by gleam.toml:
| File or Directory | Purpose in a Gleam Project |
|---|---|
gleam.toml |
Project manifest defining package name, version, target (erlang or javascript), and Hex dependencies |
manifest.toml |
Deterministic lockfile pinning exact cryptographic hashes and versions of all resolved dependencies |
src/ |
Application source code; contains <project_name>.gleam with the entry-point pub fn main() function |
test/ |
Unit and integration test suites using gleeunit (files ending in _test.gleam) |
build/ |
Compiler artifacts, generated Erlang abstract forms, .beam bytecode, or .mjs modules (git-ignored) |
Essential Built-In CLI Commands
gleam add wisp mist: Adds packages from Hex.pm and updatesgleam.tomlandmanifest.toml.gleam format: Formats all.gleamfiles deterministically (zero configuration debates).gleam test: Compiles and runs all unit tests intest/.gleam docs build: Generates searchable static HTML documentation with type signatures.gleam lsp: Launches the built-in Language Server Protocol engine used by VS Code, Neovim, Zed, and Helix—which pairs naturally with modern AI assistants covered in our Best Free AI Coding Tools guide.
11. Ecosystem, Web Frameworks & Libraries in 2026 (1,690+ Packages)
As of October 2026, the official Gleam Package Index lists 1,690 pure and hybrid Gleam packages, up from roughly 500 packages shortly after the 1.0 launch.
The official Gleam Package Index (packages.gleam.run) reached 1,690 published packages in October 2026, with direct links to HexDocs and source repositories.
If you are building production systems in Gleam today, these are the foundational libraries that make up the standard 2026 stack:
| Category | Package Name | Target | Role in the 2026 Gleam Stack |
|---|---|---|---|
| Web Framework | wisp |
Erlang (BEAM) | Practical, explicit web framework created by Louis Pilfold; uses middleware via Gleam’s use syntax, structured logging, file uploads, and signed cookies |
| HTTP & WebSockets | mist |
Erlang (BEAM) | Pure Gleam HTTP/1.1, HTTP/2, WebSocket, and Server-Sent Events (SSE) server built directly on OTP actors |
| Frontend & SSR UI | lustre |
BEAM & JS | Elm-inspired MVU framework that runs as a client-side SPA on JavaScript, renders static SSR HTML on BEAM, or runs real-time Server Components over WebSockets |
| Concurrency / OTP | gleam_otp |
Erlang (BEAM) | Type-safe actors, tasks, and static/dynamic OTP supervisors using typed Subject channels |
| PostgreSQL Client | pog |
Erlang (BEAM) | Connection-pooled PostgreSQL client wrapping Erlang’s proven pgo driver with typed parameter binding and row decoders |
| SQLite Client | sqlight |
BEAM & JS | Fast synchronous SQLite bindings for embedded apps, edge services, and local testing |
| Compile-Time SQL | squirrel |
Erlang (BEAM) | Reads raw .sql queries against your PostgreSQL schema and generates 100% type-safe Gleam functions (inspired by Rust’s sqlx) |
| Data & Serialization | gleam_json |
BEAM & JS | High-speed JSON encoding and composable type-safe decoding via gleam/dynamic/decode |
12. Real-World Use Cases & Production Adoption
Where does Gleam deliver the highest engineering return on investment in 2026?
- High-Concurrency JSON & GraphQL APIs (
Wisp+Mist+Pog+Squirrel): Teams building fintech, billing, or healthcare APIs where invalid state transitions are unacceptable use Wisp and Squirrel to enforce end-to-end compile-time type safety from the PostgreSQL query layer all the way to the HTTP response—while serving tens of thousands of concurrent connections on a modest BEAM cluster. - Real-Time WebSocket & IoT Telemetry Gateways: Because
Mistspawns lightweight BEAM actor processes per WebSocket connection and integrates withgleam_otppub/sub patterns, Gleam excels at chat servers, multiplayer coordination, collaborative document syncing, and live AI agent streaming (similar in concurrency demands to the architectures we analyzed in Modern Backend Laravel for AI Agents). - Full-Stack Type-Shared Web Applications (
Wisp+Lustre): By placing shared domain types and JSON encoders/decoders in a common Gleam package, teams compile their backend to BEAM (Wisp) and their interactive frontend components to JavaScript (Lustre), guaranteeing that frontend and backend data contracts can never drift out of sync. - Surgical Type-Safe Modules Inside Existing Elixir Monoliths: Because Gleam compiles to standard BEAM
.beamfiles via Erlang abstract forms, Elixir engineering teams do not need to rewrite their entire Phoenix app. They can write complex financial calculation engines, pricing rules, or state machines as an isolated Gleam package and call it directly from Elixir.
13. Performance, Real Limitations & When NOT to Use Gleam
No engineering evaluation is complete without examining trade-offs. Despite its rapid growth, Gleam has deliberate design constraints and ecosystem trade-offs you should weigh before adopting it:
- No Monolithic “Batteries-Included” Equivalent to Phoenix or Rails: While
Wisp,Mist, andLustreare rock-solid, Gleam does not have a single all-in-one framework with built-in authentication generators, admin dashboards, distributed background job queues (like Elixir’sOban), and integrated ORM migrations out of the box. You assemble your stack from focused packages (much like Go or Rust’sAxum). - BEAM Is Not Designed for Heavy CPU-Bound Number Crunching: Just like Erlang and Elixir, Gleam on the BEAM VM is optimized for I/O concurrency, low tail latency, and fault tolerance, not raw numerical throughput, SIMD matrix math, or high-frequency audio/video encoding. For heavy CPU-bound tasks, use Rust (or invoke Rust via Erlang NIFs).
- Deliberate Lack of Typeclasses, Traits, and Macros: Coming from Rust or Haskell, you might miss writing generic
DisplayorSerializetraits. In Gleam, you pass explicit encoder/decoder functions (json.string(val),int.to_string(num)). This keeps compilation instant and code obvious, but it requires slightly more explicit wiring. - Typed OTP Requires More Boilerplate Than Dynamic OTP: Because
gleam_otpenforces static types over message channels, cyclic process communication or complex state machines require explicitly defining message wrapper types and mappingSubjectchannels.
14. Decision Framework: Should You Choose Gleam in 2026?
Choose Gleam If:
- You want the fault tolerance, lightweight actor concurrency, and operational simplicity of the BEAM VM, but you refuse to give up strict compile-time type safety and exhaustive pattern matching.
- You love Rust’s
Result,Option, and algebraicenumergonomics, but want a garbage-collected language without lifetimes or borrow-checker friction for fast backend and web product delivery. - You are building a full-stack application or edge service where compiling the exact same language to both Erlang/BEAM and JavaScript/TypeScript eliminates API contract bugs.
- You want a small, explicit, macro-free language where any new engineer on your team can read a module and understand 100% of what happens without chasing hidden metaprogramming magic.
Stick With Elixir, Rust, or TypeScript If:
- Choose Elixir (Phoenix): You want to ship a full-featured SaaS product at maximum speed using Phoenix LiveView, Ecto, Oban, and Ash, and Elixir v1.20’s gradual type checker gives you enough safety without strict ML-style constraints.
- Choose Rust: You are building embedded systems, game engines, CLI tools, high-frequency trading engines, or CPU-bound infrastructure where zero garbage collection and sub-microsecond memory control are mandatory.
- Choose TypeScript: Your primary hiring pool consists exclusively of JavaScript developers and your project depends heavily on vendor SDKs that only ship official npm packages.
15. Video Deep Dive: OTP and Gleam with Creator Louis Pilfold
To see how Gleam’s creator Louis Pilfold explains the design challenges and architectural breakthroughs of bringing static types to Erlang/OTP actors and supervision trees, watch his official talk from Code BEAM Europe:
16. Frequently Asked Questions (FAQ) About Gleam
Is Gleam ready for production in 2026?
Yes. Gleam reached v1.0 stability in March 2024 and is currently on v1.19.2 (October 2026) with strong backward-compatibility guarantees. Because it compiles to standard BEAM bytecode (on Erlang/OTP 28 and 29) and ES2022 JavaScript, it runs on two of the most battle-tested production runtimes in the world.
Does Gleam still compile to Erlang .erl source files?
In normal project builds starting with Gleam v1.18 and v1.19.0 (October 2026), Gleam no longer compiles to textual .erl source files by default. Instead, it compiles directly to Erlang abstract forms encoded in Erlang’s binary external term format—skipping the Erlang tokenizer/parser, accelerating compilation, and preserving exact .gleam line numbers in runtime stacktraces. (Textual Erlang source generation is still retained in the compiler for educational and debugging inspection.)
How does Gleam compare to Elixir v1.20’s new type system?
Elixir v1.20 (released in June 2026) introduced gradual set-theoretic type checking and full inference on top of a dynamically typed language that heavily uses macros and protocols. Gleam uses a strict, ML-style Hindley-Milner static type system with algebraic data types, exhaustive pattern matching, no nil, and no macros—providing deterministic, Rust-like compile-time guarantees across pure Gleam code.
Can I use Elixir and Erlang libraries inside a Gleam project?
Yes. Any Erlang or Elixir package published on Hex.pm can be added to a Gleam project running on the BEAM target. You bind external functions using the @external(erlang, "module", "function") attribute and decode untrusted dynamic payloads safely using gleam/dynamic/decode.
What is the best web framework for Gleam in 2026?
For backend HTTP APIs and server-rendered apps on the BEAM VM, Wisp paired with the Mist HTTP/2 and WebSocket server is the standard choice. For interactive frontends, Server-Side Rendering (SSR), or Phoenix LiveView-style real-time Server Components, Lustre is the flagship UI framework in the Gleam ecosystem.

Yan ZC
Software Developer & Tech Reviewer
Software developer and tech reviewer at ToolReview. I test, analyze, and document AI tools and software workflows. My mission is to help you find the perfect tech stack with honest reviews and rigorous benchmarks.