Skip to content

A repo of scripts and mini guides for running Clojure as a cgi-script on shared hosts with Babashka


Notifications You must be signed in to change notification settings


Folders and files

Last commit message
Last commit date

Latest commit



8 Commits

Repository files navigation

Clojure on Shared Hosts with Babashka Example

How does it work?

A static Babashka binary uploaded to a shared host can run Clojure files as a cgi-script. Essentially we can use Clojure as if it were PHP!


Create a MVP or simple web resource using Clojure on a cheap shared account. It can easily support multiple projects!

Live Demo

Learn More

An article that covers the rationale, requirements, and setup in more detail:


Using multitime 1.4 within the development docker setup, the tests ran the example entrypoint metal.clj script 20 times.

multitime -n20 -s0 ./metal.clj



What’s Included

  1. Live Example Source
  2. A guide to building static pods with Docker
  3. Depjar: A Babashka CLI script to create single jars of a clojars artifact
  4. A Docker environment to test babashka web scripts

Live Example Source

The source files that are on the live demo. The libs and binaries are only place-holders. Download or build the libs, replace the place-holders, and upload those to a shared host.

If you are using this as a starting template be sure to replace any <username> references in example/public_html/ as well as

Building Static Pods

While some pods offer a static build in their releases page like It may be necessary to build them locally then upload it to the server. This directory contains a docker file and instructions to help speed the process up.


Since tools like `clj` or `lein` will not be available on the shared host, bb can create uberjars we can upload. Depjar is a script that takes a deps.edn files, uses Babashka to install deps, then create an uberjar for each library.

./depjar/depjar.clj ./deps.edn

Docker Development Environment

If you are having trouble getting it to work on a shared host you can at least use the development docker environment to try it out.

See the Readme to learn how to run the site.


In the Doom Emacs Discord, it was Taco (Elais Player) that came up with the idea and rushsteve1 that helped me understand how it would work.

Special Thanks

Big thanks in the Clojurians’ Slack to Borkdude (Michiel Borkent) for creating Babashka and Didibus for helping me figure out the first test Clojure web script.


A repo of scripts and mini guides for running Clojure as a cgi-script on shared hosts with Babashka







No releases published


No packages published