mirror of
https://github.com/juherr/kill-the-news.git
synced 2026-06-20 22:03:48 +00:00
docs(claude): document the domain layer and FeedRepository KV access rule
Reflect the refactor: add the src/domain/ tree (feed-repository, feed, value objects), drop the deleted storage.ts, and update the KV-schema note to point at FeedRepository as the single key-access layer. Correct the websub key shape and add the icon: key. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -56,6 +56,10 @@ src/
|
|||||||
index.ts # App entrypoint: CORS, IP middleware, route mounting, email handler export
|
index.ts # App entrypoint: CORS, IP middleware, route mounting, email handler export
|
||||||
config/constants.ts # Shared constants (TTLs, limits)
|
config/constants.ts # Shared constants (TTLs, limits)
|
||||||
types/index.ts # Env, FeedConfig, EmailData, WebSubSubscription, etc.
|
types/index.ts # Env, FeedConfig, EmailData, WebSubSubscription, etc.
|
||||||
|
domain/ # Framework-agnostic core (no Hono/KV/R2 imports leak out)
|
||||||
|
feed-repository.ts # Single KV access layer: owns the key schema + all get/put
|
||||||
|
feed.ts # Feed aggregate invariants (expiry, sender policy, size budget)
|
||||||
|
value-objects/ # FeedId, EmailAddress, Domain (immutable, self-validating)
|
||||||
routes/
|
routes/
|
||||||
inbound.ts # ForwardEmail webhook handler
|
inbound.ts # ForwardEmail webhook handler
|
||||||
rss.ts # RSS feed renderer
|
rss.ts # RSS feed renderer
|
||||||
@@ -84,7 +88,6 @@ src/
|
|||||||
forwardemail.ts # ForwardEmail webhook types/parsing
|
forwardemail.ts # ForwardEmail webhook types/parsing
|
||||||
id-generator.ts # Feed/entry ID generation
|
id-generator.ts # Feed/entry ID generation
|
||||||
logger.ts # JSON structured logger
|
logger.ts # JSON structured logger
|
||||||
storage.ts # KV key helpers
|
|
||||||
websub.ts # WebSub subscription management
|
websub.ts # WebSub subscription management
|
||||||
worker.ts # Typed worker export helper
|
worker.ts # Typed worker export helper
|
||||||
scripts/
|
scripts/
|
||||||
@@ -106,15 +109,16 @@ src/
|
|||||||
All data lives in the `EMAIL_STORAGE` KV namespace:
|
All data lives in the `EMAIL_STORAGE` KV namespace:
|
||||||
|
|
||||||
| Key | Value |
|
| Key | Value |
|
||||||
| -------------------------------- | ------------------------------------------------------------------------ |
|
| --------------------------- | ------------------------------------------------------------------------ |
|
||||||
| `feeds:list` | `{ feeds: Array<{ id, title, description? }> }` |
|
| `feeds:list` | `{ feeds: Array<{ id, title, description? }> }` |
|
||||||
| `feed:<feedId>:config` | `FeedConfig` |
|
| `feed:<feedId>:config` | `FeedConfig` |
|
||||||
| `feed:<feedId>:metadata` | `{ emails: Array<{ key, subject, receivedAt, size?, attachmentIds? }> }` |
|
| `feed:<feedId>:metadata` | `{ emails: Array<{ key, subject, receivedAt, size?, attachmentIds? }> }` |
|
||||||
| `feed:<feedId>:<timestamp>` | Full `EmailData` |
|
| `feed:<feedId>:<timestamp>` | Full `EmailData` |
|
||||||
| `websub:<feedId>:<callbackHash>` | `WebSubSubscription` |
|
| `websub:subs:<feedId>` | `WebSubSubscription[]` (per-feed subscriber list) |
|
||||||
|
| `icon:<domain>` | Cached favicon record (base64 + content type; negative entries allowed) |
|
||||||
| `stats:counters` | `Counters` (cumulative monitoring counters singleton) |
|
| `stats:counters` | `Counters` (cumulative monitoring counters singleton) |
|
||||||
|
|
||||||
`src/lib/storage.ts` contains key-builder helpers — use them; don't inline key strings in routes.
|
`src/domain/feed-repository.ts` (`FeedRepository`) owns the KV key schema and all get/put access — go through it; never inline `feed:`/`feeds:list`/`websub:`/`icon:`/`stats:counters` key strings elsewhere.
|
||||||
|
|
||||||
### Worker bindings (`Env`)
|
### Worker bindings (`Env`)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user