Superwebapps: Rethinking Desktop Applications With Progressive Web Apps

Rate this content
Bookmark

Progressive web apps describe a whole new set of browser features that enable completely new ways of interacting with web applications.

While originally intended as an alternative to mobile apps, we are seeing more and more desktop apps that rely on the web platform. Photoshop, Visual Studio Code, Squoosh, Clipchamp and the whole Google Office Suite are just a few examples of a growing number of completely web-based desktop applications - Superwebapps!.

In this talk, we will focus on some of the new and exciting browser capabilities that allow us to create powerful React applications that make our daily lives easier. Of course, including tangible examples and an outlook on the browser roadmap.

This talk has been presented at React Summit 2024, check out the latest edition of this React Conference.

FAQ

MDEdit is a tool that converts Markdown into HTML, providing a what-you-get editor to write HTML that can be converted back to Markdown. It functions as a Markdown editor app or website.

MDEdit can be considered both a website and an app. It aims to offer functionalities of both, including reading and writing files, and working offline, making it a super web application.

Progressive Web Apps (PWAs) are web applications that progressively gain more app-like features, such as offline functionality and push notifications, making them comparable to native apps. They are designed to work universally across different operating systems and screen resolutions.

A Web App Manifest is a JSON file that contains metadata about a web application, such as its title, description, colors, and icons. It allows the browser to recognize and offer the app for installation.

A Service Worker is a JavaScript file that runs separately from the main browser thread. It can intercept network requests, cache resources, and enable offline functionality, even when the browser is closed.

MDEdit uses Service Workers to cache resources and handle network requests, allowing the app to function even when the internet connection is lost. This ensures reliability and faster load times.

Web applications can use session storage, local storage, IndexedDB, and the Origin Private File System API to store data. Session and local storage are limited in size, while IndexedDB and the Origin Private File System API offer more extensive storage options.

The File System Access API allows web applications to read and write files directly on a user's device. It enables more advanced file handling capabilities, such as opening and saving files directly from the app.

Project Fugu is a collaborative effort by Google, Microsoft, and Intel to bridge the gap between native apps and web applications. It aims to enhance web capabilities through new APIs, making web apps more powerful and versatile.

The Local Font Access API allows web applications to access and use fonts installed on a user's device. It enhances customization options for applications like MDEdit, which can use these fonts for better text rendering.

Nico Martin
Nico Martin
22 min
18 Jun, 2024

Comments

Sign in or register to post your comment.

Video Summary and Transcription

MDEdit is a tool that converts Markdown into HTML and provides a what-you-get editor. Progressive web apps offer a comparable user experience on both desktop and mobile devices. The Service Worker allows web apps to remain functional even without an internet connection. The Persistent Storage and File Handling APIs enable web apps to store data and access files on the client's device. Project Fugu provides new APIs, including the Font Access API, to bridge the gap between native apps and web applications.

1. Introduction to MDEdit and Progressive Web Apps

Short description:

MDEdit is a tool that converts Markdown into HTML and provides a what-you-get editor. It wants to read files, write files, and work offline. It is a Super Web Application, bridging the gap between the browser and native applications. Progressive web apps offer a comparable user experience on both desktop and mobile devices. They should be fast, integrated, reliable, and engaging. The Web App Manifest and the Service Worker are core concepts introduced by browsers to solve these problems.

Hi, everyone. My name is Nico. I am a front-end developer from Switzerland, and here with me is MDEdit. MDEdit is a tool that converts Markdown into HTML, and it then provides a what-you-get editor that lets you, or that helps you, write HTML that will then be converted back to Markdown. In other words, it's a Markdown editor app or Markdown editor website.

I mean, MDEdit is a little bit in an identity crisis, because what is it? Is it a website? Is it an app? Is it a tool that uses HTML, CSS, and JavaScript? But it wants to do so much more. It wants to read files. It wants to write files. It wants to work offline. So it's more of a web app with super powers.

