Files
Phenocheck/docs/architecture.md
T
dasemuandClaude Sonnet 5 d6598d0b31 chore: bootstrap Claude setup
Add root CLAUDE.md, docs/architecture.md, LESSONS.md, .env.example,
.claude/settings.json hooks (PostToolUse JS syntax check, Stop hook
validating manifest.json + node --check on all JS), and GitHub
Actions workflows (ci.yml, version.yml) for this plain-JS Chrome
extension with no existing build/lint/test tooling.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-18 15:02:43 +02:00

1.5 KiB

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.