Hacker News new | ask | show | jobs
by nicbou 990 days ago
I'm going back to the file system as a source of truth with static site generators.

The main reason is that I can use a variety of tools to view and manipulate files.

But other software can also mess with your "database", including the operating system itself. For example, Syncthing was breaking my static site by changing the unicode normalisation of file names. MacOS being case insensitive brought issues. Illegal filename characters brought issues.

This approach works well if you want to make data accessible to humans, but it's wildly inefficient if you expect machines to operate on that data, and comes with a few caveats.

Pick the right tool for the job.

1 comments

> The main reason is that I can use a variety of tools to view and manipulate files.

This is also the reason I am researching this old "What if" problem.

Because I think comparing to some version of MySQL or PostgreSQL, files are stable, open and timeless.

This is exactly why I chose that approach for my websites. My website content and its backups are source-controlled, human-readable files. I can edit them with the tools I love, not just what's supplied with the content management system.

I'm now rebuilding my timeline thing [0] with the filesystem as the database. However, I still use an SQLite database as intermediate storage, because extracting metadata from thousands of photos is not cheap.

In other words, you'll need to build your own cache, and sync it with your filesystem. Making data human-readable makes it slower for machines to read.

[0] https://nicolasbouliane.com/projects/timeline