How to Build a Progressive Web App

How to Build a Progressive Web App

Web applications have come a mighty long way since the primitive stages of the internet.

In the 90s, web applications were extremely basic and took countless hours and money to build.

Amateur developers had to be geniuses in creating old-age web applications.

At the turn of the 21st century, online forums and hyper-available tools and resources on the internet helped close the learning gap for both new and experienced software developers. ‘

Now, there appears to be another paradigm shift in the business.

Alibaba Progressive Web App

Progressive web apps are growing in popularity and use with each passing year. In no time, billions of progressive web apps will exist and force even the most experienced web developers to adapt accordingly.

If you’ve heard of progressive web apps but don’t know what they are, why they’re important, and how to build one, then you’ve come to the right place. This ultimate guide will show you how to build a progressive web app from scratch.

Let’s get started!

What is a Progressive Web App?

The history of progressive web apps is quite diverse and has been around for years now. Progressive web apps were first introduced by Google back in 2015. Since then, they have attracted a lot of attention because they’re very easy to develop and provide numerous benefits to both developers and publishers.

The definition of a progressive web app can be confusing if you’re looking for exact terminology. To put it simply, a progressive web app utilizes the most cutting-edge and advanced technologies to combine the both the experience of a website and mobile app.

You can simply think of a progressive web app as a creative hybrid of a fully-functional website and dynamic mobile app. At first, mobile apps couldn’t operate on a web browser for obvious reasons.

Recent developments in cache service workers and Push APIs, as well as browser advancements have made it possible for web developers to allow their users to install apps on their home screen, work offline, and receive push notifications.

As its name suggests, progressive web apps are forward and trend-oriented. They utilize much of a larger online ecosystem, internet community and plugins, and the simplicity of publishing a website compared to apps in a marketplace.

If you’re a versatile developer, with experience in developing apps and websites, you’ll benefit from building a progressive web app within no time. You’ll also appreciate the fact that the API of your app does not need to be configured with backwards compatibility.

This means that all website users can operate the same version of your website, unlike other native applications. Lastly, your app will be much easier to deploy when the time is right and maintain, saving you a lot of time, money, and stress.

Why Switch to Progressive Web Apps?

an application loses approximately 20% of its users

A recent study has shown that an application loses approximately 20% of its users during every transition from a user’s first arrival to them finally becoming familiar with the app.

This is a very concerning fact for both developers and publishers. In short, a person must find your app in the app store. For both Android and iOS, this step can take a lot of time, especially if your app is in a popular niche and has a common name.

Next, they’ll need to download your app, install it properly, and learn how to use it. On the contrary, when a person uses a progressive web app, they can immediately access it and begin using it.

There isn’t any installation or downloading required. What’s more is when the user returns to the progressive web app, they can then install the app and take advantage of a full-screen viewing experience.

This isn’t to say that a native app is all that bad. Mobile applications that utilize push notifications retain three times more users than their competitors. It’s also true that a person is more willing to reopen a mobile app than a website.

You can click on a mobile app to open it, rather than typing in a website address. Furthermore, a fully-functional mobile application is much faster because it consumes far less data.

A progressive web app is the best of both worlds as far as both mobile apps and websites. This will result in enhanced performance and user retention, sans the challenge in maintaining a mobile app.

When Should You Build a Progressive Web App?

Flipkart Lite

You typically will build a native mobile application when you expect your audience to continually return. However, a progressive web app can still serve the same purpose. The eCommerce giant, Flipkart, utilizes a progressive web app for its marketplace platform, Flipkart Lite.

To determine whether or not you need a progressive web app, a native mobile app or a website, you’ll need to first decide who your target audience is and what they intend to do on your platform.

A “progressive” web app is designed to be compatible for all browsers. Users can enjoy an improved experience when their browser is updated with new APIs and features. As a result, there is no sacrificing the standard user experience when building a progressive web app compared to a website.

Though, you will have to determine if you want your application to support offline functionality and how you’ll facilitate seamless navigation. Remember — in a platform’s standalone mode, users won’t be able to use a back button.

The good news is that if your website already operates like a mobile app, transforming it more to a progressive web app will improve its user experience dramatically. Now, there is a notable exception.

If certain essential features on your platform are restricted due to issues in cross-browser support, then you’re better off building a native mobile application that will provide the same user experience for all.

What are the Characteristics of a Progressive Web App?

