SlideShare una empresa de Scribd logo
1 de 50
Descargar para leer sin conexión
Anatomy of a
Progressive Web App
January 20, 2017
Michael North
Agent Conf
2007
A lot has changed since 2012
Benefits of Each
Approach
WebNative
• Presence on home screen
• Background functionality
• Fast return startup
• Doesn’t require install
• Cross-Platform
• Very similar to desktop web experience
Vs
Progressive Web Apps
Hello!
Formerly Now
• CTO
• UI Architect @
• Lead Engineer @ Imagequix
• Training Partner @
• Staff Engineer @
• Instructor @
Major Pieces
Pruning the Critical Path
Tolerating Network Instability
App-Like Characteristics
Important Metrics
Pruning the Critical Path
🎨First Paint
👆Interactive
Time to…
📊Data
index.html
app.css
app.js
data.json
API
🖥User
Asset Storage
1
2
4
5
6
Static Hosting
3
☁CDN
🎨
First Paint
👆
Interactive
parse
📊
Data
🎨
boot
👆 📊
Client
Rendered
SPA
Server-Side Rendering
• ⏱ Don’t have to wait for client-side JS
• 🔗 Better for SEO & sharing links
• ⚠ Node.js and the Browser are different
• 👷 Try not to do the same work twice
• ⚡ HTML is assembled in your data center
index.html
app.css
app.js
data.json
API
🖥User
Asset Storage
1
2
6
7
8
Rendering
Server
5
☁CDN
🎨
First Paint
👆
Interactive
parse
📊
Data
🎨
boot
👆📊
Server
Rendered
SPA
3
4
Resource Caching Strategies
• Content at a URL is never
changed
• max-age=year
• index.html is the key
• Offline-friendly
• Content at a URL can change
• Cache-Control: no-cache
• Use Last-Modified or ETag
• Involves extra network
requests
Immutable Content “Check w/ server”
Service Workers
• A programmable network proxy
• A JavaScript worker
• Only works over HTTPS
• Has a predictable lifecycle
XHR SW WWW
Cache
Service Workers
Installing
Activated Error
Idle
FetchTerminated
Service Workers
I need item.pngApp
Of course! Here it is.
I have a list of important
resources. I’ll fetch them
all and cache them.
Cache
Precache
🖼
Service Workers
App
Just got it for you!
Ok, I’ll get it
Cache
Network or Cache
🖼
I need item.png
Service Workers
Took too long. Here’s a
cached version🖼
App
Ok, I’ll get it
Cache
Network or Cache
I need item.png
Service Workers
App
Ok, I’ll get it
Cache
Network or Cache
I need item.png
Something went wrong.
Here’s a cached version🖼
Service Workers
App
I’ll go download a new
copy in case it changed
Here’s a cached version
Cache
Cache and Update
🖼
I need item.png
Next time you ask, you’ll
get this new version
Service Workers
App
I’ll go download a new
copy in case it changed
Here’s a cached version
Cache
Cache, Update and Refresh
🖼
I need item.png
Hey! I’ve got a new
version. Ask me for itpostMessage
🎆
Service Workers
index.html
app.css
app.js
data.json
API
🖥User
Asset Storage
1
2
6
7
8
Rendering
Server
5
☁CDN
🎨
First Paint
👆
Interactive
parse
📊
Data
🎨
boot
👆📊
Server
Rendered
SPA
3
4
index.html
.css
.js data.json
API
🖥User
Asset Storage
1
2
6
7
8
Rendering
Server
5
☁CDN
🎨
First Paint
👆
Interactive
parse
📊
Data
🎨
boot
👆📊
Server
Rendered
PWA v1
3
4
Service
Worker
⚙
Storing Dynamic Content
• Cookies - Not worker-friendly, just a string
• LocalStorage - See 👆
• What’s left???
Storing Dynamic Content
• Cookies - Not worker-friendly, just a string
• LocalStorage - See 👆
IndexedDB
IndexedDB
• 🔢 Versioned
• 🗃 Indexable
• ⚙ Worker-Friendly
• 📅 Durable
• 🔣 Supports values of many types
• ⚠ Not a SQL, or a relational DB
IndexedDB
!// Open (or create) the database
let open =
indexedDB.open('MyDatabase', 1);
!// Create and/or Migrate the Schema
open.onupgradeneeded = (evt) !=> {
!// Transactions
open.onsuccess = () !=> {
!!... };
!!... };
IndexedDB
!// Create and/or Migrate the Schema
open.onupgradeneeded = (evt) !=> {
};
let db = open.result;
let store = null;
switch (evt.oldVersion) {
case 0: !// Upgrade from 0
!// !!...
case 1: !// Upgrade from 1
!// !!...
}
IndexedDB
!// Open (or create) the database
let open =
indexedDB.open('MyDatabase', 1);
!// Create and/or Migrate the Schema
open.onupgradeneeded = (evt) !=> {
!// Transactions
open.onsuccess = () !=> {
!!... };
!!... };
IndexedDB
App Shell Architecture
Shell loads instantly Dynamic content in the shell
index.html
.css
.js data.json
API
🖥User
Asset Storage
1
2
6
7
8
Rendering
Server
5
☁CDN
🎨
First Paint
👆
Interactive
parse
📊
Data
🎨
boot
👆📊
Server
Rendered
PWA v1
3
4
Service
Worker
⚙
index.html
.css
.js data.json
API
🖥User
Asset Storage
1
2
6
7
8
Rendering
Server
5
☁CDN
🎨
First Paint
👆
Interactive
parse
📊
Data
🎨
boot
👆📊
Server
Rendered
PWA v2
3
4
Service
Worker
⚙
99
shell html
First Visit
💾
IndexedDB
99
Records
LocalRem
ote
shell.html
.css
.js
IndexedDB
API
🖥User
Asset Storage
4
7
8
Rendering
Server
3
☁CDN
🎨
First Paint
👆
Interactive
parse
📊
Data
🎨
boot
👆 📊
Server
Rendered
PWA v2
Service
Worker
⚙
Return Visit
2
1
💾
IndexedDB
5
6
data.json
Major Pieces
Pruning the Critical Path
Tolerating Network Instability
App-Like Characteristics
✅
✅
App-Like Characteristics
App-Like Characteristics
<meta name="apple-mobile-web-app-capable" content="yes">
Get rid of browser UI
App Icons
<link sizes=“180x180" rel=“apple-touch-icon" href="icon.png">
<meta name="mobile-web-app-title" content="Mike.Works">
Bookmark Name
<link href="splash.png" rel="apple-touch-startup-image">
Splash Screen
App-Like Characteristics
{
"name": "Mike.Works - World Class Developer Training",
"short_name": "Mike.Works",
"start_url": ".",
"display": "standalone",
"background_color": "#fff",
"theme_color": "#fff",
"description": "World Class Developer Training",
"orientation": "portrait-primary",
"lang": "en-US",
"icons": [ ]
};
manifest.json
App-Like Characteristics
In The Future…
• 💬 Push Notifications
• 🔁 Background Sync
• ⚛ First-Class Framework Support
• 📦 IndexedDB 2.0
• ⚡ HTTP/2 Optimizations
This is getting very
complicated…
Reduce the # of
decisions you must make
🤔
You will be building
these things…
Get Trained.
Get Trained.
https://mike.works