Speaking of super powers, do we have any classic DC comic fans here? Do we? Well, so maybe we are able to help my little friend. Because what is it? Is it a website? Is it an app? Is it a bird? To put it plain, it is a Super Web Application, or at least that's what they would have been called if I had been given the chance to name those things. Unfortunately, or also luckily for everyone else, Alex Russell was way before me, and he was back then working at Google, and he was thinking a lot about how to bridge the gap between the browser and native applications. And he was thinking about websites that you could grant more and more permissions. They would progressively become apps. So he coined the term progressive web apps. And maybe you have already heard a lot about progressive web apps in terms of mobile applications.

However, the web is unique in the sense that it's not tailored to one specific operating system or screen resolution, but it should work universally. Therefore, I would like to focus on some of the capabilities that also allow desktop web applications to have some superpowers. But let's start with some basics.

The underlying question for web apps running both on desktop and mobile is, what problems do they need to solve to offer a truly comparable user experience? First of all, they should be fast, because we don't want to have a loading spinner if you click on an application or on a file. It should be there immediately. It should be integrated, so it should feel like it's part of the operating system, an extension of the operating system. It should be reliable, even if we have no internet connection or bad internet connection, we should be able to use the app. And it should be engaging, so we should be able to re-engage our users, for example, using push notifications. To solve those problems, browsers had to introduce two new core concepts, the Web App Manifest and the Service Worker.

The Service Worker, sorry, the Web App Manifest is basically just a JavaScript, a JSON file that contains information about the application. We, first we need to register the manifest, it's basically one line of HTML pointing to the file, and then the file itself contains information like the title, short name, description, colors, and that's already it. So my browser, in this case, Edge, knows that we now have an installable PWA, and it offers us to install it. There are more and more capable properties that we will look into in this talk.

2. The Service Worker and Network Independence

Short description:

The Service Worker is a piece of JavaScript that lives in a separate scope and is able to listen to events, interact with the site, and stay active even if the browser is closed. We can register the Service Worker and define its scope. Inside the Service Worker, we have event listeners for Install, Activate, Fetch, and Push events. The Service Worker allows our super web app to remain functional even without an internet connection, as it sits between the website and the internet and can interact with the application storage.

The second big thing is the Service Worker. So first of all, my app is a JavaScript application, so there's a lot of application logic written in JavaScript, which is cool because I really like JavaScript. Then again, as soon as we close the site, as soon as we close the browser, there's just, JavaScript is just dead. There are no things happening inside our app.js anymore, so we can't interact with it anymore.

The Service Worker is now also a piece of JavaScript, but it lives in a separate scope. It's registered between the web app and the browser, and there it is able to listen to events, to interact with the site, even if the browser is closed, so it stays there forever. It's not bound to the lifecycle of our application.

To register the Service Worker, we can call this navigator.serviceworker.register function, points to the Service Worker. It has some optional parameters like the scope, so in our case, our Service Worker controls everything, so our site and all the subfolders as well. We can also create a new Service Worker that controls specific scopes inside our application, so we could have the About Service Worker that only controls everything inside this About folder, for example.

And then, inside the Service Worker, it's just JavaScript. We do have event listeners, so whenever someone visits the page, this Install Event is fired. Then once the installation happened, we have the Activate Event. Then every request goes through the Service Worker with the Fetch Event, and also if someone tries to reach our Service Worker from some server, for example, we do have the Push Event that we can listen to. So far, so good.

But let's get back to our super web app and its superpowers. Let's start with issue number one, Super Web App and the dream of network independence. It's a beautiful day, sun is shining, our super web app tries to request some assets from the server, it makes a request to the server, comes back with the response, everything was fine. But suddenly, the internet connection is gone. Sorry, there we go. Different. The internet connection is gone, and well, Donasaur appears, certain death for all classic web applications. Not so for our super web app, because we do have the Service Worker superpower.

