Web UI for Tap script discovery and distribution.
This app serves the public script catalog at tap.vaayne.com, exposes API routes for script lookup and sync, and stores script metadata plus usage events in Cloudflare D1.
- TanStack Start + React 19
- Cloudflare Workers
- Cloudflare D1
- Tailwind CSS v4
- Vite Plus / Vitest
- pnpm
- Browse and search available site scripts
- View script details and raw script content
- Expose sync endpoints for the CLI and
bb-sitesautomation - Record usage events for popularity ranking
web/
├── src/
│ ├── components/ # UI components
│ ├── lib/ # D1 access, auth, shared types, server fns
│ ├── routes/ # Pages and API routes
│ │ └── api/ # /api/search, /api/scripts, /api/sync, /api/batch, /api/usage
│ ├── router.tsx # TanStack router setup
│ └── styles.css # Global styles
├── migrations/ # D1 schema migrations
├── wrangler.jsonc # Cloudflare Worker + D1 config
├── vite.config.ts # Vite Plus + TanStack Start config
└── package.json
From the repo root:
cd web
pnpm install
pnpm devCommon commands:
pnpm dev # local dev server
pnpm build # production build
pnpm preview # preview built app
pnpm test # vitest
pnpm cf-typegen # regenerate Cloudflare types
pnpm deploy # build and deploy with wranglerD1 tables are defined in migrations/0001_init.sql.
scripts— canonical script metadata and sourceusage_events— raw usage reports used for popularity ranking
Apply local/remote D1 migrations with Wrangler as needed.
GET /api/search?q=&sort=&site=— search and filter scriptsGET /api/scripts/:name— fetch full script detailGET /api/scripts/:name/content— fetch raw JavaScript sourceGET /api/sync— sync manifest{ name, hash, updatedAt }POST /api/usage— report a script usage event
POST /api/batch— replace the script dataset in D1- Requires
X-Tap-Secretheader - Validates JSON payload and enforces a 500 KB limit
- Used by automation syncing from
bb-sites
- Requires
Important runtime config lives in web/wrangler.jsonc.
Current bindings/config:
DB— D1 database bindingTAP_SCRIPTS_SECRET— shared secret forPOST /api/batch- custom domain route for
tap.vaayne.com
For local development, provide any required Worker secrets with Wrangler.
- Prefer server functions in
src/lib/server-fns.tsfor app-facing data loading. - Keep DB access in
src/lib/db.ts. - API routes should stay thin and delegate validation/business logic to
lib/helpers. - Preserve compatibility with the Go CLI sync flow and the separate
bb-sitesrepo.
Also consider whether related docs need updates in:
README.mddocs/skills/tap-web/
Keep behavior and docs in sync when API routes, sync semantics, or D1 schema change.