r/Clojure • • Oct 29 '24

Zodiac - a Clojure micro web framework

https://github.com/brettatoms/zodiac

Zodiac is a small web framework for Clojure that provides a reasonable set of defaults while also being easily extensible. Zodiac stands on the shoulders of giants rather than being innovative. At its core Zodiac is mostly just a preconfigured Ring app and not more that a few hundred lines of code.

Zodiac tries to fill a similar niche as the Flask framework with defaults that make it quick to start a new Clojure based web app without being heavy-handed.

What Zodiac includes by default:

  • Routing and middleware. We use Reitit

  • Request and response handing with Ring.

  • A jetty server (though Jetty can be turned off)

  • Automatic Hiccup-based HTML rendering using Chassis.

  • Websocket support

  • File streaming

  • Flash messages

  • Cookies and secure session handler

  • Form and JSON parsing request parsing

  • Extensible. Pass a list of functions to extend Zodiac. Override the error handlers.

  • Convenience

    • Helpers to lookup routes

    • Helpers to return hiccup and JSON responses

    • A request context

    • Variables dynamically bound to the current request, router and session

What Zodiac doesn't do:

  • Dictate a file structure with generators or scaffolding.

  • No configuration over code

  • No path based routing, etc.

  • Expect a certain database

  • Asset bundling

And that's about it. Zodiac is mostly feature complete. Additional features like common database setup and asset handling will be done as Zodiac extensions.

85 Upvotes

9 comments sorted by

View all comments

5

u/ovster94 Oct 30 '24

Is it called Zodiac because it's the killer web framework? :D

Great work btw!