Love On The Route: 4 lines for routing that works

Seeing CSS developers on TikTok, combined with framework hype, gave me an idea: what if we simplified routing in vanilla TypeScript?

2 minutes read

I was scrolling TikTok when I came across "CSS developers". At first I laughed, then I looked at what they were doing: pretty clean interfaces!

CSS doesn't solve everything. On the other hand, I'd been finding it absurd to use frameworks for everything. I see React portfolios that could do exactly the same thing with a TypeScript web app and an animation library (GSAP, Motion...).

From PanicMode to Love On The Route

I was job hunting and working on small projects like "panicmode", a Daisy UI wrapper. I liked Daisy and wanted to create a tool for quick mockups.

The result sucked. It added complexity instead of removing it. I was depending on a lib that depended on a lib. I was reproducing the modern JavaScript model: always more layers.

Love On The Route is the opposite: solving the problem at its source.

4 lines, that's it

import { createRouter, autoDiscoverPagesIntelligent, generateRoutes } from "love-on-the-route";

const pages = import.meta.glob("./pages/**/*.ts", { eager: true });
const { routes } = autoDiscoverPagesIntelligent(pages);
const router = createRouter(document.querySelector("#app"));
generateRoutes(router, routes);
router.render();

That's it. Your files in pages/ become routes.

File-based, like Next but vanilla

File structure:

  • pages/Home.ts → /
  • pages/About.ts → /about
  • pages/Contact.ts → /contact

One page? One file:

export default function About(): HTMLElement {
  const div = document.createElement("div");
  div.innerHTML = '<h1>About</h1>';
  return div;
}

Automatic:

  • Navigation generated
  • SEO configured
  • Multilingual if you organize by fr/ and en/ folders
  • TypeScript, 0 configuration

Who is this for?

  • You want to prototype fast without fighting with config
  • You're tired of frameworks for simple stuff
  • You prefer coding your content rather than your tools
  • You want to ship quickly without sacrificing quality

My vision

These TikTok developers have creative talent. They just need tools that don't slow them down.

Love On The Route: ultra simple, zero imposed CSS, logic handled automatically.

If you know how to create a function, you know how to use it. The ultimate goal? If you can read, you can use it.

Try it now

npm install love-on-the-route

Got a project that needs simple routing?

Let's talk about your project and see if Love On The Route can save you time and money.

Contact me
Matthieu Gravy