Before you learn how to develop a progressive web app, it’s best for you understand their following characteristics:

  • Progressive — A progressive web app must operate on any device and browser, improving its user experience. It must also leverage all of its available features.
  • Accessible — A progressive web app is, by definition, a website. Therefore, it must be discovered on all search engines. This provides a major advantage over native mobile applications, which don’t have as much online visibility as websites.
  • Linkable — Progressive web apps also have a URL that will help it retain its current state when others want to share it or bookmark it in their browser.
  • Responsive — A progressive web app must be compatible with the screen size of mobile devices, such as smartphones and tablets.
  • App-Like — A progressive web app must look and feel like a native mobile application, utilizing few page refreshes unlike a website.
  • Internet Independent — These apps should work anywhere, regardless of available internet connectivity.
  • Re-engagable — Again, mobile apps retain more users than websites. Progressive web apps must achieve the same result, typically through push notifications.
  • Downloadable — These apps can be downloaded and installed on a device’s home page, making it readily accessible any time.
  • Secure — Progressive web apps must be managed over a HTTPS connection since its intimate user experience can be compromised by savvy hackers.

How to Build a Progressive Web App: 8 Simple Steps

Are you ready to start building your progressive web app? Here are eight, straightforward steps to make sure that your project goes by without a hitch.

Step #1: Use a HTTPS Server

In all honesty, your website should have a HTTPS prefix anyway. The “S” in HTTP simply indicated an extra layer of online protection known as an SSL certificate. This helps users feel more secure on your website, especially if it processes sensitive data like credit card information.

When building a profressive web app, using a HTTPS server is essential for leveraging service workers, allowing users to install the platform on their home screen. If you don’t have an SSL certificate, you should contact your domain registrar to purchase one for a low cost.

Step #2: Develop an Application Shell

The shell of your application will be the first thing that loads and your user sees. As such, your application shell should be present in your index HTML document. It must also appear with inline CSS to make sure that the shell appears instantaneously and reduce page load time.

This is one of the most important steps that can impact user experience down the road of development. Your app should provide the user with immediate content and improve it as soon as more data (JavaScript) is available.

Below, you’ll see an example was derived from a sample application using React.js. As you can see, the shell of the app is shown in the index.html. Once React and JavaScript has been completely rendered:

Application Shell

Step #3: Add a Service Worker

To fully realize the advantages of a progressive web app, such as install and caching prompts and push notifications, you’ll need to register a service worker. The good news is that adding a service worker is pretty simple.

You’ll first need to see if your browser even supports service workers. If your browser does support service workers, you can register the file. It’s important to add that nothing special needs to be inside of the file.

Below is an example of what all of this will look like. The service worker is installed when a person visits your platform. It’s then activated before registration. Finally, when the application makes a network request for additional data, it’s fetched.

Fetching is extremely important to maintain network independence.

Step #4: Install Push Notifications

Again, server workers are critical in allowing push notifications. This is done through a web-based Push API. To make this feature possible, you’ll need to access the push manager file in the service worker.

The success of your push notifications in your server workers will rely on extensive backend configuration, so that won’t be discussed in this guide. However, if you’re creating an app from scratch, Google Firebase offers simple-to-use push notifications.

If you can keep your design files secure in an online storage repository, you’ll be all set to move forward.

Step #5: Install a Web App Manifest

Next, you’ll need to make your progressive web app installable. This means including a manifest.json file in the root directory of your application. This is simply a description of your application, including a description, name, and splash screen.

This information is similar to what you’ll find in any app store. You’re just configuring your web app to operate the same.

Step #6: Setup the Installation Prompt

When a person lands on your progressive web app, they’ll be automatically prompted by Google Chrome to automatically install the platform to their home screen. This is provided that the person visits the app twice for a defined period of time.

It’s important to make sure a user shows interest in your app first, unlike native apps that require users to download them first.

Step #7: Analyze Your App’s Performance

Once your progressive web app is finished, you’ll need to perform an extensive testing run to ensure that it’s performing optimally. The most important metrics to measure here is user retention and page load time.

Both of these factors will undeniably influence the success of your application and require you to go back to the drawing board if necessary.

Step #8: Perform an Audit

Google has been a major proponent of progressive web apps since their inception. As such, it has introduced Lighthouse, a diagnostic tool that measures your app’s performance on a scale of 1 to 100.

Much like an SEO or UX/UI audit, this tool can give you a data-driven estimation of how well your progressive web app is faring online.

Need Help in Building a Progressive Web App?

As you can see, there is a lot of work and time in building a progressive web app. If you need help in creating one for your business, we can help. Contact us today to learn more about how we can help.

Ryan is the VP of Operations for DEV.co. He brings over a decade of experience in managing custom website and software development projects for clients small and large, managing internal and external teams on meeting and exceeding client expectations--delivering projects on-time and within budget requirements. Ryan is based in El Paso, Texas.
Connect with Ryan on Linkedin.
Ryan Nead