Now the Service Worker sits between the website and the internet, and it can also interact with the application storage. So even if the internet connection is gone, we still have a reliable source to serve our request. How can we use it? So in this case, we have our SVG, we have a fallback SVG image and we want to show the fallback SVG whenever a request to an SVG image fails. First of all, in the install event, we opened the cache, we will then put this fallback SVG into the cache. Then once we have the fetch event, we will first check whether the requested asset is actually an SVG. If that is the case, we do have the event.responseWith, which basically takes over the request. There we can then pass the request to the server.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Domain Driven Design with Vue Applications
Vue.js London 2023Vue.js London 2023
14 min
Domain Driven Design with Vue Applications
Top Content
Welcome to this talk on domain-driven design in Vue.js application. Today we are going to look into domain-driven design, its benefits and how it works with Vue.js domain-driven design versus the MVVM model. Vue.js thrives in domain-driven design, a design approach that models software to match a domain. DDD emphasizes understanding business logic and creating a domain that reflects the language and concepts. Integrating DDD in Vue.js offers benefits such as effective modeling of complex business domains, structured code reflecting domain logic, and easier onboarding and ownership.
How to Share Code between React Web App and React Native Mobile App in Monorepo
React Summit 2022React Summit 2022
7 min
How to Share Code between React Web App and React Native Mobile App in Monorepo
This presentation focuses on sharing code between React web and React native mobile apps. The speaker demonstrates how to achieve feature parity using a Monorepo with NX. They highlight the importance of sharing non-UI code, such as business logic and state management, through shared libraries. This approach allows the apps to focus on UI code while keeping non-UI code separate. For more details, refer to the speaker's blog post.
Data Loaders - Elevating Data Fetching in Vue
Vue.js Live 2024Vue.js Live 2024
30 min
Data Loaders - Elevating Data Fetching in Vue
Data loaders provide a solution for complex and repetitive data fetching in Vue.js applications. Using data loaders allows for more independent data fetching and integrates with the navigation cycle. The data loader plug-in adds a navigation guard for data fetching and loading. Lazy loading and caching can be implemented using Pina Colada and Glada loaders. These loaders can improve the performance and speed of data fetching in applications.
The Next Wave of Web Frameworks is BYOJS
JSNation 2022JSNation 2022
23 min
The Next Wave of Web Frameworks is BYOJS
The next wave of web frameworks is BYOJS, covering the history and evolution of building web applications. The evolution of web frameworks and build systems includes popular choices like React, Angular, and Vue, as well as advanced build systems like Webpack and Rollup. The rise of performance measurement tools and the adoption of the Jamstack have led to improved web performance. The Jamstack architecture focuses on pre-rendering pages, decoupling APIs and services, and enhancing pages with JavaScript. Astro, a static site generator with SSR support, promotes the islands architecture and partial hydration.
MIDI in the Browser... Let's Rock the Web!
JSNation 2022JSNation 2022
28 min
MIDI in the Browser... Let's Rock the Web!
MIDI is a versatile communication protocol that extends beyond music and opens up exciting possibilities. The Web MIDI API allows remote access to synths and sound modules from web browsers, enabling various projects like music education systems and web audio-based instruments. Developers can connect and use MIDI devices easily, and the Web MIDI API provides raw MIDI messages without semantics. The WebMidi.js library simplifies working with the Web MIDI API and offers a user-friendly interface for musicians and web developers. MIDI on the web has generated significant interest, with potential for commercial growth and endless possibilities for web developers.
Using Next.JS and Redux for Epic Noscript Web Apps
React Advanced Conference 2021React Advanced Conference 2021
21 min
Using Next.JS and Redux for Epic Noscript Web Apps
This Talk explores developing web applications that work without JavaScript enabled in the browser, while still enjoying the benefits of modern web technologies. The speaker demonstrates converting an existing application to work without JavaScript by wrapping buttons in a form and preventing the default submit event. React helpers are introduced to handle async actions and the speaker shows how to make a counter app work without JavaScript by removing unnecessary callbacks and changing buttons to a button component. The talk also covers adding a form and a surprise feature, and emphasizes that by leveraging forms and an event-based store, applications can seamlessly work with or without JavaScript.

