{"slug": "safsaf-a-web-framework-for-guile", "title": "Safsaf – A Web Framework for Guile", "summary": "Christopher Baines released Safsaf, a new web framework for Guile built on Guile Fibers and the Guile Knots web server, drawing from his seven years of experience developing Guix-related services. The framework, approximately 1,800 lines of code, features a declarative routing system that treats routes as data for introspection and middleware application, while deliberately omitting database support and MVC patterns. Baines developed Safsaf using Claude Code with Claude Opus 4.6, acknowledging ethical concerns around LLM-assisted coding but citing limited motivation and a desire to accelerate development for existing and future projects.", "body_md": "## Background\n\nOver the past week or two I've been working on a new web framework for\nGuile. This is based on the knowledge I've accumulated over the past 7\nyears working on things like the [Guix Data\nService](https://codeberg.org/guix/data-service), [Guix Build\nCoordinator](https://codeberg.org/guix/build-coordinator) and [Nar\nHerder](https://codeberg.org/guix/nar-herder), but also based on their\ncode, as I've used Claude Code running Claude Opus 4.6 to build this\n(a large language model).\n\nI've been hesitant to try coding with LLMs so far, I still think there's plenty of reasons to be, and others have done much more thinking about LLMs and the ethical and legal implications of using them to write software.\n\nThis blog post definitely isn't an argument for using these tools, but my \"excuse\" if you call it that, is that I wanted a Guile web framework to both use for existing and new projects, and this was an approach to get there faster and with the limited amount of motivation I have at the moment.\n\n## Introducing Safsaf\n\n[Safsaf](https://forge.cbaines.net/cbaines/safsaf), or Guile Safsaf\nif you prefer, is a web framework for Guile, built around using\n[Guile Fibers](https://codeberg.org/guile/fibers) and the [Guile\nKnots web\nserver](https://cbaines.codeberg.page/guile-knots/#knots_005fweb_002dserver).\n\nIt's only ~1800 lines of code, and the largest part is the router,\ndeciding which handler should respond to requests. The Guix Data\nService handled routing using `match`\n\non the method and path\ncomponents, and this works pretty well, but for a long while I've\nwanted a more declarative approach to routing. One where the code\ncould introspect the routes and generate links or even API\nspecifications.\n\nAnother important property of having routes as data is that it allows applying handler wrappers to the routes and the handlers that they reference. This is the model that Safsaf uses for middleware or functionality that you want to apply across some or all of the web service. Safsaf comes with a number of useful handler wrappers and functionality like logging and exception handling is implemented as handler wrappers.\n\nI think it's also important what's not included. In comparison to\n[GNU Artanis](https://artanis.dev/) (which I did try using for the\nGuix Data Service many years ago), there's no inbuilt support for\ntalking to databases, database migrations, a Model View Controller\ndesign or file based templates, and for all these things, I don't\ncurrently see a good reason to include support for them.\n\nI would like to look at what can be included for internationalization support, as I think that's important. I'd also like to look at what's required for Server Sent Events (SSE) and WebSocket support, particularly as the Build Farm Front-end (BFFE) uses Server Sent Events.\n\nThe Safsaf Git repository includes a couple of example apps which you\ncan run, a\n[paste-bin](https://forge.cbaines.net/cbaines/safsaf/src/branch/trunk/examples/paste-bin/paste-bin.scm)\nand a [blog\nsite](https://forge.cbaines.net/cbaines/safsaf/src/branch/trunk/examples/blog-site).\n\nThere's inevitably some issues with the code, and there's probably some issues with the design as well, but my hope is that this is a good starting point.\n\nIf you have any comments or questions, please reach out to me via\nemail at [mail@cbaines.net](mailto:mail@cbaines.net), raise an issue\non [Forgejo](https://forge.cbaines.net/cbaines/safsaf), or contact me\non the [Fediverse](https://gts.hotaircat.net/@cbaines).", "url": "https://wpnews.pro/news/safsaf-a-web-framework-for-guile", "canonical_source": "https://www.cbaines.net/posts/safsaf_a_guile_web_framework/", "published_at": "2026-06-05 23:26:51+00:00", "updated_at": "2026-06-05 23:48:29.489175+00:00", "lang": "en", "topics": ["large-language-models", "ai-tools", "ai-ethics"], "entities": ["Guile", "Guix Data Service", "Guix Build Coordinator", "Nar Herder", "Claude Code", "Claude Opus 4.6", "Guile Fibers", "Guile Knots"], "alternates": {"html": "https://wpnews.pro/news/safsaf-a-web-framework-for-guile", "markdown": "https://wpnews.pro/news/safsaf-a-web-framework-for-guile.md", "text": "https://wpnews.pro/news/safsaf-a-web-framework-for-guile.txt", "jsonld": "https://wpnews.pro/news/safsaf-a-web-framework-for-guile.jsonld"}}