Routex is a comprehensive, batteries included framework built on top of Phoenix, designed to streamline and empower your routing workflows. By simplifying route manipulation at compile time and enabling the use of custom route attributes during runtime, Routex provides the granular control needed to tackle the most complex routing challenges.
Its modern, extensible architecture allows for effortless creation of custom solutions, extending its functionality far beyond standard routing.
For developers seeking robust Phoenix localization solutions, Routex excels. It offers a suite of extensions enabling internationalization (i18n) and localization (l10n), including but not limited to seamless support for translated (multilingual) URLs, locale preference detection at run time and support for multiple backends. Included extension SimpleLocale simplifies common Phoenix localization by including a IANA based locale registry for robust locale validation and conversion to display names.
Forget any notion of difficult setup – localizing your Phoenix application with Routex is a breeze. Just copy the example configuration from our Localize Phoenix using Routex guide for an effortless start.
This documentation reflects the main branch. For the latest stable release, refer to HexDocs).
-
Simplify development: Routex combines compile-time code generation with dynamic runtime behavior by seamlessly integrating LiveView lifecycle hooks and pipeline Plugs. This enables extensions to provide powerful runtime features such as automatically locale detection and synchronization between the server, client, and LiveView processes- without requiring modifications throughout your codebase.
-
Drop-in solution: Extensions are highly configurable, allowing you to use Routex features as drop-in solution. For example: Routex can be configured to remain compatible with Phoenix' template generators. As such, it doesn't disrupt standard Phoenix development practices lowering the learning curve. It can also be configured to mimic Cldr-Routes with its tight integration wirth Cldr and use of custom sigils.
-
Optimized Performance: Positioned between route configuration and compilation, Routex core enhances Phoenix routes without incurring additional runtime costs. Extensions too are optimized for runtime performance, making use of Elixirs superb pattern matching.
-
No dependencies, no state: Routex is unique in not depending on other libraries and works out-of-the-box without proces state. An extension to control third-party libraries that do rely on state such as Gettext is included.
-
Detailed documentation: Comprehensive, well-organized documentation provides clear guidance on installation, configuration, and best practices, making Routex approachable for developers at all levels.
Online demo - have a look or get the code.
Usage Guide - requirements and installation. instructions.
Documentation - from step-by-step guides till in-depth explanations.
To better understand how Routex integrates with Phoenix Router and where it fits into the broader ecosystem, take a look at our in-depth guides:
How Routex and Phoenix Router Work Together - Discover the mechanics behind the integration and the benefits of a unified routing system.
Routex compared to Phoenix Router and Cldr Routes - Understand the differences, strengths, and tradeoffs when deciding which routing solution best fits your needs.
Routex comes equipped with a extensions that cater to common and advanced use
cases in Phoenix applications. Each extension is designed to operate
independently yet harmoniously with other extensions through the shared
Routex.Attrs
system. This flexibility allows you to tailor your routing system
to your specific needs without resorting to extensive modifications or the
burden of maintaining a fork.
- Modularity: Each feature is encapsulated in its own extension, making it easier to manage and maintain.
- Flexibility: Extensions can be enabled or disabled as needed, allowing for a customizable and adaptable routing system.
- Interoperability: By using
Routex.Attrs
to share attributes, extensions can work together seamlessly without being tightly coupled, promoting a decoupled and scalable architecture. - Customizability: If you have a unique requirement, you can adapt an existing extension -or create your own- without the need to fork or reach upstream consensus on the need and purpose.
- Attribute Getters: Fetch custom attributes for a route.
- Alternatives: Create (nested) alternative routes.
- Alternative Getters: Get alternatives for the current route.
- Assigns: Use route attributes as assigns in templates.
- Cldr Adapter: Use an existing
:ex_cldr
configuration. - Cloak: Showcase to demonsrate extreme route transformations.
- Interpolation: Use attributes in route definitions.
- LiveView Hooks: Integrate LiveView Lifecycle hooks provided by other extensions.
- Plugs: Integrate plugs provided by other extensions.
- Route Helpers: Create branch aware Phoenix Helpers.
- Runtime Callbacks: Call arbitrary functions with route attributes at runtime.
- Simple Locale: Simplifies common Phoenix localization (based onIANA locale registry).
- Translations: Translate route segments / full localized URLs.
- Verified Routes: Branch aware variant of Phoenix.VerifiedRoutes.