Worker News

Worker News

Worker News is a drop-in replacement* for Hacker News with support for dark mode and block quotes.

Worker News is a drop-in replacement (aspirationally*) for Hacker News with support for dark mode and block quotes. It is built with Worker Tools and hosted on Cloudflare Workers.

The purpose of the app is to be a playground for CF Workers and Worker Tools, as well as making reading HN a bit more convenient.

Architecture

The app gets the Hacker News data by scraping its frontend1 (using Cloudflare’s HTMLRewriter) and then re-renders the HTML and streams it to the browser. Internally it makes heavy use of Async Generators to achieve this.

The combination of running the app on the edge and streaming response bodies makes initial responses up to and including the top navigation bar arrive near instantly. Overall it feels faster than HN itself, even though it is technically a bit slower.

*Features

HN as a surprising amount of features, many of them undocumented, which makes it hard to reach feature parity. Here is what Worker News currently supports:

  • Story pages with pagination (top stories, newest, best, etc..)
  • Item pages with comment trees
  • Comment pages
  • User profiles
  • User submissions
  • User comments
  • /from?site= sites
  • Polls
  • Jobs

It is currently lacking all interactive elements. Clicking reply, upvote, etc. will simply open the corresponding HN page in a conveniently placed popup.

Dark mode CSS is provided by jgthms/hacker-news-dark-mode


  1. Unfortunately the HN API does not provide enough data to make a full HN clone. ↩︎


© 2022 Florian Klampfer

Powered by Hydejack v9.1.6