<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <id>https://web.dev/</id>
  <title>Matt Giuca on web.dev</title>
  <updated>2026-04-15T23:21:06Z</updated>
  <author>
    <name>Matt Giuca</name>
  </author>
  <link href="https://web.dev/authors/mgiuca/feed.xml" rel="self"/>
  <link href="https://web.dev/"/>
  <icon>https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/9gFKixjZHcpFPVcOX9Av.jpg?auto=format</icon>
  <logo>https://web.dev/images/shared/rss-banner.png</logo>
  <subtitle>Our latest news, updates, and stories by Matt Giuca.</subtitle>
  
  
  <entry>
    <title>Building multiple Progressive Web Apps on the same domain</title>
    <link href="https://web.dev/building-multiple-pwas-on-the-same-domain/"/>
    <updated>2021-06-02T00:00:00Z</updated>
    <id>https://web.dev/building-multiple-pwas-on-the-same-domain/</id>
    <content type="html" mode="escaped">&lt;p&gt;In the &lt;a href=&quot;https://web.dev/multi-origin-pwas/&quot;&gt;Progressive Web Apps in multi-origin sites blog
post&lt;/a&gt;, Demian discussed the challenges that
sites built on multiple origins face when trying to build a single Progressive
Web App that encompasses all of them.&lt;/p&gt;
&lt;p&gt;An example of this type of site architecture is a ecommerce site where:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The home page is at &lt;code&gt;https://www.example.com&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The category pages are hosted at &lt;code&gt;https://category.example.com&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The product detail pages at &lt;code&gt;https://product.example.com&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As discussed in the article, the &lt;a href=&quot;https://developer.mozilla.org/docs/Web/Security/Same-origin_policy&quot; rel=&quot;noopener&quot;&gt;same-origin
policy&lt;/a&gt;
imposes several restrictions, preventing the sharing of service workers, caches,
and permissions across origins. For that reason, we strongly recommend
avoiding this type of configuration and for those that already have sites
built in this way, to consider migrating to a single origin site architecture
whenever possible.&lt;/p&gt;
&lt;figure&gt;
  &lt;img alt=&quot;Diagram showing a site divded into multiple origins and showing that technique is discouraged when building PWAs.&quot; decoding=&quot;async&quot; height=&quot;461&quot; loading=&quot;lazy&quot; sizes=&quot;(min-width: 800px) 800px, calc(100vw - 48px)&quot; src=&quot;https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/QnwgUcEBv8o8k2XiAYbm.png?auto=format&quot; srcset=&quot;https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/QnwgUcEBv8o8k2XiAYbm.png?auto=format&amp;w=200 200w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/QnwgUcEBv8o8k2XiAYbm.png?auto=format&amp;w=228 228w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/QnwgUcEBv8o8k2XiAYbm.png?auto=format&amp;w=260 260w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/QnwgUcEBv8o8k2XiAYbm.png?auto=format&amp;w=296 296w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/QnwgUcEBv8o8k2XiAYbm.png?auto=format&amp;w=338 338w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/QnwgUcEBv8o8k2XiAYbm.png?auto=format&amp;w=385 385w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/QnwgUcEBv8o8k2XiAYbm.png?auto=format&amp;w=439 439w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/QnwgUcEBv8o8k2XiAYbm.png?auto=format&amp;w=500 500w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/QnwgUcEBv8o8k2XiAYbm.png?auto=format&amp;w=571 571w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/QnwgUcEBv8o8k2XiAYbm.png?auto=format&amp;w=650 650w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/QnwgUcEBv8o8k2XiAYbm.png?auto=format&amp;w=741 741w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/QnwgUcEBv8o8k2XiAYbm.png?auto=format&amp;w=845 845w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/QnwgUcEBv8o8k2XiAYbm.png?auto=format&amp;w=964 964w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/QnwgUcEBv8o8k2XiAYbm.png?auto=format&amp;w=1098 1098w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/QnwgUcEBv8o8k2XiAYbm.png?auto=format&amp;w=1252 1252w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/QnwgUcEBv8o8k2XiAYbm.png?auto=format&amp;w=1428 1428w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/QnwgUcEBv8o8k2XiAYbm.png?auto=format&amp;w=1600 1600w&quot; width=&quot;800&quot; /&gt;
  &lt;figcaption&gt;Avoid using different origins for site sections of the same site when trying to build a unified Progresive Web App.&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;In this post, we take a look at the opposite case: instead of a single PWA