Workshops on related topic

Web Accessibility in JavaScript Apps
React Summit 2022React Summit 2022
161 min
Web Accessibility in JavaScript Apps
Workshop
Sandrina Pereira
Sandrina Pereira
Often we see JavaScript damaging the accessibility of a website. In this workshop, you’ll learn how to avoid common mistakes and how to use JS in your favor to actually enhance the accessibility of your web apps!
In this workshop we’ll explore multiple real-world examples with accessibility no-nos, and you'll learn how to make them work for people using a mouse or a keyboard. You’ll also learn how screen readers are used, and I'll show you that there's no reason to be afraid of using one!
Join me and let me show you how accessibility doesn't limit your solutions or skills. On the contrary, it will make them more inclusive!
By the end, you will:- Understand WCAG principles and how they're organized- Know common cases where JavaScript is essential to accessibility- Create inclusive links, buttons and toggleble elements- Use live regions for errors and loading states- Integrate accessibility into your team workflow right away- Realize that creating accessible websites isn’t as hard as it sounds ;)
Build a Universal Reactive Data Library with Starbeam
JSNation 2023JSNation 2023
66 min
Build a Universal Reactive Data Library with Starbeam
WorkshopFree
Yehuda Katz
Yehuda Katz
This session will focus on Starbeam's universal building blocks. We'll use Starbeam to build a data library that works in multiple frameworks.We'll write a library that caches and updates data, and supports relationships, sorting and filtering.Rather than fetching data directly, it will work with asynchronously fetched data, including data fetched after initial render. Data fetched and updated through web sockets will also work well.All of these features will be reactive, of course.Imagine you filter your data by its title, and then you update the title of a record to match the filter: any output relying on the filtered data will update to reflect the updated filter.In 90 minutes, you'll build an awesome reactive data library and learn a powerful new tool for building reactive systems. The best part: the library works in any framework, even though you don't think about (or depend on) any framework when you built it.
Table of contents- Storing a Fetched Record in a Cell- Storing multiple records in a reactive Map- Reactive iteration is normal iteration- Reactive filtering is normal filtering- Fetching more records and updating the Map- Reactive sorting is normal sorting (is this getting a bit repetitive?)- Modelling cache invalidation as data- Bonus: reactive relationships
Build Web3 apps with React
React Summit 2022React Summit 2022
51 min
Build Web3 apps with React
WorkshopFree
Shain Dholakiya
Shain Dholakiya
The workshop is designed to help Web2 developers start building for Web3 using the Hyperverse. The Hyperverse is an open marketplace of community-built, audited, easy to discover smart modules. Our goal - to make it easy for React developers to build Web3 apps without writing a single line of smart contract code. Think “npm for smart contracts.”
Learn more about the Hyperverse here.
We will go over all the blockchain/crypto basics you need to know to start building on the Hyperverse, so you do not need to have any previous knowledge about the Web3 space. You just need to have React experience.
Building Modern CMS Driven Web Applications with Strapi the OSS Headless CMS
React Advanced Conference 2021React Advanced Conference 2021
159 min
Building Modern CMS Driven Web Applications with Strapi the OSS Headless CMS
Workshop
Daniel Madalitso Phiri
Daniel Madalitso Phiri
In this workshop, we'll build out a fully functional website and integrated blog with Next.js and Strapi.

Table of contents:
- An introduction to Headless CMS and supported architectures
- Getting up and Running with Strapi and Next.js
- Integrating Blog functionality into a Next.js app
- Deploying your Next.js and Strapi Apps Bonus
- Implementing content previews with Next.js

Prerequisites:Basic React Knowledge Basic knowledge of Node.js and npm Basic Web Concepts.