Más contenido relacionado

La actualidad más candente

Introduction to Progressive web app (PWA)
Introduction to Progressive web app (PWA)Introduction to Progressive web app (PWA)
Introduction to Progressive web app (PWA)
Zhentian Wan
 

La actualidad más candente (20)

Introduction to Progressive Web App
Introduction to Progressive Web AppIntroduction to Progressive Web App
Introduction to Progressive Web App
 
Progressive Web-App (PWA)
Progressive Web-App (PWA)Progressive Web-App (PWA)
Progressive Web-App (PWA)
 
Progressive Web App (feat. React, Django)
Progressive Web App (feat. React, Django)Progressive Web App (feat. React, Django)
Progressive Web App (feat. React, Django)
 
The web - What it has, what it lacks and where it must go - keynote at Riga D...
The web - What it has, what it lacks and where it must go - keynote at Riga D...The web - What it has, what it lacks and where it must go - keynote at Riga D...
The web - What it has, what it lacks and where it must go - keynote at Riga D...
 
Progressive web apps
Progressive web appsProgressive web apps
Progressive web apps
 
Progressive Web App
Progressive Web AppProgressive Web App
Progressive Web App
 
Progressive web apps with Angular 2
Progressive web apps with Angular 2Progressive web apps with Angular 2
Progressive web apps with Angular 2
 
