giolt

Build, run and deploy Gleam apps on Giolt.

Add it as a dev dependency and run it. It works on Node 20 or newer, which is Gleam’s default JavaScript runtime, and on Bun:

gleam add --dev giolt
gleam run -m giolt build
gleam run --runtime bun -m giolt build

Your entry module exports one function named handle:

// JavaScript target
pub fn handle(req: Request(conversation.RequestBody)) -> Response(conversation.ResponseBody)

// Erlang target (GlowVM)
pub fn handle(req: wisp.Request) -> wisp.Response

giolt build checks this signature against gleam export package-interface and fails with the expected and found types when it does not match.

Commands

CommandDoes
giolt build [--config FILE]Checks handle, compiles and bundles into outdir
giolt dev [--config FILE]Builds, watches watch, serves on port and reloads on change (JavaScript target)
giolt deploy [--preview] [--artifact DIR] [--config FILE]Builds, then uploads outdir to Giolt (JavaScript target). With artifact, uploads that directory instead

deploy reads the token from GIOLT_TOKEN. GIOLT_API_URL overrides api_url.

Configuration

Everything is optional and lives under [tools.giolt] in your gleam.toml, or in the TOML file you pass with --config FILE when one package needs several builds (the package name and target still come from gleam.toml, and keys the file leaves out take their defaults):

KeyDefaultMeaning
entryyour package nameModule that exports handle, such as my_app/server
assetsnoneDirectory of static files, copied to outdir/static and served by dev
outdir"./dist"Where the bundle goes. It is deleted before every build
esbuild_args[]Extra esbuild flags, appended after the fixed ones so they win
spafalseServe index.html for paths that match no file (static-only apps)
watch["src"], plus assetsDirectories dev watches
port3000dev server port
live_reloadtrueReload the browser after a rebuild
api_url"https://dash.giolt.com"Giolt API used by deploy
prebuildnoneShell command run before every build, such as gleam run -m docs/build
artifactnoneDeploy this directory as a static site. Skips the handle check, the compile and the bundle

Erlang target

A project with target = "erlang" builds for GlowVM. You need Erlang/OTP and rebar3 installed, and giolt build tells you which one is missing. The output in outdir is app.avm plus the runtime files (glowvm.wasm, index.js, index.min.js). dev and deploy do not support this target yet.

Issues

Report bugs and requests at github.com/withgiolt/issues.

✨ Search Document