From 8f620ce17733a5296bda34600507a4c18d17df4a Mon Sep 17 00:00:00 2001 From: Steve Date: Tue, 13 Jan 2026 03:59:38 +0000 Subject: [PATCH] chore: updated readme and added license --- LICENSE | 21 +++++++++++++++++++++ README.md | 117 +++++---------------------------------------------------------------------------------------------------------------- 2 file(s) changed, 26 insertion(s)(+), 112 deletion(s)(-) diff --git a/LICENSE b/LICENSE new file mode 100644 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Steve Simkins + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md --- a/README.md +++ b/README.md @@ -6,15 +6,15 @@ ``` ┌─────────────────────────────────────────────────────────────┐ -│ Cloudflare │ +│ Cloudflare │ ├─────────────────────────────────────────────────────────────┤ -│ │ +│ │ │ ┌──────────────┐ ┌──────────────┐ ┌─────────────┐ │ │ │ Pages │────▶│ Worker │────▶│ D1 │ │ │ │ (Client) │ │ (API) │ │ (Database) │ │ │ └──────────────┘ └──────────────┘ └─────────────┘ │ -│ ▲ ▲ │ -│ │ │ │ +│ ▲ ▲ │ +│ │ │ │ │ ┌──────┴───────┐ ┌──────┴───────┐ │ │ │ Queue │ │ Cron │ │ │ │ (Resolver) │ │ (Refresh) │ │ @@ -24,7 +24,7 @@ │ POST /webhook/tap ┌──────────┴───────────┐ │ Tap Instance │ - │ (External VPS) │ + │ (External) │ └──────────────────────┘ ``` @@ -33,72 +33,6 @@ 1. **Tap Indexer** (External) - Subscribes to the AT Protocol firehose and sends webhook events 2. **Server** (`packages/server`) - Cloudflare Worker with Hono API, D1 database, and Queue consumer 3. **Client** (`packages/client`) - Vite + React app deployed to Cloudflare Pages - -## Quick Start - -### Prerequisites - -- [Bun](https://bun.sh) installed -- [Wrangler CLI](https://developers.cloudflare.com/workers/wrangler/) installed and authenticated -- A tap instance running somewhere (VPS, Fly.io, etc.) - -### Setup - -1. Install dependencies: - -```bash -bun install -``` - -2. Create the D1 database: - -```bash -bun run db:create -``` - -Copy the database ID and update `packages/server/wrangler.toml`. - -3. Create the queue: - -```bash -wrangler queues create document-resolution -``` - -4. Run database migrations: - -```bash -# Local development -bun run db:migrate - -# Production -bun run db:migrate:prod -``` - -5. (Optional) Set webhook secret: - -```bash -bun run secret:set -``` - -6. Deploy the worker: - -```bash -bun run deploy -``` - -7. Configure your tap instance: - -```bash -TAP_WEBHOOK_URL=https://your-worker.workers.dev/webhook/tap -TAP_SIGNAL_COLLECTION=site.standard.document -TAP_COLLECTION_FILTERS=site.standard.document -``` - -8. Trigger initial resolution of existing records: - -```bash -curl -X POST https://your-worker.workers.dev/admin/resolve-all -``` ## Local Development @@ -155,47 +89,6 @@ 3. **Queue consumer** resolves each document (PDS lookup → record fetch → publication URL) and stores in `resolved_documents` 4. **Cron job** (every 15 min) refreshes stale documents and processes any missed records 5. **`/feed` endpoint** reads directly from `resolved_documents` for instant responses - -## Project Structure - -``` -. -├── package.json # Root workspace config -└── packages/ - ├── server/ # Cloudflare Worker - │ ├── wrangler.toml # Worker configuration - │ ├── schema.sql # D1 database schema - │ ├── package.json - │ └── src/ - │ └── index.ts # API + Queue consumer + Cron handler - └── client/ # Vite + React app - ├── package.json - ├── vite.config.ts - └── src/ - ├── main.tsx - └── App.tsx -``` - -## Scripts - -```bash -# Development -bun run dev # Run all packages in dev mode -bun run dev:server # Run worker locally -bun run dev:client # Run client locally - -# Deployment -bun run deploy # Deploy worker to Cloudflare -bun run deploy:client # Deploy client to Cloudflare Pages - -# Database -bun run db:create # Create D1 database -bun run db:migrate # Run migrations (local) -bun run db:migrate:prod # Run migrations (production) - -# Secrets -bun run secret:set # Set TAP_WEBHOOK_SECRET -``` ## Resources -- tangled.sh