Gleam is a fast, friendly, and functional language for building safe, scalable systems! ✨

Why Gleam?

Safe

Gleam's powerful static type system helps find and prevent bugs at compile time, long before it reaches your users. It also serves as a productive refactoring tool, enabling programmers to confidently make large changes to unfamiliar code, quickly and with low risk.

For problems the type system can't solve (such as your server being hit by a bolt of lightning) the Erlang virtual machine provides well tested mechanisms for gracefully handling failure.

Friendly

Hunting down bugs can be stressful so Gleam's compiler provides clear and helpful feedback about any problems. We want to spend more time developing features and less time looking for bugs or deciphering cryptic error messages.

As a community we want to be friendly too. People of all backgrounds, genders, and experience levels are welcome and must receive equal respect. See our community code of conduct for more.

Performant

Gleam builds on top of the Erlang virtual machine, a best-in-class runtime that has enabled companies such as WhatsApp, Ericsson, Heroku, and Klarna to provide low-latency services at a global scale. Gleam takes full advantage of the Erlang runtime and adds no overhead of its own, so all Gleam programs are as blazingly fast as their Erlang counterpart.

Erlang compatible

Gleam makes it easy to use code written in other BEAM languages such as Erlang, Elixir and LFE, so there's a rich ecosystem of thousands of open source libraries for Gleam users to make use of.

In return Gleam code can be easily used by programmers of other BEAM languages, either by transparently making use of libraries written in Gleam, or by adding Gleam modules to their existing project with minimal fuss.

Examples

Hello, world! The classic example program that prints "Hello, world!" to the console.
import gleam/io

pub fn main() {
  io.println("Hello, world!")
}
A basic web server This little web server responds with the text "Hello, world!" to any HTTP request made to it.
import gleam/http/elli
import gleam/http

pub fn my_service(_req) {
  let body = bit_builder.from_string("Hello, world!")

  http.response(200)
  |> http.set_resp_body(body)
}

pub fn start() {
  elli.start(my_service, on_port: 3000)
}
The web server created by this code is fully asynchronous and multi-threaded, seamlessly making use of all the cores of your computer without tricky locks, callbacks, or promises.
Multi-threaded hello world Thanks to the powerful Erlang virtual machine Gleam programs can spin up hundreds thousands of threads (called processes) without any trouble. Here's "Hello, World!" being printed by a thousand processes concurrently.
import gleam/io
import gleam/int
import gleam/list
import gleam/string
import gleam/otp/process

pub fn main() {
  list.range(0, 1000)
  |> list.each(start_process)
}

fn start_process(i) {
  process.start(fn() {
    let message = string.append("Hello world: ", int.to_string(i))
    io.println(message)
  })
}
In addition to this low-level process abstraction Gleam has helpful libraries full of building blocks for writing type safe and fault tolerant multi-core programs as quickly as possible.