Build, run and deploy Gleam apps on Giolt.
Install it globally with npm or Bun. It needs Node 20 or newer:
npm i -g @giolt/cli
bun i -g @giolt/cli
giolt buildbun i -g links a script that starts with #!/usr/bin/env node, so a machine
with only Bun installed needs Node too, or can run bunx --bun @giolt/cli build
instead.
Or 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 buildThe CLI runs on JavaScript. In an Erlang-target project, gleam run -m giolt
starts on Erlang and runs itself again as gleam run --target javascript, with
Node when it is installed and otherwise Bun. When neither is installed, it
stops and says so.
Your entry module exports one function named handle:
// JavaScript target
pub fn handle(req: Request(conversation.RequestBody)) -> Response(conversation.ResponseBody)
// Erlang target (afterglow)
pub fn handle(req: wisp.Request) -> wisp.Responsegiolt build checks this signature against gleam export package-interface
and fails with the expected and found types when it does not match.
| Command | Does |
|---|---|
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 |
giolt deploy [--preview] [--artifact DIR] [--project NAME] [--config FILE] |
Builds, then uploads outdir to Giolt. With artifact, uploads that directory instead |
giolt link NAME [--config FILE] |
Writes project = <id> under [tools.giolt], so deploy needs no flags. Commit the file so CI deploys there too |
giolt unlink [--config FILE] |
Removes that project line |
giolt help |
Prints the commands. giolt <command> --help prints that command's flags |
gleam run -m giolt -h prints help for gleam run, not for giolt, because
Gleam reads the flag first. Use gleam run -m giolt help or gleam run -m giolt with no arguments instead.
link and unlink edit the file as text, so comments and layout stay as they
are. They write to the --config file when you pass one.
deploy picks its project and token like this:
--project NAMEwins over the linkedproject. The CLI looks the name up with your token.- The token is
GIOLT_TOKENwhen set, otherwise the onegiolt loginstored. - With no project,
deploystops and asks you to rungiolt linkor pass--project. Tokens cover the whole account, so none of them names a project. GIOLT_TOKENgoes toGIOLT_API_URL, thenapi_url. A stored login only goes to the URL it logged in against.
| Command | Does |
|---|---|
giolt login |
Shows a code and opens the dashboard so you can approve it in the browser, then stores the token |
giolt login --token - |
Reads a token made on the dashboard's Tokens page from stdin and stores it. It starts with giolt_; anything else is refused. --token TOKEN also works, but leaves the token in your shell history |
giolt logout |
Revokes the stored token and deletes it. If the revoke fails, the file is still deleted and you are told to revoke the token on the dashboard |
giolt whoami |
Shows the account email, the token's name, scopes and expiry, and where the token came from |
giolt projects |
Lists your projects with their URL and latest deployment status |
giolt projects create NAME |
Creates a project |
giolt projects rename OLD NEW |
Renames a project. The old URL stops working and there is no redirect |
giolt projects delete NAME [--yes] |
Deletes a project and its deployments for good. Asks you to type the name, or needs --yes when there is no terminal |
giolt usage |
Shows the account's requests against the included amount for the current billing period; --json prints it for scripts |
giolt env [list] [--json] |
Lists the project's environment variables. A secret shows as (secret), and --json prints its value as null |
giolt env set NAME [VALUE] [--secret] |
Sets a variable. Without VALUE it reads one line from stdin, so a secret stays out of your shell history; with --secret at a terminal, what you type isn't shown. --secret means the value is never shown again |
giolt env delete NAME |
Deletes a variable |
Creating, renaming and deleting need an active subscription; the error says where to set one up.
The env commands use the linked project, or the one --project NAME names,
with the same token as deploy. Listing needs a token with projects:read;
setting and deleting need projects:write, and --project NAME also needs
projects:read to look the name up. A change reaches the app on its
next deploy, and the live version keeps the old value until then.
giolt login stores the token in credentials.json, readable only by you, in:
$XDG_CONFIG_HOME/giolt/, or~/.config/giolt/when that is unset (Linux and macOS)%APPDATA%\giolt\(Windows)
pbpaste | gleam run -m giolt login --token -Logging in again revokes the token it replaces.
GIOLT_TOKEN takes precedence over the stored token, so CI can set it without
logging in. Account commands never read gleam.toml, so a project's api_url cannot send
your token elsewhere:
giolt loginusesGIOLT_API_URL, orhttps://dash.giolt.comwhen that is unset, and stores that URL with the token.- The stored token is only ever sent to the URL stored with it.
GIOLT_TOKENis sent toGIOLT_API_URL, orhttps://dash.giolt.com.
giolt logout only removes the stored token; it does not unset GIOLT_TOKEN.
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):
| Key | Default | Meaning |
|---|---|---|
entry |
your package name | Module that exports handle, such as my_app/server |
assets |
none | Directory 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 |
spa |
false |
Serve index.html for paths that match no file. Static-only apps: requires artifact (or deploy --artifact) |
watch |
["src"], plus assets |
Directories dev watches |
port |
3000 |
dev server port |
live_reload |
true |
Reload the browser after a rebuild |
api_url |
"https://dash.giolt.com" |
Giolt API used by deploy. The account commands ignore it |
prebuild |
none | Shell command run before every build, such as gleam run -m docs/build |
artifact |
none | Deploy this directory as a static site. Skips the handle check, the compile and the bundle |
project |
none | Id of the project deploy uploads to. Set by giolt link |
env |
[] |
Names of the project's environment variables the app reads, such as ["DATABASE_URL"], at most 64. Not allowed with artifact |
List the variables your app reads under env, and set their values with
giolt env set or on the project's dashboard page. A name is upper case
letters, digits and _, at most 64 characters, and can't start with a digit
or with GIOLT_. A project holds up to 64 variables, and a value is at most
5,120 bytes of UTF-8 with no NUL character.
[tools.giolt]
env = ["DATABASE_URL", "API_KEY"]giolt deploy sends these names, and Giolt hands the app only those. A deploy
that names a variable the project doesn't have fails, and the live version
keeps serving.
The app reads them from the environment, so env packages such as
envie and
envoy work on both targets. On JavaScript the
worker entry copies them into process.env; on Erlang afterglow serves them
to os:getenv. A deployed app gets them when a request arrives, so code
that runs while modules load doesn't see them.
giolt dev takes each declared variable from the shell, or from .env when
the shell doesn't set it, and when it starts it warns about any it can't find.
It leaves out a value Giolt would refuse and says why. It reads .env again
before every rebuild. It never copies an undeclared .env entry into the app.
On the JavaScript target the app runs inside the giolt process, so it can
also see variables your shell exports that env doesn't list or that dev
leaves out; on Erlang it sees only the declared ones. Keep .env out of git.
A project with target = "erlang" builds with
afterglow, which compiles the app's
BEAM bytecode to WebAssembly. You need Erlang/OTP 28 or 29 and rebar3
installed, and giolt build tells you which one is missing. The first build downloads
Binaryen from npm into build/dev/bin. The output in outdir is app.wasm
and afterglow's Worker entry, index.mjs and host.mjs, plus static/ when
assets is set. It needs afterglow 0.2.0 or later. afterglow runs on Linux and
macOS (x64 and arm64) and Windows (x64).
giolt dev skips Binaryen's optimisation pass, which takes most of a build,
so its app.wasm is larger than the one build and deploy make.
The build uses the versions your manifest.toml locks. If afterglow needs a
newer version of one of them, dependency resolution fails; run gleam update
in your project and build again.
When the app reaches a function afterglow does not provide, such as
crypto:mac/4, giolt build lists it and still builds. A request that calls
one gets a 500 whose body names the function. deploy uploads the output the
same way as a JavaScript build. dev runs the same build and serves app.wasm
through host.mjs, rebuilding on every change; each rebuild takes a few seconds.
AI may write code in every Giolt repository, and this one is heavily AI-assisted: agents critique its structure, proofread, and write the tedious parts.
How AI use is managed here:
- Every change reaches
mainthrough a pull request with passing CI, and CI publishes releases only frommain. GitHub enforces both, for everyone. - Before each commit and merge, an agent waits for the maintainer to confirm they reviewed the change, and the commit records it in a
Reviewed-by:trailer. GitHub doesn't check this. It is a rule the agents follow. - A change to core code, where a quiet mistake could leak a token, lose data, ship a broken deploy or break every build, gets a code review pass first, and the agent names each core file it touched.
The agents' rules are in AI.md. The AI use policy covers every Giolt repository.
Report bugs and requests at github.com/withgiolt/issues.