Responsibilities

  • Generate presigned upload keys and accept proxy uploads.
  • Consume queue events from R2 uploads and deletions.
  • Parse WhatsApp exports, deduplicate messages, and compute daily digests.
  • Generate weekly summaries and update D1.
  • Manage quotas, regeneration, and replay workflows.

Sources: beacon-platform/docs/architecture.md, beacon-platform/docs/operations.md


Core endpoints (admin)

PathMethodPurpose
/presignPOSTGenerate R2 upload key
/uploadPOSTProxy upload
/filesGET/DELETEList or delete exports
/exports/progressGETExport processing status
/clearPOSTCleanup digests/summaries/hashes
/regenerate/dailyPOSTRecompute daily digests
/regenerate/weeklyPOSTRecompute weekly summaries
/regenerate/weekly/allPOSTRecompute weekly summaries for all
/replay/exportPOSTRe-enqueue a single export
/replay/allPOSTRe-enqueue all exports
/quota/statusGETAI quota status
/quota/setPOSTUpdate AI quota settings
/quota/bypassGET/POSTEnable or disable bypass
/pipeline/daily-configGET/POSTDaily digest processing mode

Sources: beacon-platform/docs/architecture.md, beacon-platform/docs/operations.md


Processing flow

flowchart TD
  Upload -->|R2 ObjectCreated| Queue
  Queue --> Ingest
  Ingest --> Parse
  Parse --> Dedupe
  Dedupe --> DailyAI
  DailyAI --> DailyStore
  DailyStore --> WeeklyCheck
  WeeklyCheck -->|threshold met| WeeklyAI
  WeeklyAI --> WeeklyStore
  WeeklyCheck -->|below threshold| SkipWeekly

Sources: beacon-platform/docs/architecture.md


Deduplication

  • Content is normalized (case, whitespace, unicode normalization) before hashing.
  • Dedup key: (community_id, source_id, day_date, content_hash).
  • Sender hash enables unique sender counts without storing PII.

Sources: beacon-platform/docs/architecture.md, beacon-platform/docs/database-structure.md


AI and privacy

  • Messages are redacted for phones, emails, and URLs before AI.
  • Outputs must pass JSON schema and privacy regex checks.
  • One retry with stricter privacy instruction; fallback to neutral summary if still invalid.

Sources: beacon-platform/docs/privacy.md, beacon-platform/docs/architecture.md


Deletion and cleanup

  • /clear removes digests and summaries by date range (optionally hashes).
  • /communities/{id} deletes D1 records and R2 files for a community.
  • R2 ObjectDeleted events also trigger cleanup.

Sources: beacon-platform/AUDIT_REPORT.md, beacon-platform/infra/R2_EVENTS.md