stacker.news icon indicating copy to clipboard operation
stacker.news copied to clipboard

Turn Stacker News into a Progressive Web App

Open notnout opened this issue 3 years ago • 0 comments

Currently on my machine it takes ~2s to get response to the initial GET / request, which slows down the experience. If the App would follow the rules around PWAs and register ServiceWorker, define manifest and static resources, then the initial 2s could be completely eliminated. PWAs are using interesting set of native browser APIs and there are multiple interesting things that can be done.

Here are basic tutorials:

  • https://web.dev/learn/pwa/
  • https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Offline_Service_workers

The are various benefits, e.g.

  • saving latency and number of resources that need to be sent over wire (essentially the ServiceWorker serves as a proxy between the web app and internet - you can do various caching and background-refetching schemes)
  • better control around icons on the phone
  • the app can fairly easily be wrapped into an Android app and put on Play Store: https://developers.google.com/codelabs/pwa-in-play#0
  • It's easier/possible to register phone notifications even if Stacker News isn't in focus

notnout avatar Apr 15 '22 22:04 notnout