A minimal frontend router with support for params, hash routes, and wildcards.
Nanorouter is a small frontend router for JavaScript applications that handles route matching and execution with a minimal API. It solves the need for lightweight routing without the overhead of larger frameworks, supporting params, hash routes, and wildcards.
Frontend developers building small to medium-sized JavaScript applications who need a simple, fast routing solution without complex dependencies.
Developers choose Nanorouter for its extreme simplicity, small footprint, and performance, as it focuses solely on core routing logic while being compatible with the History API for navigation.
🛤 - Small frontend router
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
With just on(), emit(), and match() methods, integrating and using the router is straightforward, as shown in the usage example where routes are defined and triggered with simple calls.
Supports parametric routes (e.g., /foo/:bar), hash routes, and wildcards, covering essential routing scenarios efficiently, as demonstrated in the README's code snippets.
Described as 'smol' and focused on core routing, it avoids bloat, making it ideal for small to medium-sized apps where fast load times and minimal dependencies are prioritized.
Includes a configurable default route (e.g., /404) for unmatched paths, adding basic error handling without extra code, as specified in the API options.
The README explicitly states that router() does not affect browser history, requiring manual integration with pushState and replaceState, which adds complexity for navigation.
Compared to alternatives like sheet-router, it covers fewer concerns such as no built-in state management or advanced routing patterns, limiting use in complex applications.
Marked with an 'experimental' stability badge in the README, indicating potential for breaking changes or lack of long-term maintenance, which may deter production use.