Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Examples of Clojure projects that compile to native:

- babashka (https://github.com/babashka/babashka)

- clj-kondo (https://github.com/clj-kondo/clj-kondo)

- jet (https://github.com/borkdude/jet)

SCI (https://github.com/babashka/sci) is a Clojure interpreter that allows you to evaluate Clojure code even inside of the final native binary and is used in all of the above projects.

Feel free to bug me with questions in the graalvm channel on Clojurians Slack.



I want to slap a bunch of side projects on a small VPS. With Go, this is no problem. Scp the binary (which includes an embedded SQLite), configure it to run as a systemd service, add it to my reverse proxy rules.

I’d love to use Clojure for this, but it doesn’t seem well suited to running in a small, shared environment. Or is it now that there’s AOT?


Here, have some PCP![1] The first one's free!

> An easy to use, drop-in Clojure replacement for php scripts

> Allow multiple websites to be hosted on a single $5 VPS

> The utility is a simple binary, built with GraalVM, that allows you to work effectively with pcp.

Note that not all of PCP is AOT compiled. Just the command line utility. There's a daemon as well.

[1] <https://github.com/alekcz/pcp>


Pretty similar with Clojure, though because it's not the default mode of operation, more stuff will break. Still, we do this all the time and it's mostly fine.

That said, seems like you should be able to do something pretty similar fairly easily with jars and the JVM (you may not want to run lots of JVMs in the method you're describing, since if you're calling these processes in a one-shot, CGI-style fashion, the JVMs startup time and memory requirements is going to be annoying.)

GP also linked babashka which may be closer to your interests, as its an interpreter for small scripts like these, but also comes with a mechanism (pods) for loading dependencies (like SQLite).


I'm running a side project in Clojure (a guess-the-number-of-covid-cases lottery, https://koronalotek.pl) on a small VPS (Scaleway DEV1-S), and it is no problem either. It runs happily in the 2 GB RAM that the server has; I just installed the JVM, configured a nginx reverse proxy, and am using the standard cli-tools in a screen session to run it.


Depends on how much value you place on performance. For long running processes like web servers, the JVM still reigns supreme.


You should be fine, but it depends on your definition of “small VPS”. Generally, assume that each process will need about 512MB of memory.

You’ll definitely want to restrict the JVM by memory, either by explicit flags (-Xmx ) or by running them in a cgroup or container.


Perhaps fennel+openresty is a better fit for that kind of use case.


Thanks for the info!

BTW, I enjoyed your ClojureScript+Node.js talk a few weeks ago.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: