PWA for Craft CMS

Free for Craft CMS 5

Turn a Craft site into an app people can install

A browser installs a site when three things are right: a manifest describing the app, a service worker for when the network does not answer, and icons at the sizes each platform insists on. PWA builds all three from what Craft already knows. Pick one square image, reload the front end, and run preflight to see what the browser sees.

PWA

Features

Everything a browser checks before it offers to install, generated from your Craft install and checked again over HTTP.

A manifest per site

Name, short name, scope, start URL, display mode and colours, per site, because two sites on one install are two apps to a browser. Served live from a route, so it is never stale or half-deployed.

  • Scope follows the site's base path, so /de/ stays /de/
  • Images stored by UID, so a manifest synced from dev still finds them

One image, every icon

One square source in. Out come the twelve launcher sizes, a maskable pair inset to the safe zone so Android keeps your edges, an Apple touch icon, favicons and twenty-four iOS splash screens.

A service worker you can read

The worker's logic is one fixed file. Only its configuration is generated: a flight plan of ordered rules, first match wins. Pages network first, assets and images stale while revalidate, the control panel never cached.

  • Separate limits for pages, assets and images
  • Cached responses expire after 30 days by default

Offline, and an install prompt

An offline page precached before anyone needs it, and every page a visitor has seen still there without a connection. The install prompt waits for the browser's offer and asks with your copy. iOS visitors get Add to Home Screen instructions.

Preflight

Fetches the running site the way a browser does and grades what comes back: is the manifest reachable, is the worker served as JavaScript, does the start URL redirect, is the 512px icon actually there. Six checks block an install; each failure says what to do.

  • Exits non-zero on the console, so a deploy can fail on it
  • Pro runs it on a schedule and emails the report

Web push from your own server

Pro sends notifications from Craft straight to the browsers' push services. No third party and no per-message fee. Payloads are encrypted end to end, every delivery is recorded per device, and dead endpoints are dropped.

  • Broadcasts go out in batches on the queue
  • Optional broadcast when an entry is first published

Find out before your visitors do

Settings always look right, because they are what you just typed. Preflight checks the result instead, over HTTP, against the running site. A rewrite rule that 404s the icons fails a blocking check, and the command exits 1, which is enough to stop a deploy.

text
$ php craft pwa/preflight/run

Example — 74/100  NOT INSTALLABLE

  ok   Secure origin — Served over HTTPS.
  ok   Manifest link in the page — The home page links to the manifest.
  ok   Manifest served — Valid JSON, served from https://example.com/manifest.webmanifest.
  ok   Display mode — Set to standalone.
 BLOCK Icons reachable — The manifest lists icons, but https://example.com/pwa/icons/9d1e…/icon-192.png responded 404.
        → The generated files are not being served. If the web root is read-only on this
          environment they are in storage/ and need the fallback route, which means the
          site's URL rules must reach Craft.
  ok   Service worker served — Served as JavaScript from https://example.com/sw.js.
 warn  Start URL — The start URL redirects (301 → https://example.com/home).
  …

$ echo $?
1

Frequently Asked Questions

The questions worth answering before you install it.

Pick one image and run preflight

Lite is free and makes the site installable. Pro is $79 with a $59/year renewal, and adds web push, your own caching rules and a preflight check that runs on a schedule.