
FontCache
One day while working for a client, I hit an unexpected wall: their enterprise environment had strict security policies that blocked all third-party API calls. Even something as simple as fetching Google Fonts was impossible. I found myself manually downloading font files, dropping them into the public folder, and rewriting @font-face rules by hand—repetitive, error-prone, and a distraction from real development.
That pain point planted a seed. I kept thinking, “Why can’t this be automated?” If a tool could fetch fonts once, store them locally, and update the CSS automatically, we wouldn’t need to rely on external servers—or copy-paste font files again. The idea was especially appealing for restricted corporate networks, offline-first apps, and privacy-sensitive projects.
FontCache is the result: an NPM package that downloads and manages Google Fonts locally. With a single command, it pulls the families and weights you specify, generates the correct CSS, and saves everything neatly in your project. The outcome is faster performance, no runtime calls to Google, and full control over assets—even in the strictest environments.
Installing it is straightforward: run npm i fontcache. Then fetch the fonts you need with a single CLI command, for example: npx fontcache --family="Inter:400,500,700" --output=./public/fonts. Your fonts become self-hosted, reliable, and friendlier to Core Web Vitals.
What started as a small workaround has become a tool that saves time, improves performance, and helps teams meet enterprise policies without sacrificing developer experience.