across different origins we&#39;ll analyze the case of companies that want to
provide &lt;strong&gt;multiple PWAs&lt;/strong&gt;, taking advantage of the same &lt;strong&gt;domain name&lt;/strong&gt;, and make
the user aware that those PWAs belong to the same organization or service.&lt;/p&gt;
&lt;p&gt;As you might have noticed, we are using different, but interrelated terms, like
domains and origins. Before moving forward, let&#39;s review these concepts.&lt;/p&gt;
&lt;h2 id=&quot;technical-terms&quot;&gt;Technical terms &lt;a class=&quot;headline-link&quot; href=&quot;https://web.dev/building-multiple-pwas-on-the-same-domain/#technical-terms&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Domain:&lt;/strong&gt; Any sequence of labels as defined in the Domain Name System (DNS).
For example: &lt;code&gt;com&lt;/code&gt; and &lt;code&gt;example.com&lt;/code&gt; are domains.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Hostname:&lt;/strong&gt; A DNS entry that resolves to at least one IP address. For
example: &lt;code&gt;www.example.com&lt;/code&gt; would be a hostname, &lt;code&gt;example.com&lt;/code&gt; could be a
hostname if it had an IP address, and &lt;code&gt;com&lt;/code&gt; would never resolve to an IP
address and so it could never be a hostname.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Origin:&lt;/strong&gt; A combination of a scheme, hostname and (optionally) port. For
example, &lt;code&gt;https://www.example.com:443&lt;/code&gt; is an origin.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As its name implies, &lt;a href=&quot;https://developer.mozilla.org/docs/Web/Security/Same-origin_policy&quot; rel=&quot;noopener&quot;&gt;same-origin
policy&lt;/a&gt;
imposes restrictions on origins, so we&#39;ll mostly refer to the term throughout
the article. Nevertheless, we&#39;ll use &amp;quot;domains&amp;quot; or &amp;quot;subdomains&amp;quot; from time to
time, to describe the technique being used, in order to create the different
&amp;quot;origins&amp;quot;.&lt;/p&gt;
&lt;h2 id=&quot;the-case-for-multiple,-related-pwas&quot;&gt;The case for multiple, related PWAs &lt;a class=&quot;headline-link&quot; href=&quot;https://web.dev/building-multiple-pwas-on-the-same-domain/#the-case-for-multiple,-related-pwas&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In some cases, you might want to build independent apps, but still identify them
as belonging to the same organization or &amp;quot;brand&amp;quot;. Reusing the same &lt;strong&gt;domain
name&lt;/strong&gt; is a good way of establishing that relationship. For example:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;An ecommerce site wants to create a standalone experience to let sellers
manage their inventory, while making sure they understand that it belongs to
the main website where the users buy products.&lt;/li&gt;
&lt;li&gt;A sports news site wants to build a specific app for a major sporting event,
to let users receive stats about their favorite competitions via
notifications, and install it as a Progressive Web App, while making sure that
users recognize it as an app built by the news company.&lt;/li&gt;
&lt;li&gt;A company wants to build separate chat, mail, and calendar apps and wants them
to work as individual apps, tied to the company&#39;s name.&lt;/li&gt;
&lt;/ul&gt;
&lt;figure&gt;
  &lt;img alt=&quot;Avoid using different origins for site sections of the same site when trying to build a unified Progresive Web App.&quot; decoding=&quot;async&quot; height=&quot;475&quot; loading=&quot;lazy&quot; sizes=&quot;(min-width: 800px) 800px, calc(100vw - 48px)&quot; src=&quot;https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/XEwhGkkV9Bz7Z2KEJWjm.png?auto=format&quot; srcset=&quot;https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/XEwhGkkV9Bz7Z2KEJWjm.png?auto=format&amp;w=200 200w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/XEwhGkkV9Bz7Z2KEJWjm.png?auto=format&amp;w=228 228w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/XEwhGkkV9Bz7Z2KEJWjm.png?auto=format&amp;w=260 260w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/XEwhGkkV9Bz7Z2KEJWjm.png?auto=format&amp;w=296 296w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/XEwhGkkV9Bz7Z2KEJWjm.png?auto=format&amp;w=338 338w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/XEwhGkkV9Bz7Z2KEJWjm.png?auto=format&amp;w=385 385w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/XEwhGkkV9Bz7Z2KEJWjm.png?auto=format&amp;w=439 439w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/XEwhGkkV9Bz7Z2KEJWjm.png?auto=format&amp;w=500 500w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/XEwhGkkV9Bz7Z2KEJWjm.png?auto=format&amp;w=571 571w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/XEwhGkkV9Bz7Z2KEJWjm.png?auto=format&amp;w=650 650w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/XEwhGkkV9Bz7Z2KEJWjm.png?auto=format&amp;w=741 741w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/XEwhGkkV9Bz7Z2KEJWjm.png?auto=format&amp;w=845 845w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/XEwhGkkV9Bz7Z2KEJWjm.png?auto=format&amp;w=964 964w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/XEwhGkkV9Bz7Z2KEJWjm.png?auto=format&amp;w=1098 1098w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/XEwhGkkV9Bz7Z2KEJWjm.png?auto=format&amp;w=1252 1252w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/XEwhGkkV9Bz7Z2KEJWjm.png?auto=format&amp;w=1428 1428w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/XEwhGkkV9Bz7Z2KEJWjm.png?auto=format&amp;w=1600 1600w&quot; width=&quot;800&quot; /&gt;
  &lt;figcaption&gt;Company that owns example.com wants to provide three independent apps or PWAs, using the same domain name to establish the relationship between them.&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;h2 id=&quot;using-separate-origins&quot;&gt;Using separate origins &lt;a class=&quot;headline-link&quot; href=&quot;https://web.dev/building-multiple-pwas-on-the-same-domain/#using-separate-origins&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The recommended approach in cases like these is for each conceptually
