There are a lot of articles about PWA that tell in detail what it is and how to set it up. Yet you may not always understand them from the first time.
My goal is to provide basic information in simple language that will be enough for you to understand what PWA is. Then to show you a real example to strengthen everything that you learned. Thus, take your laptop and follow me.
After reading it you will understand the following:

Advantages and Disadvantages

As with any technology, PWA has its benefits and limitations. Before covering them, let’s understand what PWA is.
PWA technology was announced by Google in 2015. It positions itself as an additional add-on that allows you to make the site look like a mobile app.
At the same time, the interior does not change, does not transform, the site remains the same, only the browser is transformed.
Also, you should know for which type of business the PWA is a better solution than a mobile application. You could find more information about the differences between PWA and mobile app here.
What can PWA do?
  1. Sending notifications, caching content, and setting a shortcut to the desktop;
  2. Sending notifications in the form of a pop-up window where you can notify the user about something;
  3. Working offline, i.e. without an Internet connection, thanks to content caching.

PWA Advantages

  1. PWA is easy to install. You don’t need to go to any app stores, download anything, or dance with a tambourine. Just open the site by clicking on the link, the window “install a shortcut to the desktop” POPs up, install it and you’re done.
  2. It works on all more or less modern devices, you only need a browser.
  3. It allows the site to be more accessible because of the shortcut on the desktop. You unlocked your phone, clicked on the shortcut, and the site opened. That’s cool.
  4. It takes up less memory, less than 1 MB.
  5. Setting up a PWA requires less development time than creating a mobile app. It is unnecessary to write two identical apps on Android and IOS. Therefore, it will be much cheaper for businesses.
  6. Higher security — all resources are transmitted only over the https.
  7. Stable operation. If there are problems with the Internet, the content will be compensated from the cache, so the site will always be available.

PWA Disadvantages

  1. There is a misconception about the fact that PWA helps to improve SEO performance. I don’t agree with that! And the first problem with which you become involved is the SPA, where HTML markup on the rendering page of JavaScript. Until the scripts load (as long as they need) the layout will not appear, and will only be
    <div>
    with the “app” — ID. Here is just at the moment when everything is becoming stupid, SEO analysis occurs, but the page, as you understand, is empty. And even if you add +100500 PWA to the site, they will not speed up the rendering of HTML code. And to be less unsubstantiated, let’s make sure by a real example. Let’s take the site https://madops.io, which is a single page application. If you look at its inside view-source: https://madops.io, you’ll see everything I described above. In other cases when the server renders all the HTML markup at once there are no problems, as, for example, here view-source: https://maddevs.io.
  2. Disability. Features such as camera control, SMS sending, sensor access, and more will not be available for PWA, for security reasons.
  3. There are still some browsers that don’t support PWA. For example, push notifications on IOS.
If you want to read more about what PWA is please check this link. Here are the sites that use PWA.

Basic concept

Before going deeply in PWA set up, let’s figure out its basic concepts and it’s components

Setting up PWA

PWA is really simple in set up. So let’s start right from writing the code!
No, wait.
Here is a link to the ready-made code https://github.com/denisoed/PWA-example. Here you can download the images that will be required further, well, for the one you will get acquainted with what happened.
Firstly you need to create a folder in the project and name it PWA, for example. Then add it to this folder index.html, which will contain the following code:
<!doctype html>
<html lang="en">
  
  <head>
    <meta charset="utf-8">
    <title>PWA</title>
    <meta name="description" content="Progressive 
Web Apps">
  </head>
<body class="fullscreen">
    <div class="container">
      <a href="https://maddevs.io" target="_blank">
        <img src="./images/logo.svg" alt="Mad Devs">
      </a>
      <h1>PWA</h1>
      <p>Progressive Web Apps</p>
    </div>
  </body>