Building a Progressive Web App
Building a  Progressive Web AppBuilding a  Progressive Web App
Building a Progressive Web App
 
My learnings on web performance optimization while building a Progressive Web...
My learnings on web performance optimization while building a Progressive Web...My learnings on web performance optimization while building a Progressive Web...
My learnings on web performance optimization while building a Progressive Web...
 
Introduction to Progressive web app (PWA)
Introduction to Progressive web app (PWA)Introduction to Progressive web app (PWA)
Introduction to Progressive web app (PWA)
 
Progressive Web Apps and React
Progressive Web Apps and ReactProgressive Web Apps and React
Progressive Web Apps and React
 
Progressive Web Apps / GDG DevFest - Season 2016
Progressive Web Apps / GDG DevFest - Season 2016Progressive Web Apps / GDG DevFest - Season 2016
Progressive Web Apps / GDG DevFest - Season 2016
 
Introduction to Progressive Web Apps, Google Developer Summit, Seoul - South ...
Introduction to Progressive Web Apps, Google Developer Summit, Seoul - South ...Introduction to Progressive Web Apps, Google Developer Summit, Seoul - South ...
Introduction to Progressive Web Apps, Google Developer Summit, Seoul - South ...
 
PWA - Progressive Web App
PWA - Progressive Web AppPWA - Progressive Web App
PWA - Progressive Web App
 
Introduction to Progressive Web Apps (PWA)
Introduction to Progressive Web Apps (PWA)Introduction to Progressive Web Apps (PWA)
Introduction to Progressive Web Apps (PWA)
 
Progressive Web App
Progressive Web AppProgressive Web App
Progressive Web App
 
Next Generation Mobile Web - PWA (Progressive Web App)
Next Generation Mobile Web  - PWA (Progressive Web App)Next Generation Mobile Web  - PWA (Progressive Web App)
Next Generation Mobile Web - PWA (Progressive Web App)
 
Progressive Web Apps(PWA)
Progressive Web Apps(PWA)Progressive Web Apps(PWA)
Progressive Web Apps(PWA)
 
Rise and Fall of the Frontend Developer
Rise and Fall of the Frontend DeveloperRise and Fall of the Frontend Developer
Rise and Fall of the Frontend Developer
 
Progressive Web Applications - The Next Gen Web Technologies
Progressive Web Applications - The Next Gen Web TechnologiesProgressive Web Applications - The Next Gen Web Technologies
Progressive Web Applications - The Next Gen Web Technologies
 

Destacado

Enemy of the state
Enemy of the stateEnemy of the state
Enemy of the state
Mike North
 

Destacado (18)

PWA 101
PWA 101PWA 101
PWA 101
 
PWA e Hybrid App VS Native
PWA e Hybrid App VS NativePWA e Hybrid App VS Native
PWA e Hybrid App VS Native
 
Progressive Web Apps [pt_BR]
Progressive Web Apps [pt_BR]Progressive Web Apps [pt_BR]
Progressive Web Apps [pt_BR]
 
Javascript ES6 generators
Javascript ES6 generatorsJavascript ES6 generators
Javascript ES6 generators
 
Progressive Web Apps
Progressive Web AppsProgressive Web Apps
Progressive Web Apps
 
Getting Started with Progressive Web Apps
Getting Started with Progressive Web AppsGetting Started with Progressive Web Apps
Getting Started with Progressive Web Apps
 