distinct app live on its own origin.&lt;/p&gt;
&lt;p&gt;If you want to use the same domain name inside all of them, you can do that by
using subdomains. For example, a company that provides multiple internet apps or
services can host a mail app at &lt;code&gt;https://mail.example.com&lt;/code&gt; and a calendar app at
&lt;code&gt;https://calendar.example.com&lt;/code&gt;, while offering the main service of their
business at &lt;code&gt;https://www.example.com&lt;/code&gt;. Another example is a sports site that
wants to create an independent app completely dedicated to an important sports
event, like a football championship at &lt;code&gt;https://footballcup.example.com&lt;/code&gt;, that
users can install and use independently of the main sport site, hosted at
&lt;code&gt;https://www.example.com&lt;/code&gt;. This approach might also be useful for platforms that
let customers create independent apps of their own under the company&#39;s brand.
For example, an app that lets merchants create their own PWAs at
&lt;code&gt;https://merchant1.example.com&lt;/code&gt;, &lt;code&gt;https://merchant2.example.com&lt;/code&gt;, etc.&lt;/p&gt;
&lt;p&gt;Using different origins ensures isolation between the apps, which means that
each of them can manage different browser features independently, including:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Installability:&lt;/strong&gt; Each app has its own Manifest and provides its own
installable experience.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Storage:&lt;/strong&gt; Each app has its own caches, local storage, and basically all
forms of device-local storage, without sharing them with the others.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Service Workers:&lt;/strong&gt; Each app has its own service worker for the registered
scopes.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Permissions:&lt;/strong&gt; Permissions are also scoped by origins. Thanks to that, users
will know exactly which service they are giving permissions for, and
features like notifications will be properly attributed to each app.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Creating such a degree of isolation is the most desirable in the use case of
multiple, independent PWAs, so &lt;strong&gt;we strongly recommend this approach&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;If apps on subdomains want to share local data with each other they will still
be able to do it via cookies, or for more advanced scenarios they could
consider synchronizing the storage through a server.&lt;/p&gt;
&lt;figure&gt;
  &lt;img alt=&quot;ALT_TEXT_HERE&quot; decoding=&quot;async&quot; height=&quot;421&quot; loading=&quot;lazy&quot; sizes=&quot;(min-width: 800px) 800px, calc(100vw - 48px)&quot; src=&quot;https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/FfuseK64y4PRqXYEGEt9.png?auto=format&quot; srcset=&quot;https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/FfuseK64y4PRqXYEGEt9.png?auto=format&amp;w=200 200w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/FfuseK64y4PRqXYEGEt9.png?auto=format&amp;w=228 228w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/FfuseK64y4PRqXYEGEt9.png?auto=format&amp;w=260 260w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/FfuseK64y4PRqXYEGEt9.png?auto=format&amp;w=296 296w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/FfuseK64y4PRqXYEGEt9.png?auto=format&amp;w=338 338w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/FfuseK64y4PRqXYEGEt9.png?auto=format&amp;w=385 385w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/FfuseK64y4PRqXYEGEt9.png?auto=format&amp;w=439 439w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/FfuseK64y4PRqXYEGEt9.png?auto=format&amp;w=500 500w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/FfuseK64y4PRqXYEGEt9.png?auto=format&amp;w=571 571w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/FfuseK64y4PRqXYEGEt9.png?auto=format&amp;w=650 650w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/FfuseK64y4PRqXYEGEt9.png?auto=format&amp;w=741 741w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/FfuseK64y4PRqXYEGEt9.png?auto=format&amp;w=845 845w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/FfuseK64y4PRqXYEGEt9.png?auto=format&amp;w=964 964w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/FfuseK64y4PRqXYEGEt9.png?auto=format&amp;w=1098 1098w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/FfuseK64y4PRqXYEGEt9.png?auto=format&amp;w=1252 1252w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/FfuseK64y4PRqXYEGEt9.png?auto=format&amp;w=1428 1428w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/FfuseK64y4PRqXYEGEt9.png?auto=format&amp;w=1600 1600w&quot; width=&quot;800&quot; /&gt;
  &lt;figcaption&gt;Building different PWAs in distinct origins, by using subdomains is a good practice.&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;h2 id=&quot;using-the-same-origin&quot;&gt;Using the same origin &lt;a class=&quot;headline-link&quot; href=&quot;https://web.dev/building-multiple-pwas-on-the-same-domain/#using-the-same-origin&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The second approach is building the different PWAs on the same origin. This
