Before anyone writes offline code for a progressive web app (PWA), fill in one table with a row for each task your users perform. For each task, decide what happens in four states: online, on a weak or unstable connection, offline and when the device reconnects. Then record where its data comes from, how old that data may be, what the user sees and how you will test it. Below are the five modes a task can run in and the template. After them comes the matrix we wrote for ClinicTek, the clinic management system BarmajTek builds, runs and supports.
A PWA is a website that people can install and use like an app. Its service worker is the script the browser runs between the app and the network, defined in the W3C Service Workers specification. Your matrix tells whoever writes the service worker which requests it may answer from the device.
The five offline modes
When the network is gone, every task runs in exactly one of these modes.
| Mode | What the user can do | Typical tasks |
|---|---|---|
| Online only | Sees the control disabled, with one explanation | Payments, refunds, permission changes, reserving a booking slot |
| Cached view | Reads a saved copy that shows its age | Schedule, queue, dashboard |
| Local draft | Types and saves on the device; nothing is sent yet | Visit note, inspection form |
| Queued command | Submits; the app sends it when the network returns, and the server accepts or rejects it | Updates to a saved draft |
| Fully local | Works with no server at all | Calculators, personal checklists with no shared data |
A queued command must be idempotent: when the same command reaches the server twice, the server applies it once and returns the first result. Without that guarantee, every retry risks a second record.
The matrix template
Each row below is one column of your matrix, laid out vertically so it reads on a phone. Fill in one copy per task and copy the answers into that task's row. The right-hand column shows a filled copy for booking an appointment.
| Field | What to write | Example: book an appointment |
|---|---|---|
| Task | The action in the user's words | Book an appointment |
| Online | Normal behaviour | Pick a slot; the server reserves it |
| Weak or unstable network | What changes when requests are slow or keep dropping | Show "Checking availability" and keep the slot unbooked until the server answers |
| Offline mode | One of the five modes | Online only |
| Data source and freshness limit | Where the data comes from and the oldest copy you accept | Availability from the server only; no cached copy |
| Stored on the device | Which fields, for how long, and what clears them | The details the user typed, cleared on logout |
| What the user sees | The message in each state | "Booking needs a connection. Your details are saved." |
| Conflict rule | What wins when the device and the server both changed | The server decides; the slot may be gone |
| Retry rule | Which failures retry, and how | Network errors retry with backoff and jitter; "slot taken" never retries |
| Acceptance test | The test that proves this row | Lose the network mid-booking, reconnect, and confirm there is no booking and no lost input |
Backoff means waiting longer after each failed attempt. Add jitter, a small random offset, so that many devices do not retry at the same moment.
A filled example: the offline design we wrote for ClinicTek
ClinicTek is online-first, so the app expects a connection and offline support covers only the tasks in the table below. We wrote its offline design so that recent work stays on the device until it syncs. Every change replayed after reconnection passes the same server checks as a live one. The rows below come from that design document as of 4 November 2026.
| Task | Offline mode | Rule we set |
|---|---|---|
| Schedule, queue and My Day screens | Cached view | Snapshot replaced after reconnection; staff snapshots kept for 7 days at most; cached data shows its age |
| Patient portal | Cached view | Portal snapshot kept for 24 hours; queue snapshot for 15 minutes |
| Update a visit draft | Queued command | The server checks the exact record version; on a conflict both copies are kept; a draft stays until it syncs, the user discards it or it is 30 days old |
| Approve or amend a visit | Online only | Never queued |
| Create, move or hold an appointment slot | Online only | Capacity is never reserved offline |
| Invoice, payment, refund | Online only | Financial data is never stored on the device |
| Consent signature | Online only | Captured only while connected |
| File or dictation upload | Online only | Uploaded only while connected |
| Settings, permissions, integrations | Online only | Changed only while connected |
Three decisions shaped the rest. First, the sync interface accepts named operations and never raw URLs, so the server knows exactly what each queued item means. Second, a task joins the offline list only when it has all of these:
- input validation
- permission checks
- idempotent replay
- a version check
- audit logging
- a translated conflict screen
- allow and deny tests for every role that can use it
Third, a kill switch, a setting the team can turn on at any time, stops new queueing and keeps pending drafts visible and exportable.
Build your matrix in eight steps
- List the tasks on your three most important screens, in the words your users use.
- Mark every task that moves money, creates a legal or tax document, changes permissions, changes stock or reserves capacity. Those run online only.
- Give every remaining task one of the five modes.
- Set a freshness limit for each cached view and show the data's age on screen.
- Decide what is stored on the device, for how long, and which events clear it. Those events are logout, a switch of account or organisation, a rejected session or an incompatible app update.
- Write the conflict rule for each queued command. When a person must choose, keep both versions and show them side by side.
- Write the retry rule. Network errors, rate limits (HTTP 429) and server errors (HTTP 5xx) retry with backoff and jitter. Validation and permission rejections stop and ask the user to review. The server re-checks permissions when it replays each command, because a user allowed to act yesterday may have lost that right today.
- Write one acceptance test per row and run it on real phones.
Write the message for each state
Users need one place that tells them what the app is doing. For ClinicTek's staff screens we wrote a single status line, with this wording for each state:
| State | What the status line says | How long it stays |
|---|---|---|
| Offline | No internet connection. Safe drafts stay on this device. | Until the connection returns |
| Syncing | Reconnecting and syncing… | While queued work is sent |
| Up to date | Up to date | A moment, then it hides |
| Needs attention | Some saved work needs your review. | Until the user reviews the affected item |
In the design, controls for online-only tasks stay visible and disabled, with one explanation. If the clinic record changed while the device was offline, the conflict sheet we designed shows Your saved draft and Current clinic version side by side. Its two buttons are Keep my draft and Use clinic version, and we specified that the app keeps both copies until the user picks one.
Test on real phones
Throttling the network in a desktop browser covers the basics. Real phones add the cases your matrix must survive:
- the operating system clearing stored data when storage runs low
- the app closed, or the phone restarted, with work still queued
- a session that expires while the phone is offline
- a connection that drops and returns again and again
- an app update that arrives while a draft is waiting
- background limits on the service worker
MDN Web Docs notes that browsers limit how many times, and for how long, a background sync can run. It adds that Chrome is likely to stop a service worker after 30 seconds idle. Background sync therefore cannot be your only recovery path. Also sync when the app starts, when the browser reports it is back online and when the app returns to the foreground. We wrote all three triggers into ClinicTek's design.
For storage and caching choices, read our guide to offline-first PWA patterns. For merge rules when both sides changed, read our guide to resolving offline sync conflicts.
Have us review your matrix
Send us your three screens and your draft matrix through the project brief, or message us with the WhatsApp button on this page. In a free first chat we go through the rows with you and mark the tasks that must stay online. Then a short paid study at a fixed fee, credited to the project, puts the scope, a cost estimate and a timeline in writing. It takes about five working days. If you are planning a web platform, see custom web platform and SaaS development, and read how we build and run ClinicTek.




