Effem AppView#
Custom AT Protocol AppView backend for Effem.
Scope Implemented#
- Custom Lexicon Definitions
- Go AppView Implementation
- Podcast Index Integration
- Database Schema
- XRPC API Endpoints
What This Service Does#
- Consumes AT Proto firehose events and indexes
xyz.effem.*records. - Stores social state and materialized social counters in PostgreSQL.
- Proxies and caches Podcast Index API calls (server-side API key/secret).
- Serves read endpoints for Effem social + podcast experience.
Project Layout#
cmd/effem-appview/: CLI entrypoint.appview/: server, firehose consumer, handlers, indexer, Podcast Index client/cache, database models/migrations.lexicons/xyz/effem/feed/: feed lexicons (defs,subscription,comment,recommendation,list,bookmark).lexicons/xyz/effem/actor/: actor lexicons (profile).
Local Run#
Prerequisites:
- Go 1.25+
- PostgreSQL
Run:
go mod tidy
EFFEM_AUTH_READ_TOKENS='dev-token=did:plc:localdev' \
EFFEM_CORS_ALLOWED_ORIGINS='http://localhost:3000' \
go run ./cmd/effem-appview --bind :8080
Verify:
curl -s localhost:8080/_health
Environment Variables#
Required for Podcast Index-backed endpoints:
EFFEM_PI_KEYEFFEM_PI_SECRET
Runtime configuration:
EFFEM_BIND(default:8080)EFFEM_DATABASE_URL(defaultpostgres://effem:effem@localhost:5432/effem?sslmode=disable)EFFEM_RELAY_HOST(defaultwss://bsky.network)EFFEM_PLC_HOST(defaulthttps://plc.directory)EFFEM_FIREHOSE_PARALLELISM(default5)EFFEM_AUTH_REQUIRED(defaulttrue)EFFEM_AUTH_READ_TOKENS(comma-separatedtoken=didpairs with read scope)EFFEM_AUTH_ADMIN_TOKENS(comma-separatedtoken=didpairs with admin scope)EFFEM_CORS_ALLOWED_ORIGINS(comma-separated origins; wildcard is rejected)EFFEM_RATE_LIMIT_ENABLED(defaulttrue)EFFEM_RATE_LIMIT_RPS(default5)EFFEM_RATE_LIMIT_BURST(default20)
Implemented Endpoint Groups#
xyz.effem.feed.*: subscriptions, subscribers, comments, comment thread, recommendations, popular, list(s), bookmarks, inboxxyz.effem.actor.*: profilexyz.effem.search.*: podcast and episode searchxyz.effem.podcast.*: podcast, episodes, episode, trending, categories- health:
/_health
Docker#
docker compose up --build
Production Status#
Current status: production hardening controls are implemented.
Implemented hardening:
- Authn/authz on
/xrpc/*endpoints (read/admin scopes, DID ownership checks on user-scoped endpoints). - Server-side rate limiting by authenticated principal (fallback to IP).
- Explicit CORS allowlist configuration (wildcard is blocked by config validation).
- Versioned SQL migrations with
schema_migrationstracking and checksum validation. - Automated Go tests for config, authz middleware, rate limiter, and migration loader.