Progressive Rails Apps

By mike geyser

Elevator Pitch

Technology is cyclical. With the return to building SSR web applications, we are armed with the key technology of the PWA movement - the Service Worker. This code-oriented talk will explore practical, alternative architectures for web applications - blending the world of PWAs and SSR apps.

Description

Technology repeats, like a record. Patterns and practices continually wax and wane in popularity, but never return to exactly the same groove - instead they progress a little each time. This is true with the spin towards building server-side-rendered (SSR) web applications; a trend driven by the need to improve the performance of rampant, javascript-heavy sites. This time round however, we are armed with the key technology of the Progressive Web App (PWA) movement - the Service Worker. Why do we care? Because much of the real innovation in the PWA space is happening off of the main thread.

This talk will explore practical, alternative architectures for web applications - blending the world of PWAs and SSR apps. Coding on an archetypal Ruby-on-Rails project, we will introduce pre-caching, navigation preloading, analytics and offline content - highlighting the incremental performance improvements. While the talk will focus on Ruby, the ideas can easily transpose to any language and framework you dig.

Notes

Plan of delivery: This talk will start off with a brief (hopefully comical) introduction, before progressing into a high-level explanation of what PWAs are. It will introduce the salient characteristics of PWAs, before discussing what facets we care about from a performance perspective - particularly the ServiceWorker. I will then show how out of control the ‘median’ SPAs are in terms of performance. We will discuss the return to SSR applications, and how much of the interesting performance work is happening by using the ServiceWorker. The last thing I’ll do in this section is introduce workbox, and explain it’s role as an abstraction layer. This should all take about 5 minutes.

The next stanza is a live coding excercise where we will use an archetypal Ruby-on-Rails project to illustrate how to use the Service Worker for perfromance gain. The project will be a cheesy ‘my first blog’ type of application, and we’ll go through the excercise of precaching static assets, responding to navigation events, using workbox streams to cobble together the page faster, intercepting and finally showing how to have the site be partially available offline (and how to communicate that state properly to the user). The demo will be snippet driven, to make it faster and reliable. I have delivered may talks using this format before, and it’s usually very well received. This part is the bulk of the talk should be about 15-20 minutes, depending in timing. I will focus on having some of the content skippable, in case we come under time pressure.

We’ll cap off the talk by showing some before-and-after statistics of the performance gains, and summarise to show why we should care about blending these two worlds - SSR and PWA. I will close out pretty quickly, in about 2 minutes.

Why this talk? Well, performance is a really critical aspect of the WWW in both the developed- and developing-world, although for different reasons. I think it’s really essential that we understand all of the tools at our disposal to write fast, modern web experiences.

Why me? I am a frequent technical speaker, and I have extensive experience presenting on different facets of PWAs. I enjoy live coding, and have had a bunch of success presenting code in a clear, concise and accessible manner. While I haven’t worked in ruby in a long time, I am still aware of the ecosystem, and feel like I can contribute meaningfully to this community.