Nice article by @robbie.huffman about writing CGI scripts directly with babashka: https://blog.nundrum.net/posts-output/2025-07-09-clojure-cgi/
Cool post, reminds me of https://github.com/jaidetree/clj-cgi-example
the blog post for it is dead, but it's on https://web.archive.org/web/20241117085046/https://eccentric-j.com/blog/clojure-like-its-php.html
Thanks! I hadn't seen that before. And now it has me wondering if could use this or Phel for making Nextcloud apps 😅
What about also posting this to #news-and-articles @robbie.huffman ?
@j.s Maybe someday I'll try it again. The last time I couldn't figure out what the model was behind NC. It was much more complex than expected. But they have added a lot more documentation since my last attempt.
Sure! Why not?
Go ahead! :)
Just did! 😄
If you mention the title along with the link, it's a bit friendlier to people following that channel
It looks like Slack pulled in the title and description?
not for me
Take an example of the link above
how odd!
@robbie.huffman NC app with Phel should work as output is simply transpiled PHP. It takes some experimentation though depending how NC does "plugins". I managed to get it working with WordPress pretty well with most pain being Composer support v.s. WP which just generally sucks. It is pretty minimal and might give hints on what the integration needs. https://github.com/jasalt/phel-wp-plugin
Also take into account that by default the transpilation happens during runtime / request, if you don't transpile ahead-of-time using export (I haven't gotten to that yet).
Basically, the "main" file WP runs during plugin init has following:
use Phel\Phel;
$projectRootDir = __DIR__ . '/';
require $projectRootDir . 'vendor/autoload.php';
Phel::run($projectRootDir, 'phel-wp-plugin\main');
Something similar would probably be the case for other systems also.Other way around, a Phel script can bootstrap WP environment by requiring wp-load.php which can nice to "REPL into" or use for Phel unit test runner and stuff..
Should be possible to have CGI style bb scripts working as part of / alongside PHP webapp too but with WP stuff on managed hosts running other than PHP-FPM in ports 80 & 443 is pretty much blocked. Invocating subprocesses is also (again if supported on hosting) but there's bit of overhead, same with IPC sockets etc. With lower level languages you could build PHP extensions (e.g. C, Janet, Rust) but adding those is also blocked on managed hosting, runtime overhead would be less.
What's old is back, I love it!
What's this about next cloud apps?
Just wondering if a NC app could be made with Babashka or Phel: https://phel-lang.org/
I was just about to install NC and I didn't know about the apps thing. Nice, I'll check it out
I've been running Nextcloud for over a decade, so feel free to PM me with questions.