</html>
I’ve already prepared the layout, but it looks bad without styles, so we’ll add them as well. Creating a CSS folder where we add the styles.css file and insert the code below:
body {
  font-family: sans-serif;
}
/* Make content area fill the entire browser window 
*/
html,
.fullscreen {
  display: flex;
  height: 100%;
  margin: 0;
  padding: 0;
  width: 100%;
  background-color: #000;
}
/* Center the content in the browser window */
.container {
  margin: auto;
  text-align: center;
}
.container img {
  width: 50px;
  height: auto;
}
.container h1 {
  color: #fff;
  font-size: 12rem;
  font-weight: bold;
  margin: 30px 0 -20px;
}
.container p {
  color: #fff;
  font-size: 3rem;
  margin: 0;
}
Then connect this file to index.html, in the <head>…</head> tag
<link rel="stylesheet" href="css/styles.css">
Let’s immediately connect the necessary images, which can be downloaded here. Click on the link, there will be a button Clone or download, green such, poke it, then poke Download ZIP. The archive will be downloaded and there will be images in the images folder. Phew, I think I explained it quite clearly:
You open the project, create the images directory there, where you insert all the images. Then open it index.html and insert meta information into the <head>…</head> tag. What it is and why you can read here.
<link rel="icon" href="images/favicon.ico" 
type="image/x-icon" />
<link rel="apple-touch-icon" href="images/mstile-
150x150.png">
<meta name="theme-color" content="black" />
<meta name="apple-mobile-web-app-capable" 
content="yes">
<meta name="apple-mobile-web-app-status-bar-style" 
content="black">
<meta name="apple-mobile-web-app-title" 
content="PWA">
<meta name="msapplication-TileImage" 
content="images/mstile-144x144.png">
<meta name="msapplication-TileColor" 
content="#FFFFFF">
<meta name="viewport" content="width=device-width, 
initial-scale=1.0">
As a result, in the file index.html, there should be a structure like this:
<!doctype html>
<html lang="en">
  
  <head>
    <meta charset="utf-8">
    <title>PWA</title>
    <meta name="description" content="Progressive 
Web Apps">
    <link rel="icon" href="images/favicon.ico" 
type="image/x-icon" />
    <link rel="apple-touch-icon" 
href="images/mstile-150x150.png">
    <meta name="theme-color" content="black" />
    <meta name="apple-mobile-web-app-capable" 
content="yes">
    <meta name="apple-mobile-web-app-status-bar-
style" content="black">
    <meta name="apple-mobile-web-app-title" 
content="PWA">
    <meta name="msapplication-TileImage" 
content="images/mstile-144x144.png">
    <meta name="msapplication-TileColor" 
content="#000">
    <meta name="viewport" content="width=device-
width, initial-scale=1.0">
    <link rel="stylesheet" href="css/styles.css">
  </head>
<body class="fullscreen">
    <div class="container">
      <a href="https://maddevs.io" target="_blank">
        <img src="./images/logo.svg" alt="Mad 
Devs">
      </a>
      <h1>PWA</h1>
      <p>Progressive Web Apps</p>
    </div>
  </body>
</html>
Now it remains to run and see what happened. I have found a very convenient extension Web Server for Chrome that runs a local server, you need to install it, we will need it next. There is nothing difficult, just specify the folder with the project where it is index.html he’ll do it himself. Copy the link and paste it into the browser.
And here’s what we got. I would not say that this is fine, but how normal for me!
Well, listen, the most difficult thing, consider it done, let’s now see what google validation thinks about our work. To do this, press f12 and go to the Lighthouse tab (before Google updated, this tab named Audits), there will be a blue Generate report button, poke.
After the validation process is completed, we will see the following picture: the item responsible for PWA will be gray. This means that we do not have any settings.
And if you scroll down, you can see the recommendations that you need to follow in order for PWA to work like clockwork.
The Lighthouse tab will help you track all errors when configuring PWA.

Well, we finally got to the most interesting part.

First, you need to create a manifest.json file in the root of the project. We add the following metadata to it: