your personal website on atproto - mirror blento.app

update claude.md

+10 -7
+10 -7
CLAUDE.md
··· 53 53 **Card System (`src/lib/cards/`):** 54 54 55 55 - `CardDefinition` type in `types.ts` defines the interface for card types 56 - - Each card type exports a definition with: `type`, `contentComponent`, optional `editingContentComponent`, `creationModalComponent`, `sidebarButtonText`, `loadData`, `upload` (see more info and description in `src/lib/cards/types.ts`) 56 + - Each card type exports a definition with: `type`, `contentComponent`, optional `editingContentComponent`, `creationModalComponent`, `sidebarButtonText`, `loadData`, `loadDataServer`, `upload` (see more info and description in `src/lib/cards/types.ts`) 57 + - `loadData` fetches external data on the client (via remote functions). `loadDataServer` is the server-side equivalent used during SSR to avoid self-referential HTTP requests on Cloudflare Workers. 58 + - Cards that need external data use `.remote.ts` files (SvelteKit remote functions) co-located in the card folder (e.g. `GitHubProfileCard/api.remote.ts`, `LastFMCard/api.remote.ts`). These use `query()` from `$app/server` and run server-side, with SvelteKit generating fetch wrappers for client use. 57 59 - Card types include Text, Link, Image, Bluesky, Embed, Map, Livestream, ATProto collections, and special cards (see `src/lib/cards`). 58 60 - `AllCardDefinitions` and `CardDefinitionsByType` in `index.ts` aggregate all card types 59 61 - See e.g. `src/lib/cards/EmbedCard/` and `src/lib/cards/LivestreamCard/` for examples of implementation. ··· 69 71 **Caching (`src/lib/cache.ts`):** 70 72 71 73 - `CacheService` class wraps a single Cloudflare KV namespace (`USER_DATA_CACHE`) with namespaced keys 72 - - Keys are stored as `namespace:key` (e.g. `user:did:plc:abc`, `github:someuser`, `lastfm:method:user:period:limit`) 73 - - Per-namespace default TTLs via KV `expirationTtl`: `user` (24h), `identity` (7d), `github` (12h), `gh-contrib` (12h), `lastfm` (1h, overridable), `npmx` (12h), `meta` (no expiry) 74 - - User data is keyed by DID with bidirectional handle↔DID identity mappings (`identity:h:{handle}` → DID, `identity:d:{did}` → handle) 75 - - `getUser(identifier)` accepts either a handle or DID and resolves automatically 76 - - `putUser(did, handle, data)` writes data + both identity mappings 74 + - Keys are stored as `namespace:key` (e.g. `blento:did:plc:abc`, `github:someuser`, `lastfm:method:user:period:limit`) 75 + - Per-namespace default TTLs via KV `expirationTtl`: `blento` (24h), `identity` (7d), `github` (12h), `gh-contrib` (12h), `lastfm` (1h, overridable), `npmx` (12h), `meta` (no expiry) 76 + - Blento data is keyed by DID with bidirectional handle↔DID identity mappings (`identity:h:{handle}` → DID, `identity:d:{did}` → handle) 77 + - `getBlento(identifier)` accepts either a handle or DID and resolves automatically 78 + - `putBlento(did, handle, data)` writes data + both identity mappings 79 + - Generic `get(namespace, key)` / `put(namespace, key, value, ttl?)` and JSON variants `getJSON` / `putJSON` for all namespaces 77 80 - `createCache(platform)` factory function creates a `CacheService` from `platform.env` 78 81 - `CUSTOM_DOMAINS` KV namespace is separate and accessed directly for custom domain → DID resolution 79 82 ··· 91 94 - `/edit` - Self-hosted edit mode 92 95 - `/api/links` - Link preview API 93 96 - `/api/geocoding` - Geocoding API for map cards 94 - - `/api/instagram`, `/api/reloadRecent`, `/api/update` - Additional data endpoints 97 + - `/api/reloadRecent`, `/api/update` - Additional data endpoints 95 98 96 99 ### Item Type 97 100