Progressive web apps
Progressive web apps Progressive web apps
Progressive web apps
 
Phoenix for Rubyists - Rubyconf Brazil 2016
Phoenix for Rubyists - Rubyconf Brazil 2016Phoenix for Rubyists - Rubyconf Brazil 2016
Phoenix for Rubyists - Rubyconf Brazil 2016
 
The Road to Native Web Components
The Road to Native Web ComponentsThe Road to Native Web Components
The Road to Native Web Components
 
Web and Native: Bridging the Gap
Web and Native: Bridging the GapWeb and Native: Bridging the Gap
Web and Native: Bridging the Gap
 
Async JavaScript in ES7
Async JavaScript in ES7Async JavaScript in ES7
Async JavaScript in ES7
 
Enemy of the state
Enemy of the stateEnemy of the state
Enemy of the state
 
You Are Born To Blossom by Dr. APJ Abdul Kalam Book Review
You Are Born To Blossom by Dr. APJ Abdul Kalam Book ReviewYou Are Born To Blossom by Dr. APJ Abdul Kalam Book Review
You Are Born To Blossom by Dr. APJ Abdul Kalam Book Review
 
ADBMS (MySql) tiny project
ADBMS (MySql) tiny projectADBMS (MySql) tiny project
ADBMS (MySql) tiny project
 
Online notice board
Online notice boardOnline notice board
Online notice board
 
San Diego Daily Transcript - PR Newswire Event July 2009
San Diego Daily Transcript - PR Newswire Event July 2009San Diego Daily Transcript - PR Newswire Event July 2009
San Diego Daily Transcript - PR Newswire Event July 2009
 
“How can we face Facebook?”
“How can we face Facebook?”“How can we face Facebook?”
“How can we face Facebook?”
 
Man in The Middle Attack
Man in The Middle AttackMan in The Middle Attack
Man in The Middle Attack
 

Similar a Anatomy of a Progressive Web App

Usability in the GeoWeb
Usability in the GeoWebUsability in the GeoWeb
Usability in the GeoWeb
Dave Bouwman
 
SharePoint 2014: Where to save my data, for devs!
SharePoint 2014: Where to save my data, for devs!SharePoint 2014: Where to save my data, for devs!
SharePoint 2014: Where to save my data, for devs!
Ben Steinhauser
 

Similar a Anatomy of a Progressive Web App (20)

ASP .Net Core SPA Templates
ASP .Net Core SPA TemplatesASP .Net Core SPA Templates
ASP .Net Core SPA Templates
 
Convert your Full Trust Solutions to the SharePoint Framework (SPFx)
Convert your Full Trust Solutions to the SharePoint Framework (SPFx)Convert your Full Trust Solutions to the SharePoint Framework (SPFx)
Convert your Full Trust Solutions to the SharePoint Framework (SPFx)
 
Untangling - fall2017 - week 9
Untangling - fall2017 - week 9Untangling - fall2017 - week 9
Untangling - fall2017 - week 9
 
Sam segal resume
Sam segal resumeSam segal resume
Sam segal resume
 
SamSegalResume
SamSegalResumeSamSegalResume
SamSegalResume
 
Deep dive into share point framework webparts
Deep dive into share point framework webpartsDeep dive into share point framework webparts
Deep dive into share point framework webparts
 
Best Practices for Building WordPress Applications
Best Practices for Building WordPress ApplicationsBest Practices for Building WordPress Applications
Best Practices for Building WordPress Applications
 
Usability in the GeoWeb
Usability in the GeoWebUsability in the GeoWeb
Usability in the GeoWeb
 
New life inside monolithic application
New life inside monolithic applicationNew life inside monolithic application
New life inside monolithic application
 
Building production websites with Node.js on the Microsoft stack
Building production websites with Node.js on the Microsoft stackBuilding production websites with Node.js on the Microsoft stack
Building production websites with Node.js on the Microsoft stack
 
A night at the spa
A night at the spaA night at the spa
A night at the spa
 
