Offline-First Care

· Pavel · release

offlinepwareliabilitypet-care

The internet is still very confident for something that disappears at the exact wrong moment.

Earlier this year, we started making Meo Mai Moi more useful offline. At the time, it was a beginning: cached pet records, queued pet edits, a little more resilience when the connection went missing.

Now the shape is much bigger.

Meo Mai Moi is an offline-capable PWA for core pet care workflows. Not “everything works magically forever without a server.” That would be dishonest. But the important daily surfaces are now much harder to break just because the network disappeared.

What Works Offline Now

If you recently loaded your data, the installed app can cold-start from its cached app shell and let you reach pet care screens without a live connection.

Pet records can be viewed from persisted cache. Pet create, edit, delete, and status changes can be queued locally. Weight records can be created, updated, and deleted offline. Vaccination records can be created, updated, and deleted offline. Medical record metadata can be created, updated, and deleted offline. Medical record photos can queue for upload. Habit day check-ins and habit edits can queue too.

That is a lot of plumbing for one simple promise:

you should not lose the ability to care because a signal bar went missing.

When the app reconnects, it replays the queued work, invalidates the right cached data, and shows sync status instead of pretending nothing happened.

Pending Work Is Visible

Offline support is dangerous if it lies.

The app should never quietly say “done” when the server has not seen the change yet. So pending work is visible through the offline/sync status surfaces. Queued uploads and queued operations are counted together. Reconnect syncing shows progress. Failed or conflicted work points users toward the sync center.

There is now a /settings/sync page for reviewing work that needs attention.

Failed operations can be retried or discarded. Supported conflicts can be resolved with explicit choices like keeping the local version or using the server version. Not every domain has perfect merge UI yet, but the rule is clear: do not silently overwrite meaningful data.

That rule matters. Pet care history is not disposable state.

The Boring Technical Parts

Under the hood, offline writes now use durable IndexedDB queues rather than optimistic memory tricks. Media uploads have their own retryable upload queue. Domain operations use shared queue primitives, reconnect replay, idempotency keys where supported, and local projections so pending rows appear in the UI before the server confirms them.

The app also keeps cache boundaries strict.

The service worker caches the app shell and public assets. Authenticated API data lives in an explicit persisted TanStack Query allowlist. Private offline stores, cached identity, queued media, and queued operations are cleared on logout, account deletion, or user switch.

That separation is not decorative. Offline mode should not become a privacy leak with a nicer name.

What Still Requires Internet

Some workflows intentionally remain online-only.

Placement requests, adoption flows, messaging, invitations, account security, admin actions, push registration, and similar multi-party or security-sensitive work still require a live server. The app should be honest there. It is better to show “connection needed” than to fake success for a workflow that affects other people and animals.

Some health details are still online-only too. Vaccination renewals and certain photo delete paths still need the server. Conflict handling is also conservative in places where automatic merging would be risky.

This is not a weakness. It is the contract.

Offline-first does not mean every button becomes a local fantasy. It means the app deliberately chooses which work can be safely queued and which work needs authority now.

Why It Matters

Pet care does not wait for ideal infrastructure.

You might be in a clinic with bad reception. You might be traveling. You might be holding a stressed animal in one hand and trying to check a vaccination date with the other. You might be in a place where the internet is technically available but emotionally useless because you have thirty seconds and one task.

The app should help in that moment.

Offline support is not the most glamorous feature in Meo Mai Moi. It is mostly queues, cache rules, replay logic, edge cases, and tests that try to catch the ugly things demos hide.

But it fits the project perfectly.

Care tools should reduce the number of ways people get abandoned by their tools. This release moves Meo Mai Moi much closer to that.