page.js VS universal-router

Compare page.js vs universal-router and see what are their differences.

page.js

Micro client-side router inspired by the Express router (by visionmedia)

universal-router

Universal routing both for backend and frontend (by fatih-erikli)
Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
page.js universal-router
4 1
7,665 2
0.2% -
0.0 2.1
10 months ago over 2 years ago
JavaScript TypeScript
MIT License -
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

page.js

Posts with mentions or reviews of page.js. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2022-05-13.
  • Show HN: React Routing in 120 lines (including comments)
    9 projects | news.ycombinator.com | 13 May 2022
    I've used a lot of routers and my favorite is still page.js[1]. It hasn't been updated in years. But it's small, is Express-compatible (i.e. server/client routes can use the same code), and, more importantly, is hackable. I'll never use a router tied to a certain framework again (react, nextjs, etc.) because you trade flexibility for perceived convenience (e.g. using folder structure as route structure, or React component tree as route structure). But it's a terrible trade-off that paints you into a corner later, IMO. Routing can get really niche and site-dependent, so having it fully under your control is worth it.

    [1] https://github.com/visionmedia/page.js

  • Dynamic routes using vanilla HTML CSS JS?
    1 project | /r/webdev | 4 Apr 2022
    Use a simple routing library like pages.js, but in this case I feel it might be overkill.
  • [AskJS] Are there any framework agnostic routing libraries that are well supported?
    4 projects | /r/javascript | 1 Sep 2021
    I've used Page.js for a couple of SPA projects. It was last updated a couple of years ago. The documentation isn't the best, but the client-side router does its job.
  • Building a blog with Svelte: Dynamic imports For Svelte components
    1 project | dev.to | 17 Feb 2021
    We're using onMount to trigger the dynamic import when this component is first rendered. My blog uses page.js as a router, so these dynamic imports are triggered by page transitions, but the logic is the same.

universal-router

Posts with mentions or reviews of universal-router. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2022-05-13.
  • Show HN: React Routing in 120 lines (including comments)
    9 projects | news.ycombinator.com | 13 May 2022
    I use it like that and I am pretty happy with it.

    There's one thing, you should redirect all the pages to one single endpoint in server side order to use "pushState". Otherwise it will return 404 when you hit the refresh button. If you don't own a server, you can support routing with hashtag "#" and listen to "onhashchange" event instead of "popstate".

    Also, if you would like to support nested and dynamic routes (it's not possible with that code snippet in the github repository since it just checks like `path===currentPath`), you might look at the following solution:

    https://github.com/fatih-erikli/universal-router/blob/main/u...

    I use that solution in server-side and client-side so it works like Nextjs.

What are some alternatives?

When comparing page.js and universal-router you can also consider the following projects:

director - a tiny and isomorphic URL router for JavaScript

react-snippets - A sample of useful snippets in React

crossroads - JavaScript Routes

crossroad - 🛣 A React library to handle navigation in your WebApp. Built with simple components and React Hooks so your code is cleaner.

pathjs - Simple, lightweight routing for web browsers

awesome-go-orms - ORMs for Go, most starred on GitHub.

frontexpress - An Express.js-Style router for the front-end

todomvc - Helping you select an MV* framework - Todo apps for React.js, Ember.js, Angular, and many more

navaid - A navigation aid (aka, router) for the browser in 850 bytes~!

wouter - 🥢 A minimalist-friendly ~2.1KB routing for React and Preact

SPApp - Single Page Application micro framework. Views, routes and controllers in 60 lines of code

react-simplest-router - simplest router for React