Hacker News new | ask | show | jobs
by lukeschaefer 745 days ago
Ah that's on me, it's a private repo because my code is embarrassing. But behind the scenes here's how it works:

- I wrote my own scraper for HN for reasons I no longer remember

- Scraper is called every 30 seconds by an Apps Script timer on a Google Sheet (to be dirt cheap, Vercel doesn't have free cron jobs).

- Caches the front page, plus ten comments per post into a single Firestore document (to save money on reads vs 20 reads per load)

- Home page loads via SSR with Nuxt.

- Post pages will load the rest of the comments from a separate doc for each post

- the other comments load instantly on navigation if on a halfway decent connection - but if not, you still get to see the first 10 comments to get an idea of the discussion while you wait.

- Added some Workbox stuff to get it offline-first.

- Added an IndexDB wrapper around Firestore for more control over cache behavior I think.

- It's worked now for over a year with no oversight needed and not costing a penny!

Then I got distracted because I wanted to rebuild it from scratch to not use Nuxt and never completed that rewrite. Been a while since I've worked on it, had no idea other people even knew it existed! There's definitely some bugs (I think CSS gets broken on deeply nested comments) but it worked enough for my uses so I moved on.

3 comments

>[from profile:] Recently quit my job, now I work on anything that holds my interest (until I run out of money)

I did the same thing... lots of fun, but the "run out of money" part is rough! I resorted to freelancing, and now I'm going back to university.

Neat! Thanks for the details :)