Something went wrong. Try again.
An entry for the streamplace vod showcase
Something went wrong. Try again.
1 folder · 3 files
README.md
Streamhut AppView #
Work in Progress: This component is under active development and not yet deployed to production.
Video indexer for AT Protocol. Crawls registered creators and maintains a searchable index of place.stream.video records.
How It Works #
- Register creators - Add DIDs of accounts that have video content
- Crawl repos - Fetch
place.stream.videorecords from their PDSes - Index to Turso - Store video metadata in SQLite (via Turso)
- Cache locally - Write
video.jsonto shared cache for VOD bundle - Scheduled sync - Background job keeps index fresh every 15 minutes
Setup #
1. Create Turso Database #
# Install Turso CLI
brew install tursodatabase/tap/turso
# Login
turso auth login
# Create database
turso db create streamhut-appview
# Get connection info
turso db show streamhut-appview --url
turso db tokens create streamhut-appview
2. Configure Secrets #
Set these as at-run secrets for your bundle:
TURSO_URL- Database URL (e.g.,libsql://streamhut-appview-xxx.turso.io)TURSO_AUTH_TOKEN- Auth token from Turso
3. Deploy #
npm run deploy:appview
4. Initialize Schema #
curl -X POST https://your-runner/bundle/.../streamhut-appview/latest/init
5. Register Creators #
# Register stream.place (has AtmosphereConf videos)
curl -X POST https://your-runner/bundle/.../streamhut-appview/latest/registerCreator \
-H "Content-Type: application/json" \
-d '{"did":"did:plc:rbvrr34edl5ddpuwcubjiost"}'
Endpoints #
Setup #
| Method | Endpoint | Body | Description |
|---|---|---|---|
| POST | /init |
{} |
Create database tables |
Creator Management #
| Method | Endpoint | Body | Description |
|---|---|---|---|
| POST | /registerCreator |
{"did":"did:..."} |
Add creator and sync |
| POST | /unregisterCreator |
{"did":"did:..."} |
Remove creator and videos |
| POST | /getCreatorInfo |
{"did":"did:..."} |
Get creator details |
| POST | /listRegisteredCreators |
{} |
List all creators |
Video Queries #
| Method | Endpoint | Query Params | Description |
|---|---|---|---|
| GET | /listVideos |
limit, cursor, creator |
List indexed videos |
| GET | /getStats |
- | Get counts |
Sync #
| Method | Endpoint | Body | Description |
|---|---|---|---|
| POST | /triggerSync |
{} or {"did":"..."} |
Manual sync |
Background Job #
syncAllCreators - Runs every 15 minutes
- Fetches list of registered creators from Turso
- Crawls each creator's repo via their PDS
- Upserts videos to database
- Writes
video.jsonto/tmp/vod-cache/for VOD bundle
Schema #
CREATE TABLE creators (
did TEXT PRIMARY KEY,
added_at TEXT DEFAULT (datetime('now')),
last_synced_at TEXT
);
CREATE TABLE videos (
uri TEXT PRIMARY KEY,
creator_did TEXT NOT NULL,
title TEXT NOT NULL,
duration INTEGER NOT NULL, -- nanoseconds
created_at TEXT NOT NULL,
indexed_at TEXT DEFAULT (datetime('now'))
);
Development #
# Build bundle
npm run bundle:appview
# Watch mode
bun build --watch apps/appview/src/index.ts --bundle --target=browser --outfile=apps/appview/dist/bundle.js
Files #
apps/appview/
├── src/
│ ├── index.ts # Bundle manifest, endpoints, job
│ ├── db.ts # Turso database queries
│ └── crawler.ts # Repo crawling logic
├── schema.sql # Database schema reference
└── README.md