Document Feeds#
A monorepo for indexing and displaying Standard.site documents from the AT Protocol, powered by Cloudflare Workers, D1, and Queues.
Architecture#
┌─────────────────────────────────────────────────────────────┐
│ Cloudflare │
├─────────────────────────────────────────────────────────────┤
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌─────────────┐ │
│ │ Pages │────▶│ Worker │────▶│ D1 │ │
│ │ (Client) │ │ (API) │ │ (Database) │ │
│ └──────────────┘ └──────────────┘ └─────────────┘ │
│ ▲ ▲ │
│ │ │ │
│ ┌──────┴───────┐ ┌──────┴───────┐ │
│ │ Queue │ │ Cron │ │
│ │ (Resolver) │ │ (Refresh) │ │
│ └──────┬───────┘ └──────────────┘ │
│ │ │
└──────────────────────────────┼──────────────────────────────┘
│ POST /webhook/tap
┌──────────┴───────────┐
│ Tap Instance │
│ (External) │
└──────────────────────┘
Components:
- Tap Indexer (External) - Subscribes to the AT Protocol firehose and sends webhook events
- Server (
packages/server) - Cloudflare Worker with Hono API, D1 database, and Queue consumer - Client (
packages/client) - Vite + React app deployed to Cloudflare Pages
Local Development#
- Start the worker locally:
bun run dev:server
The API will run on http://localhost:8787.
- Start the client (in a separate terminal):
bun run dev:client
The client will run on http://localhost:5173.
API Endpoints#
Health & Stats#
| Endpoint | Method | Description |
|---|---|---|
/health |
GET | Health check |
/stats |
GET | Database statistics |
Feed Endpoints#
| Endpoint | Method | Description |
|---|---|---|
/feed |
GET | Pre-resolved documents (fast) |
/feed-raw |
GET | Raw record references (for client-side resolution) |
/records/:did |
GET | Records by DID |
Webhook#
| Endpoint | Method | Description |
|---|---|---|
/webhook/tap |
POST | Receives events from tap |
/webhook/tap/debug |
POST | Debug endpoint (echoes payload) |
Admin#
| Endpoint | Method | Description |
|---|---|---|
/admin/resolve-all |
POST | Queue unresolved records for processing |
How It Works#
- Tap subscribes to the AT Protocol firehose and filters for
site.standard.documentrecords - Webhook receives events and stores record references in D1, then pushes to the resolution queue
- Queue consumer resolves each document (PDS lookup → record fetch → publication URL) and stores in
resolved_documents - Cron job (every 15 min) refreshes stale documents and processes any missed records
/feedendpoint reads directly fromresolved_documentsfor instant responses
Resources#
- tap Documentation
- AT Protocol Specs
- Cloudflare Workers
- Cloudflare D1
- Cloudflare Queues
- Hono Documentation
License#
MIT