3 min read

Fontsource

Fontsource home page image.

Why?

Self-hosting fonts ought to be easy. But it used to be an optimization that was often deferred and not prioritized in the past because the tooling was frustrating. You either relied on Google Fonts’ CDN or manually managed the assets yourself.

Fontsource was built to fix that by making fonts a first-class citizen of the NPM ecosystem.

What started as a simple idea has increased in scope significantly. Today it offers versioned NPM packages, a website for comparing them, and a specialized API and CDN service for serving font-related metadata and files.

History

I started Fontsource when I was 16 with no prior JavaScript experience. Having stumbled upon Kyle Matthews’ typefaces project, I noticed it had begun to be neglected as Kyle moved on to create the amazing Gatsby React framework.

As I was someone who learnt by doing, rather than reading or watching tutorials, I decided to rewrite it from scratch to resolve many of the key issues with the original model.

A permanent testbed

Over the years, Fontsource has served as my permanent testbed for new JavaScript tech. If I want to see if a new pattern or tool is actually worth adopting, I trial it here first.

For example, the latest iteration of the Fontsource API is built on Cloudflare Workers… for the second time. There’s also some experiments with WASM lurking around and other more ambitious things in the works. The oldest parts of the codebase have gone through several complete rewrites, from JS to “bad” clueless TypeScript to rewriting again from a more experienced TypeScript perspective.

The code isn’t perfect, but it is nice to write experimental code knowing that it actually is being used by someone. That’s the self-looping motivation I have to keep maintaining and playing around with this project.

Status

Fontsource is currently in a stable, self-sustaining state. It doesn’t require much input from me. That said, I’ve been cooking something up for the next major release to push the ecosystem forward, so stay tuned for that.