Nine - data driven routing library for elli web server

This library was initially developed during the 2023 Spawnfest hackathon last month. I have since made updates, wrote extensive unit tests, and got it prepared for public usage.

Source
Hex

nine is a library to enable composing routes and middleware for elli webservers in a declarative way. If you use elli webservers this will provide a nice quality of life improvement. There were several influences on this library. Most importantly, if you are familiar with Plug.Router then you should feel right at home. I created this library because I wanted to precisely compose middleware at any level I wished. elli’s middleware features were not fine grained enough for me. While there may be some sharp edges, I have found it is already useful for basic applications.

The way it works is it takes a route configuration (just an Erlang map) and compiles it into an elli callback module. You can see this example module for how it looks to use nine in practice. For now, this only supports elli, but in theory it could be decoupled to support other web servers.

My future plans are to implement route config validations, as well as property based testing.

I hope others will enjoy this package as well!

10 Likes