Package Version Hex Docs

🏕️ A peaceful web framework for Gleam that targets JS.

✨ Features:

…and other nice-to-haves!


Install all requirements:

gleam add glen gleam_http gleam_javascript

Or just Glen:

gleam add glen


import gleam/javascript/promise.{type Promise}
import glen
import glen/status

pub fn main() {
 glen.serve(handle_req, 8000)

fn handle_req(req: glen.Request) -> Promise(glen.Response) {
 "<h1>Welcome to my webpage!</h1>
 <p>Make yourself at home 😄</p>"
 |> glen.html(status.ok)
 |> promise.resolve

Glen is heavily based off of Wisp, and many of Wisp’s examples can easily be ported to Glen. Glen also has an example application of its own in ./test.

Bring-your-own server

Glen’s serve function only works on the deno runtime, but you can bring your own server so Glen can work on any runtime, such as Node.js or Cloudflare Workers. The convert_request and convert_response functions are here to help you with this.

Cloudflare Workers example


import * as glen from '../glen/glen.mjs';
import * as my_app from './my_app.mjs';

export default {
 async fetch(request, _env, _ctx) {
   const req = glen.convert_request(request);
   const response = await my_app.handle_req(req);
   const res = glen.convert_response(response);

   return res;


import gleam/javascript/promise
import glen
import glen/status

pub fn handle_req(_req) {
 "On a Cloudflare worker!"
 |> glen.html(status.ok)
 |> promise.resolve


main = "build/dev/javascript/my_app/index.js"
# ...


Documentation can be found at


gleam run   # Run the project
gleam test  # Run the example application
Search Document