Progressive web app (PWA)
Note for AI agents: This page is baseline guidance, not an exact prescription. Read it, tell your owner what applies to their project, and get their approval before you change anything. Your project's own rules take precedence. If something important for this project is missing here, suggest it to your owner.
For agents
- A PWA is a web app that can be installed and may work offline through a service worker. Typical class: S or M; L with accounts and sensitive data.
- Rule 1: valid manifest, HTTPS and a service worker with a clear update path.
- Rule 2: define and test offline behavior; never cache private data for other users.
- Rule 3: ask for push permission only after a user action that explains the value.
Which class?
- S: installable content or tool, no accounts.
- M: accounts or personal data, or a server-side API key.
- L: payments, admin panel, sensitive data, many users.
- XL: millions of users.
Audit checklist
Every project
- Facts are verified from current official documentation
- What: Commands, libraries, APIs and platform policies in the project come from current official documents, not from memory.
- How to check: Open the dependency list and the platform configuration; for each non-trivial choice find the official page it relies on (link in a comment or a decision note).
- Evidence: Decision note or code comment with the official URL and the date it was checked.
- Packages come from official sources, stable versions only
- What: Packages and versions are chosen from official sources; the current stable release is used, not alpha or beta.
- How to check: Read the dependency file for pre-release tags (alpha, beta, rc, next); check each package on its official registry page.
- Evidence: Dependency file without pre-release versions.
- HTTPS everywhere
- What: The site or API is served only over HTTPS, and HTTP redirects to it.
- How to check: Request the
http://address and confirm a redirect; check for a Strict-Transport-Security header; check for mixed content. - Evidence: Response headers of the first request; browser console without mixed-content warnings.
- A valid web app manifest exists
- What: The manifest has name, icons (including a large one),
start_url,displayand theme color, and is linked from every page. - How to check: Open the manifest link in the page head; use the browser’s Application panel to check installability.
- Evidence: Manifest file; installability panel result.
- What: The manifest has name, icons (including a large one),
- The service worker has a clear scope and update path
- What: The service worker is registered with the smallest scope that works, and a new version replaces the old one in a controlled way (users are not stuck on stale files).
- How to check: Read the registration code and the cache version logic; deploy a change and see when the user gets it.
- Evidence: Registration code; update test notes.
- Offline behavior is defined and tested
- What: The app shows a useful offline page or cached content; writes made offline are queued or clearly refused; the behavior is tested with the network switched off.
- How to check: Set the browser to offline and use the main screens.
- Evidence: Offline test record or screenshots.
- Private data is not cached for others
- What: Authenticated responses and personal data are not stored in shared or long-lived caches, and caches are cleared on sign-out.
- How to check: Read cache rules for URLs with user data; sign out and check the cache storage.
- Evidence: Cache rule code; empty cache after sign-out.
- Works at phone width
- What: Pages and screens are usable at 360 px width without sideways scrolling.
- How to check: Open the product at 360 px width (browser device mode or a real phone) and walk through the main pages.
- Evidence: Screenshots at phone width for the main pages.
- Accessibility basics meet WCAG 2.2 AA
- What: Correct heading order, text alternatives, enough contrast, keyboard navigation, visible focus, sufficient touch targets, and respect for reduced-motion settings.
- How to check: Tab through every screen; run an automated checker (for example axe) and a contrast check; test with a screen reader once; check
prefers-reduced-motionhandling. - Evidence: Checker report, list of screens tried with keyboard and screen reader.
- No secrets in code, chat, commits or logs
- What: Passwords, keys and tokens live in environment variables or a secret manager;
.envis ignored by git; the repository has only.env.example. - How to check: Check
.gitignorefor.env; run a secret scanner (for example gitleaks) over the full history; search for key-like strings. - Evidence:
.gitignoreline, scanner report with zero findings,.env.examplepath.
- What: Passwords, keys and tokens live in environment variables or a secret manager;
+ If it has users, personal data or API keys (M)
- One package manager, lockfile committed
- What: Exactly one package manager is used and enforced; the lockfile is committed; installs are done from the lockfile (for example
--frozen-lockfile). - How to check: Look for a lockfile in the repository and a rule that forbids other managers; check the CI and Docker install commands.
- Evidence: Lockfile path; install command lines.
- What: Exactly one package manager is used and enforced; the lockfile is committed; installs are done from the lockfile (for example
- Authentication uses a mature library or service
- What: Login is built with a well-known library or hosted service; no home-made cryptography; passwords are hashed with a current algorithm.
- How to check: Find the login code; check the password hashing function (for example Argon2id, scrypt, bcrypt); search for hand-written crypto.
- Evidence: Library name and version; hashing configuration.
- Sessions expire and can be revoked
- What: Sessions have a lifetime, can be ended by the user and by the server, and are invalidated after a password change.
- How to check: Read the session configuration; test: sign in on two devices, change the password, see if the other session ends.
- Evidence: Configuration lines; test result.
- All input is validated on the server with a schema
- What: Every request body, query and parameter is checked on the server against a schema; the client check is only a convenience.
- How to check: For each endpoint find the schema or validator; send invalid, oversized and unexpected fields and see the response.
- Evidence: Validator files per endpoint; test cases for invalid input.
- Permissions are checked on the server
- What: Every action checks who the user is and what they may do on the server; a hidden button is not security.
- How to check: Call each protected endpoint without a session and with the wrong user; read the permission checks in the handlers.
- Evidence: Test names for unauthenticated and wrong-user requests; code lines of the checks.
- External API keys stay on the server
- What: Third-party API keys (including LLM keys) are kept on the server and never shipped to the browser or app.
- How to check: Search the client bundle and app package for key-like strings; check that client calls go to your own server.
- Evidence: Search result with zero keys in the client build.
- Push permission is requested in context
- What: The notification permission is requested after a user action that explains the value, never on first load.
- How to check: Load the app in a fresh profile and watch for permission prompts.
- Evidence: Screen recording or notes.
- Personal data fields are documented
- What: For every personal data field the purpose, retention time and legal basis (KVKK, GDPR) are written down.
- How to check: List the database columns and form fields with personal data; find the matching entries in the data note.
- Evidence: Data note listing each field with purpose, period and basis.
- Automatic backups with a tested restore
- What: The database is backed up automatically, retention is written down, and a restore has actually been tried.
- How to check: Find the backup job and its schedule; find the record of the last restore test.
- Evidence: Backup schedule, retention setting and dated restore-test record.
- Critical flows have automated tests and a local check
- What: Login, saving data, payment (if any) and permission checks have automated tests; one local command runs the checks before pushing.
- How to check: List the test files; run the check command; look for a git hook that runs it.
- Evidence: Test names and a passing run log.
+ If it has an admin panel, file uploads, many users or a store app (L)
Items for class L: see Progressive web app: classes L–XL checklist.
+ If it targets millions of users (XL)
Items for class XL: see Progressive web app: classes L–XL checklist.
Common mistakes
- A service worker with a wide scope that serves stale files forever.
- Caching authenticated pages so the next user on the device can see them.
- No offline page: the browser’s error appears instead.
- Asking for notification permission on first load.
- Missing large icon, so the app is not installable.
- Treating offline writes as saved while they are lost.
- A service worker file cached for long, so updates never arrive.
- Testing only on a fast desktop connection.
Example projects
- Offline-capable recipe reader: PWA, S.
- Habit tracker with accounts: PWA, M.
- Field inspection forms used without signal: PWA, M, queue writes.
- Ticket wallet: PWA, M, private data.
- Documentation reader: PWA, S.
- Restaurant ordering PWA with payments: PWA, L.
- Notes app that syncs: PWA, M.
- Clinic patient app: PWA, L, health data.
- Kiosk display page: PWA, S.
- News reader with push: PWA, M.
- Team chat as PWA: PWA, L.
- Public transport timetable: PWA, S.
Sources
- Progressive web apps — MDN Web Docs
- Web application manifest — MDN Web Docs
- Making PWAs installable — MDN Web Docs
- Offline and background operation — MDN Web Docs
- Service Worker API — MDN Web Docs
- Web Application Manifest — W3C
- Service Workers — W3C
- Learn PWA — web.dev (Google)
- What does it take to be installable? — web.dev (Google)
- The service worker lifecycle — web.dev (Google)
- Common techniques to build offline applications — web.dev (Google)
- Pro Build Guide v1.2: compiled team practices — Pro Build Guide