This blog is built atop of GitHub Gist...

In case you were wondering, this blog is:

I managed to stand up a minimal version of this (sans styling) in a single afternoon1. Here’s how it works, and some caveats.

Using Github Gist as a data store

Using Gist as a data store is not a novel idea, I’ve seen it reproduced a number of times by other people. It’s free, there’s an API, and I don’t have to worry about backups, since the service itself can be considered an off-site backup separate from the web server serving the blog.

They have a free API that returns any user’s public gists

ww9 suggested in his guide that appending #blog to your gist title would allow it to be filterable – N.B. this ended up not being the case, but I still appended the tag and did the filtering from within the Node app itself.

I used node-fetch to retrieve the gists, and stored the result in-memory, along with the ETag present in the response header.

Every time the page loads, I send a HEAD request to that same URL, and compare ETags. If there is a mismatch, I update the gists stored in-memory. I didn’t want to be a bad consumer (of a free API, no less!) and continually hit the route on each page load, if the data hadn’t changed.

Benefits

Caveats

So far so good, but some things I have noticed:


Footnotes

1 This wasn’t meant to be a humblebrag. Between my 2-year-old toddler and a newborn, I needed to move fast or this wasn’t getting off the ground at all! It looked ugly, but it did its job.

2 sigh… even in my hobby projects, feature creep finds a way.

← Back to all posts