# Architecture Phenocheck is a Manifest V3 Chrome extension with no build step. ## Components - `manifest.json` — declares permissions (`storage`, `cookies`), host permissions for `x.com` / `twitter.com`, the background service worker, content scripts, and web-accessible resources (phenotype images). - `background.js` — the extension's service worker. - `content.js` + `content.css` — injected into matched pages at `document_idle`; reads the page DOM and renders phenotype estimates. - `data/data.js` — static dataset (location → phenotype mapping or similar), loaded before `content.js` so its globals are available to it. - `images/icons/` — toolbar/extension icons. - `images/phenotypes/` (incl. `images/phenotypes/custom/`) — images shown in the injected UI, exposed via `web_accessible_resources`. ## Data flow 1. `background.js` fetches the profile's declared "Account based in" country via X's internal `AboutAccountQuery` API (using the `cookies` permission for auth). 2. `content.js` requests that country for the profile being viewed, with an in-memory cache keyed by handle. 3. It maps the country to an estimate using `data/data.js` (plus hardcoded per-handle overrides in `content.js`). 4. It renders the result into the page using `content.css` for styling and images from `images/phenotypes/` (or `images/phenotypes/custom/` for overrides). No external backend of our own is involved; the only network calls are to X's own internal API, made from the background service worker.