Repository navigation
Architecture
github-actions[bot] edited this page Nov 21, 2026
·
2 revisions
spotkit is one npm package, @kodentuzo/spotkit, written in TypeScript and built to ES modules
with type declarations. It wraps what Spotcraft's
app contract already says,
and nothing more: an app can always do the same by hand.
| Entry | Source | Runs in | Dependencies |
|---|---|---|---|
@kodentuzo/spotkit |
src/index.ts |
the app's server (Node) | jose |
@kodentuzo/spotkit/client |
src/client.ts |
browsers and native clients | none |
src/legal.ts is shared: the LegalFacts types and parseLegal(), which checks the shape of
the facts on both sides.
-
spotkit()readsAUTH_URL,AUTH_ISSUERandAUTH_JWKS_URL.kit.user(request)checks a bearer JWT against the pool's keys, or turns a session (cookie or bearer token) into a JWT at the pool's/tokenand checks that. Answers are cached until the token is about to expire. A pool that fails throws, so it never looks like a signed-out visitor. -
legalFacts()parsesLEGAL_FACTS, and throws when it's missing or malformed, so a privacy page never renders from nothing. -
clientAddress()andhealth()are small helpers over WebHeadersandResponse.
-
legal()fetches/_spotcraft/legal.json;exportMe()anddeleteMe()call the pool's export and anonymous-delete endpoints on the app's own origin. -
localData()lists, downloads and clears what the browser keeps for the app:localStoragekeys by prefix or name, its own cookies, and IndexedDB databases (waiting until each is deleted). Every global is injectable, and blocked storage reads as empty. -
analytics()reads/_spotcraft/config.jsonand follows the instance's mode: it loads the tracker once, keeps the visitor's choice inlocalStorage, and refuses event data whose keys could identify someone.
Nothing in the client touches Node APIs, and every function takes an origin and a fetch, so
native apps and tests can supply their own.
test/ runs with node --test: the token paths against a local JWKS, the cache, the legal
facts' parser, the client's calls, and the analytics modes with fake storage and documents.
Published from docs/. Edit the files there; changes here are overwritten.