includes the following scenarios:&lt;/p&gt;
&lt;h3 id=&quot;non-overlapping-paths&quot;&gt;Non-overlapping paths &lt;a class=&quot;headline-link&quot; href=&quot;https://web.dev/building-multiple-pwas-on-the-same-domain/#non-overlapping-paths&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Multiple PWAs or conceptual &amp;quot;web apps&amp;quot;, hosted on the same origin, with
non-overlapping paths. For example:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;https://example.com/app1/&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;https://example.com/app2/&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;overlappingnested-paths&quot;&gt;Overlapping/nested paths &lt;a class=&quot;headline-link&quot; href=&quot;https://web.dev/building-multiple-pwas-on-the-same-domain/#overlappingnested-paths&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Multiple PWAs on the same origin, one of whose scope is nested inside the other:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;https://example.com/&lt;/code&gt; (the &amp;quot;outer app&amp;quot;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;https://example.com/app/&lt;/code&gt; (the &amp;quot;inner app&amp;quot;)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The service worker API and manifest format allow you to do either of the above,
using path-level scoping. However, in both cases, using the same origin presents
many problems and limitations, the root of which stems from the fact that the
browser won&#39;t fully consider these to be distinct &amp;quot;apps&amp;quot;, therefore &lt;strong&gt;this
approach is discouraged&lt;/strong&gt;.&lt;/p&gt;
&lt;figure&gt;
  &lt;img alt=&quot;ALT_TEXT_HERE&quot; decoding=&quot;async&quot; height=&quot;420&quot; loading=&quot;lazy&quot; sizes=&quot;(min-width: 800px) 800px, calc(100vw - 48px)&quot; src=&quot;https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/6HX5zEb58sEEWQoJt82m.png?auto=format&quot; srcset=&quot;https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/6HX5zEb58sEEWQoJt82m.png?auto=format&amp;w=200 200w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/6HX5zEb58sEEWQoJt82m.png?auto=format&amp;w=228 228w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/6HX5zEb58sEEWQoJt82m.png?auto=format&amp;w=260 260w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/6HX5zEb58sEEWQoJt82m.png?auto=format&amp;w=296 296w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/6HX5zEb58sEEWQoJt82m.png?auto=format&amp;w=338 338w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/6HX5zEb58sEEWQoJt82m.png?auto=format&amp;w=385 385w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/6HX5zEb58sEEWQoJt82m.png?auto=format&amp;w=439 439w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/6HX5zEb58sEEWQoJt82m.png?auto=format&amp;w=500 500w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/6HX5zEb58sEEWQoJt82m.png?auto=format&amp;w=571 571w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/6HX5zEb58sEEWQoJt82m.png?auto=format&amp;w=650 650w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/6HX5zEb58sEEWQoJt82m.png?auto=format&amp;w=741 741w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/6HX5zEb58sEEWQoJt82m.png?auto=format&amp;w=845 845w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/6HX5zEb58sEEWQoJt82m.png?auto=format&amp;w=964 964w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/6HX5zEb58sEEWQoJt82m.png?auto=format&amp;w=1098 1098w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/6HX5zEb58sEEWQoJt82m.png?auto=format&amp;w=1252 1252w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/6HX5zEb58sEEWQoJt82m.png?auto=format&amp;w=1428 1428w, https://web-dev.imgix.net/image/26V1DWN36MZr3mUo8ChSBlCpzp43/6HX5zEb58sEEWQoJt82m.png?auto=format&amp;w=1600 1600w&quot; width=&quot;800&quot; /&gt;
  &lt;figcaption&gt;Using paths (overlapping or not) to provide two independent PWAs (“app1”, “app2”) under the same origin is discouraged.&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;In the next section, we analyze these challenges in more detail, and what can be