wt mod3.pdf
wt mod3.pdfwt mod3.pdf
wt mod3.pdf
 
Quick start with AngularJS
Quick start with AngularJSQuick start with AngularJS
Quick start with AngularJS
 
React Native
React NativeReact Native
React Native
 
Advanced Site Studio Class, June 18, 2012
Advanced Site Studio Class, June 18, 2012Advanced Site Studio Class, June 18, 2012
Advanced Site Studio Class, June 18, 2012
 
Performance and Scalability Art of Isomorphic React Applications
Performance and Scalability Art of Isomorphic React ApplicationsPerformance and Scalability Art of Isomorphic React Applications
Performance and Scalability Art of Isomorphic React Applications
 
KATHY ZHANG_3
KATHY ZHANG_3KATHY ZHANG_3
KATHY ZHANG_3
 
Advanced Web Technology.pptx
Advanced Web Technology.pptxAdvanced Web Technology.pptx
Advanced Web Technology.pptx
 
SharePoint 2014: Where to save my data, for devs!
SharePoint 2014: Where to save my data, for devs!SharePoint 2014: Where to save my data, for devs!
SharePoint 2014: Where to save my data, for devs!
 
Lessons Learned from Using Next.js in Production
Lessons Learned from Using Next.js in ProductionLessons Learned from Using Next.js in Production
Lessons Learned from Using Next.js in Production
 

Más de Mike North

Más de Mike North (14)

Web Security: A Primer for Developers
Web Security: A Primer for DevelopersWeb Security: A Primer for Developers
Web Security: A Primer for Developers
 
A Debugging Adventure: Journey through Ember.js Glue
A Debugging Adventure: Journey through Ember.js GlueA Debugging Adventure: Journey through Ember.js Glue
A Debugging Adventure: Journey through Ember.js Glue
 
Phoenix for Rubyists
Phoenix for RubyistsPhoenix for Rubyists
Phoenix for Rubyists
 
Write Once, Run Everywhere - Ember.js Munich
Write Once, Run Everywhere - Ember.js MunichWrite Once, Run Everywhere - Ember.js Munich
Write Once, Run Everywhere - Ember.js Munich
 
Delightful UX for Distributed Systems
Delightful UX for Distributed SystemsDelightful UX for Distributed Systems
Delightful UX for Distributed Systems
 
Modern, Scalable, Ambitious apps with Ember.js
Modern, Scalable, Ambitious apps with Ember.jsModern, Scalable, Ambitious apps with Ember.js
Modern, Scalable, Ambitious apps with Ember.js
 
Ember addons, served three ways
Ember addons, served three waysEmber addons, served three ways
Ember addons, served three ways
 
CI/CD and Asset Serving for Single Page Apps
CI/CD and Asset Serving for Single Page AppsCI/CD and Asset Serving for Single Page Apps
CI/CD and Asset Serving for Single Page Apps
 
User percieved performance
User percieved performanceUser percieved performance
User percieved performance
 
User-percieved performance
User-percieved performanceUser-percieved performance
User-percieved performance
 
Write Once, Run Everywhere
Write Once, Run EverywhereWrite Once, Run Everywhere
Write Once, Run Everywhere
 
Compose all the things (Wicked Good Ember 2015)
Compose all the things (Wicked Good Ember 2015)Compose all the things (Wicked Good Ember 2015)
Compose all the things (Wicked Good Ember 2015)
 
Test like a pro with Ember.js
Test like a pro with Ember.jsTest like a pro with Ember.js
Test like a pro with Ember.js
 
Modern Web UI - Web components
Modern Web UI - Web componentsModern Web UI - Web components
Modern Web UI - Web components
 

Último

Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
FIDO Alliance
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
UXDXConf
 

Último (20)

WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
 
TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
 
Introduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptxIntroduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptx
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptx
 
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
 
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The InsideCollecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
 
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
 
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджера
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
 
Using IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandUsing IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & Ireland
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentation
 

Anatomy of a Progressive Web App