Svelte Router

A simple router for Svelte single-page apps. Supports hash and path-based navigations.

What I've Learned

Svelte Router came to fruition based on a side project. Out of 10+ popular routers out there, none fitted my needs. So I built one with all the features I need.

While building a proof-of-concept, I realized it wasn't as simple as it seemed. I've dug through popular routers like React Router, Vue Router, svelte-router-spa and svelte-routing to grasp the general implementation, but most of them over-complicated the process and missed some crucial features that resorted to workarounds. With that said, I don't blame them since tradeoffs are always unavoidable.

With the newfound knowledge, I was able to simplify the routing process and make the code as readable as possible without sacrificing DX on both the user and maintainer side.

Besides that, I also learned using Cypress for end-to-end tests. Although the application is fairly simple, I got a better idea of how e2e testing works now and it's no harder than unit testing.


© Bjorn Lu 2021