[READ-ONLY] Mirror of https://github.com/flo-bit/contrail. atproto backend in a bottle flo-bit.dev/contrail/
0

Configure Feed

Select the types of activity you want to include in your feed.

README.md

Contrail — Cloudflare Workers Example#

A complete example of using Contrail to index AT Protocol calendar events and RSVPs on Cloudflare Workers + D1.

Setup#

# Copy this folder to a new project
cp -r examples/cloudflare-workers my-contrail-app
cd my-contrail-app

# Install dependencies
npm install

# Create a D1 database
npx wrangler d1 create contrail

Copy the database_id from the output into wrangler.jsonc.

Note: The contrail dependency installs from GitHub. This may take a minute on first install since it also pulls in the AT Protocol client libraries.

Configure#

Edit config.ts to define your collections, queryable fields, relations, and references. See the Contrail README for all options.

Develop#

# Discover users from relays and backfill their records
npm run sync

# Start the dev server (ingests from Jetstream every minute)
npm run dev

Your XRPC API is now available at http://localhost:8787:

# List events sorted by RSVP count
/xrpc/rsvp.atmo.event.listRecords?sort=rsvpsCount

# Upcoming events with 10+ going RSVPs
/xrpc/rsvp.atmo.event.listRecords?startsAtMin=2026-03-16&rsvpsGoingCountMin=10

# Single event with hydrated RSVPs and profiles
/xrpc/rsvp.atmo.event.getRecord?uri=at://...&hydrateRsvps=10&profiles=true

# Search events
/xrpc/rsvp.atmo.event.listRecords?search=meetup

# RSVPs for a specific event
/xrpc/rsvp.atmo.rsvp.listRecords?subjectUri=at://...

Deploy#

npm run deploy

# Sync against production D1
npm run sync:remote

Ingestion runs automatically via cron (*/1 * * * *).