DocsSyncing a Large Registry

Syncing a Large Registry

Do not fetch the entire PWARegistry every time a user loads your page.

Instead:

In a product that looks like a store:

Initial load

  1. GET /registry/v1/meta.json and store revision.
  2. GET /registry/v1/index.json.
  3. Fetch /registry/v1/apps/{id}.json only for apps you will display. Many catalogs keep the index and load full records lazily.

Incremental load (after the first sync)

  1. GET /registry/v1/meta.json.
  2. If revision equals your stored revision, stop.
  3. GET /registry/v1/changes.json?since=YOUR_REVISION.
  4. Download full records for ids in added and updated.
  5. Drop or tombstone local copies listed in removed.
  6. Store the returned revision.

Hourly is plenty. The homepage health pass and the public cron keep the registry itself current; your copy only needs to notice.

At 1,000, 10,000, or 100,000 apps the same pattern holds. The changes feed exists so you do not re-pull 100,000 records.

Copy-paste TypeScript for this loop is on Example: Build a PWA Store.