done, if using separate origins is not an option.&lt;/p&gt;
&lt;h2 id=&quot;challenges-for-multiple,-same-origin-pwas&quot;&gt;Challenges for multiple, same-origin PWAs &lt;a class=&quot;headline-link&quot; href=&quot;https://web.dev/building-multiple-pwas-on-the-same-domain/#challenges-for-multiple,-same-origin-pwas&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Here are some practical issues common to both same-origin approaches:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Storage:&lt;/strong&gt; Cookies, local storage, and all forms of device-local storage are
shared between apps. For that reason, if the user decides to wipe local data
for one app, it will wipe all the data from the origin; there&#39;s no way
to do this for a single app. Note that Chrome and some other
browsers will actively prompt users to wipe local data when uninstalling one
of the apps, and this will affect data for the other apps on the origin as
well. Another issue is that apps will also have to share their &lt;a href=&quot;https://web.dev/storage-for-the-web/#how-much&quot;&gt;storage
quota&lt;/a&gt; which means if either of
them takes up too much space, the other will be negatively impacted.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Permissions:&lt;/strong&gt; Permissions are tied to the origin. That means if the user
grants a permission to one app, it will apply to all apps on that origin
simultaneously. That may sound like a good thing (not having to ask for a
permission multiple times), but remember: if the user blocks permission to one
app, it will prevent the others from requesting that permission or using that
feature.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;User settings:&lt;/strong&gt; Settings are also set per-origin. For example, if two apps
have different font sizes, and the user wants to adjust the zoom in only one
of them to compensate for it, they won&#39;t be able to do it without applying the
setting to the other apps as well.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These challenges make it difficult to encourage this approach. Nevertheless, if
you can&#39;t use a separate origin (e.g. a subdomain), as discussed in the &lt;a href=&quot;https://web.dev/building-multiple-pwas-on-the-same-domain/#using-separate-origins&quot;&gt;Using
separate origins&lt;/a&gt; section, from the two same-origin options we presented,
using non-overlapping paths is strongly recommended, over
overlapping/nested paths.&lt;/p&gt;
&lt;p&gt;As mentioned, the challenges discussed in this section are common to both
same-origin approaches. In the next section we&#39;ll go deeper into the details
of why using overlapping/nested paths is the least recommended strategy.&lt;/p&gt;
&lt;h2 id=&quot;additional-challenges-for-overlappingnested-paths&quot;&gt;Additional challenges for overlapping/nested paths &lt;a class=&quot;headline-link&quot; href=&quot;https://web.dev/building-multiple-pwas-on-the-same-domain/#additional-challenges-for-overlappingnested-paths&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The additional issue with overlapping/nested paths approach (where
&lt;code&gt;https://example.com/&lt;/code&gt; is the outer app and  &lt;code&gt;https://example.com/app/&lt;/code&gt; is the
inner app), is that all URLs in the inner app will actually be considered
part of both the outer app and the inner app.&lt;/p&gt;
&lt;p&gt;In practice this presents the following issues:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Installation Promotion:&lt;/strong&gt; If the user visits the inner app (for example,
in a web browser), when the outer app is already installed in the user&#39;s
device, the browser won&#39;t show the install promotional banners, and the
&lt;a href=&quot;https://web.dev/customize-install/&quot;&gt;BeforeInstallPrompt event&lt;/a&gt; won&#39;t be
triggered. The reason is that the browser will check and see whether the
current page belongs to an app that&#39;s already installed, and it will conclude
that it is. The workaround for this is to install the inner app manually
(via &amp;quot;Create Shortcut&amp;quot; browser menu option), or to install the inner app
first, before the outer app.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&quot;https://developer.mozilla.org/docs/Web/API/notification&quot; rel=&quot;noopener&quot;&gt;Notification&lt;/a&gt;
and the &lt;a href=&quot;https://web.dev/badging-api/&quot;&gt;Badging API&lt;/a&gt;&lt;/strong&gt;: If the outer app is
installed but the inner app is not, notifications and badges coming from the
inner app will be erroneously attributed to the outer app (which is the
nearest enclosing scope of an installed app). This feature works properly in
the case where both apps are installed on the user&#39;s device.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&quot;https://github.com/WICG/sw-launch/blob/main/declarative_link_capturing.md&quot; rel=&quot;noopener&quot;&gt;Link
Capturing&lt;/a&gt;&lt;/strong&gt;:
The outer app may capture URLs that belong to the inner app. This is
especially likely if the outer app is installed but the inner app isn&#39;t.
Similarly, links within the outer app that link to the inner app will not
link capture into the inner app, since they are considered to be within the
outer app&#39;s scope. Additionally, on ChromeOS and Android, if these apps are
added to the Play Store (as &lt;a href=&quot;https://developer.chrome.com/docs/android/trusted-web-activity/overview/&quot; rel=&quot;noopener&quot;&gt;Trusted Web
Activities&lt;/a&gt;),
the outer app will capture all links. Even if the inner app is installed,
the OS will still offer the user the choice of opening them in the outer
app.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion &lt;a class=&quot;headline-link&quot; href=&quot;https://web.dev/building-multiple-pwas-on-the-same-domain/#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In this article we looked at different ways in which developers can build
multiple Progressive Web Apps related to each other within the same &lt;strong&gt;domain&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;In summary, we strongly recommend using a different origin (e.g. by using
subdomains) to host independent PWAs. Hosting them in the same origin presents
many challenges, mainly because the browser won&#39;t fully consider
these to be distinct apps.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Separate origins: &lt;strong&gt;Recommended&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Same origin, non-overlapping paths: &lt;strong&gt;Not recommended&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Same origin, overlapping/nested paths: &lt;strong&gt;Strongly not recommended&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If it&#39;s not possible to use different origins, using non-overlapping paths (e.g.
&lt;code&gt;https://example.com/app1/&lt;/code&gt; and &lt;code&gt;https://example.com/app2/&lt;/code&gt; it&#39;s strongly
recommended over using overlapping or nested paths, like &lt;code&gt;https://example.com/&lt;/code&gt;
(for the outer app) and &lt;code&gt;https://example.com/app/&lt;/code&gt; (for the inner app).&lt;/p&gt;
&lt;h2 id=&quot;additional-resources&quot;&gt;Additional resources &lt;a class=&quot;headline-link&quot; href=&quot;https://web.dev/building-multiple-pwas-on-the-same-domain/#additional-resources&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://web.dev/multi-origin-pwas/&quot;&gt;Progressive Web Apps in multi-origin
sites&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;With many thanks for their technical reviews and suggestions: &lt;em&gt;Joe Medley,
Dominick Ng, Alan Cutter, Daniel Murphy, Penny McLachlan, Thomas Steiner and
Darwin Huang&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Photo by &lt;a href=&quot;https://unsplash.com/@timmossholder&quot; rel=&quot;noopener&quot;&gt;Tim Mossholder&lt;/a&gt; on
&lt;a href=&quot;https://unsplash.com/photos/GmvH5v9l3K4&quot; rel=&quot;noopener&quot;&gt;Unsplash&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
</content>
    <author>
      <name>Demian Renzulli</name>
    </author><author>
      <name>Matt Giuca</name>
    </author><author>
      <name>Chase Phillips</name>
    </author>
  </entry>
</feed>
