A mirror of my personal monorepo's AT Proto tools
Go-based ATProto (Bluesky) ecosystem for firehose indexing, feed generation, and search.
cmd/indexer, pkg/indexer)Subscribes to Jetstream WebSocket, consumes firehose events, and indexes Bluesky records into ClickHouse. Tracks progress in Redis with cursor recovery for restarts.
cmd/feedgen, pkg/feed-generator)HTTP service providing Bluesky-compatible feed endpoints. Implements trending/hot feeds, label-based feeds (private communities), and static feeds. JWT and API key authentication.
cmd/search, pkg/search)HTTP service for search, statistics, and repository maintenance. Provides site-wide analytics, stats caching, and cleanup operations.
# Start services (uses sops for secret decryption)
just common # Start Redis (and maybe Clickhouse)
just indexer # Start indexer
just feedgen # Start feed generator
just search # Start search service
# Stop services
just indexer-down
just feedgen-down
just search-down
just common-down
All services use multi-stage Docker builds. Binaries compile with CGO_ENABLED=0 GOOS=linux.
# Build locally
go build -o indexer ./cmd/indexer
go build -o feedgen ./cmd/feedgen
go build -o search ./cmd/search
# Run tests
go test ./...
ClickHouse schema is managed via migrations in pkg/migrate/migrations/. Full schema reference: ../../.claude/skills/clickhouse-analyst/references/databases/default/_full_schema.sql
# Migration commands
just migrate-up # Apply pending migrations
just migrate-down # Rollback last migration
just migrate-version # Show current version
just migrate-create foo # Create new migration files
just migrate-dump-schema # Regenerate full schema reference
| Table | Purpose |
|---|---|
repo_records | Raw firehose events (repo, collection, rkey, operation, record_json) |
posts | Post content (did, uri, text, langs, parent_uri, root_uri) |
follows | Social graph follow relationships |
likes | Post engagement |
reposts | Post sharing |
blocks | User blocking relationships |
actor_labels | Access control labels for private feeds |
daily_stats | Aggregated daily statistics |
api_keys | API authentication keys |
repo_cleanup_jobs | Maintenance job tracking |
recent_posts - Posts from last 72 hoursrecent_posts_with_score - Trending posts with engagement scoringfollowing_counts - User following statisticsdaily_stats_* - Materialized views for daily aggregations| Package | Location | Purpose |
|---|---|---|
| Store | pkg/indexer/store/ | ClickHouse operations (batch inserts, feeds, labels, auth, stats) |
| Feeds | pkg/feeds/ | Feed implementations (hot, authorlabel, static) |
| Auth | pkg/auth/ | JWT + API key authentication |
| Endpoints | pkg/feed-generator/endpoints/ | Feed REST endpoints |
| Search Endpoints | pkg/search/endpoints/ | Search/stats REST endpoints |
Located in pkg/feeds/:
hot/feed.go): "whats-hot", "top-1h", "top-24h" - trending algorithm with Redis cachingauthorlabel/feed.go): "a-mpls", "cl-tqsp" - private/public community feeds based on actor labelsstatic/feed.go): "bangers", "at-bangers", etc. - pinned postsAll feeds implement the interface in pkg/feed-generator/feed.go.
Environment files in env/ (encrypted with sops):
indexer.env / indexer.enc.envfeedgen.env / feedgen.enc.envsearch.env / search.enc.envKey environment variables:
WS_URL - Jetstream WebSocket endpointREDIS_ADDRESS - Redis connectionCLICKHOUSE_ADDRESS, CLICKHOUSE_USERNAME, CLICKHOUSE_PASSWORD - ClickHouse connectionOTEL_EXPORTER_OTLP_ENDPOINT - OpenTelemetry endpointgithub.com/bluesky-social/indigo, github.com/bluesky-social/jetstreamgithub.com/ClickHouse/clickhouse-go/v2, github.com/redis/go-redis/v9github.com/labstack/echo/v4, github.com/samber/slog-echogo.opentelemetry.io/otel, local packages/telemetrydeleted UInt8 DEFAULT 0, queries filter on deleted = 0time_us column for ClickHouse deduplicationotel.Tracer("module-name")Go source code for Bluesky's atproto services.
The AT Protocol blogging platform
Self-hosted PLC mirror
A minimal implementation of a BlueSky Feed Generator in Go
A simplified JSON event stream for AT Proto
Notifies Mastodon accounts about new posts in the RSS feeds they follow
Your Brand Here!
50K+ engaged viewers every month
Limited spots available!
📧 Contact us via email🦋 Contact us on Bluesky