Routex - Extension driven superpowers for Phoenix Routes

Routex is a powerful routing framework build on top of Phoenix Router. It is designed to simplify route manipulation —giving developers a new level of control over route management.

Due to its focus on flexibility, Routex is suited for both small and large-scale projects, allowing for seamless integration into existing codebases or entirely new applications. You simply enable the extensions your project needs or write them yourself without having to worry about the plumbing.

Top Features and Benefits

  • No dependencies, no state: Routex does not require any external dependency and works by default without proces state (e.g. no need for Gettext.put_locale/1).

  • Powerful transformations: Routex supports advanced route transformations, including everything needed for internationalization (i18n) and localization (l10n).

  • Extension driven: Being extension driven, Routex can be adapted to your specific needs. It’s architecture allows you to write your own routing features without having to worry about breaking existing functionality. Routex ships with extensions covering a wide range of use cases. Have a look at a summary of extensions.

  • Optimized for performance: Built to fit between route configuration and route compilation. Routex enhances Phoenix routing without adding runtime overhead, ensuring that applications run as fast as ever.

  • Detailed documentation: Comprehensive, well-organized documentation provides clear guidance on installation, configuration, and best practices, making Routex approachable for developers at all levels. For example: If you are interested in internationalization (i18n) or localization (l10n) have a look at the Localized Routes Guide.

Drop-in for Phoenix Routes and Cldr Routes

Routex can be configured as a drop-in replacement for both the native Phoenix Routes and Cldr Routes (using an adapter extension). You can give it a try without modifications to your templates, paths and links!

Requirements and Installation

See the Usage Guide for the requirements and installation instructions.

Demo

An app demonstrating various extensions working together to have drop-in support for localized (translated!) url’s without changing a single template.

Demo App - online
Demo App - source code

Links

Hex
Documentation
Source
Comparison with Cldr Routes and Phoenix Routes >= 1.8

23 Likes

Documentation is a key part of any library, so I took some time to refine and improve its structure. Huge thanks to the authors of ExDoc for making it all possible! Flexibility is the way to go :wink:

Old

New :fire:

3 Likes

Today I took the opportunity to resolve a significant shortcoming I had encountered with the extensions’ documentation. Although the extensions are supposed to operate in concert, the available documentation did not offer clear guidance on their integration. I am delighted to report that I have successfully published my solution to this issue.

The extensions’ co-operation is not exclusive. They are happy to co-operate with any third-party extension.


Both the Alternatives and Translations extensions are used for localization. The guide is now clearly linked in the documentation.


The documentation of the AlternativeGetters extension now includes an example of how it is used in templates.


The Cldr adapter is convenient for those using Cldr, but one might need more flexibility. The documentation now clearly states (how) you can “eject” the adapter.


Happy doc browsing!

4 Likes