A concept you should embrace about service workers is that they can act like a web server in the browser. Traditionally, web servers have used runtime rendering platforms, such as ASP.NET, PHP, Ruby on Rails, and content management systems such as WordPress, Drupal, and Joomla!. These systems are rendering engines more than anything else. You can perform HTML rendering inside of a service worker.
Single-page applications have become very popular this decade. They effectively take ownership of this rendering process from the server. Today, it is popular to preload application templates, whether you're using mustache, handlebars, or larger frameworks such as Angular and React. All of these are essentially just HTML rendering systems. The difference between the server side and the client side is where the rendering takes place. Because you can intercept...