| 1 | # Docs.surf |
| 2 | |
| 3 |  |
| 4 | |
| 5 | A monorepo for indexing and displaying [Standard.site](https://standard.site) documents from the AT Protocol, powered by Cloudflare Workers, D1, and Queues. |
| 6 | |
| 7 | **Components:** |
| 8 | |
| 9 | 1. **Tap Indexer** (External) - Subscribes to the AT Protocol firehose and sends webhook events |
| 10 | 2. **Server** (`packages/server`) - Cloudflare Worker with Hono API, D1 database, and Queue consumer |
| 11 | 3. **Client** (`packages/client`) - Vite + React app deployed to Cloudflare Pages |
| 12 | |
| 13 | ## Local Development |
| 14 | |
| 15 | 1. Start the worker locally: |
| 16 | |
| 17 | ```bash |
| 18 | bun run dev:server |
| 19 | ``` |
| 20 | |
| 21 | The API will run on `http://localhost:8787`. |
| 22 | |
| 23 | 2. Start the client (in a separate terminal): |
| 24 | |
| 25 | ```bash |
| 26 | bun run dev:client |
| 27 | ``` |
| 28 | |
| 29 | The client will run on `http://localhost:5173`. |
| 30 | |
| 31 | ## How It Works |
| 32 | |
| 33 | 1. **Tap** subscribes to the AT Protocol firehose and filters for `site.standard.document` records |
| 34 | 2. **Webhook** receives events and stores record references in D1, then pushes to the resolution queue |
| 35 | 3. **Queue consumer** resolves each document (PDS lookup → record fetch → publication URL) and stores in `resolved_documents` |
| 36 | 4. **Cron job** (every 15 min) refreshes stale documents and processes any missed records |
| 37 | 5. **`/feed` endpoint** reads directly from `resolved_documents` for instant responses |
| 38 | |
| 39 | ## Resources |
| 40 | |
| 41 | - [tap Documentation](https://github.com/bluesky-social/indigo/tree/main/cmd/tap) |
| 42 | - [AT Protocol Specs](https://atproto.com/) |
| 43 | - [Cloudflare Workers](https://developers.cloudflare.com/workers/) |
| 44 | - [Cloudflare D1](https://developers.cloudflare.com/d1/) |
| 45 | - [Cloudflare Queues](https://developers.cloudflare.com/queues/) |
| 46 | - [Hono Documentation](https://hono.dev/) |
| 47 | |
| 48 | ## License |
| 49 | |
| 50 | MIT |