What Elixir related stuff are you doing?

As I feel a like real influenca (pun intended) I got some extra time last week and as a result I started to further polish the dev experience for working with Routex! Too exiting to be silent about it, too premature to announce it officially in Routex - Extension driven superpowers for Phoenix Routes though.

This is all preview, not yet released

New Runtime Features:
Routex now supports extensions to directly hook into LiveView lifecycle events and Plug pipelines, which means it works seamlessly whether you’re building a classic web interface or a dynamic LiveView app. This runtime integration removes the need for extra glue code, making your routing configuration cleaner and more robust.

Fun fact: this new feature is implemented as extensions that inline other extensions hooks. This means that when you don’t want other Routex’ extensions to hook, you simply do not enable Extension.Plugs and Extension.LiveViewHooks! Supporting “simple by default, customizable when needed”

Introducing PutLocale:
The new PutLocale extension is a prime example of these runtime improvements. PutLocale automatically sets the locale for your application by integrating with both LiveView and Plug, and it’s built to support external apps when installed (Gettext, Cldr, Fluent). This ensures that any external services you use to manage locale settings work in harmony with your app’s routing—so your localized content is always in sync without any extra hassle.

Still needs work, but as a POC it works wonders :slight_smile:

New Presets:
I added a set of presets that simplify your configuration even further. These presets give you a ready-to-use setup for common routing scenarios, so you can get up and running faster without having to fine-tune every detail from scratch.

Fun fact: the presets are nothing more than extensions with only the configure/2 callback set and merging a list of default extensions and options with your customs. Another example of
“simple by default, customizable when needed”

Improved Configuration Error Handling & AST Debugging:
We’ve also enhanced our configuration error handling. Now, if there’s a misconfiguration, you’ll get a clear and actionable error message that points directly to the issue. Plus, there’s a new optional config option that writes the processed AST as code to a directory—ideal for debugging custom extensions or just getting a peek under the hood.

With these new features in the code base it’s time to further polish them for version 1.2

1 Like