# 0053 Both apps share one service worker, one cache, and one manifest Status: Accepted · Area: architecture · Date: 2026-10-09 · Decided by: user ## Context Adopted from kasra-pay's decision 0034. Decision 0001 serves bull and bear on one domain, routed by user agent, while the skill's lib-pwa.md assumes each app has its own origin. So one `/sw.js` registration at scope `/`, one `pwa-assets-v1` cache, and one `/manifest.webmanifest` serve both apps, and a device whose user agent switches (an iPad, a desktop-site toggle) gets whichever app nginx picks. ## Decision - Both apps write the worker with the same `writeServiceWorker` options, set `NEXT_PUBLIC_SERVICE_WORKER_ENABLED` to the same value, and ship in one deploy. - The manifest's fields and `buildManifest` live in `platforms/market/src/app/manifest`, so both apps serve the same manifest. ## Alternatives - A worker or cache per app: impossible on one origin, where both apps serve the same paths and the worker can't tell which app a request is for. - One origin per app: contradicts 0001. ## Consequences - A flag that differs between the apps registers and unregisters the worker in turn on a device that switches apps. Nothing checks the two `.env` files agree yet; that check is debt. - `maxEntries` (200) holds about one deploy of both apps; with 0052, a device that uses one app keeps all of that app's files.