Welcome to Progressive Web App Series. If you have missed previous blog posts, please read from following links. In this blog post we will understand one of the important component of PWA, which is App Shell, sometimes referred as Application Shell as well.
The App Shell Model in Progressive Web App
One of the key feature of PWA is that it loads faster and that is because of Application Shell. In native application we have all the content and resources are stored locally and we have APIs to fetch data from network. That’s the reason native app works faster than web apps. The App Shell works on something similar concept. It keeps your UI and resources local and pulls in content dynamically through an API.
The application shell is the minimal HTML, CSS and JavaScript required to start the app. This means the application shell is not loaded from the network every time the user visits. Only the necessary content is needed from the network. Here is the graphical representation.

As you can see from above graphical representation, we have a app shell which will act as code repository on local and will hold all key resources of the app that is required to start the app.
To see how Google built an app shell architecture, take a look at Building the Google I/O 2016 PWA.
App shell does not work alone, it works with service worker. We will see how you can set caching of your app shell using Service worker. App shell will cache resources offline and use it on next visit of users. It does not mean that it will not load fresh data from network. It will look for new versions of the app and will load it automatically.
Building Your App Shell
When you are building your application shell you must identify the resources that you will need to cache. You can then use service worker to cache those data and resources and load data dynamically from API. This means keep your HTML simple load all the data dynamically and build UI runtime. This way your application will load much faster. You have to determine the right balance between speed and data freshness for each of your data sources.
An application shell using Service worker is powerful pattern for offline caching but it also offers significant performance wins in the form of instant loading for repeat visits to your PWA. You can cache your application shell so it works offline and populate its content using JavaScript.
You can find more about Application Shell on Google Developers website.
Instant loading web apps with Application Shell Architecture


















