A minimal implementation of a BlueSky Feed Generator in Go
A minimal implementation of a BlueSky Feed Generator in Go
To run this feed generator, all you need is docker
with docker-compose
.
Start up the feed generator by running: make up
This will build the feed generator service binary inside a docker container and stand up the service on your machine at port 9032
.
To view a sample static feed (with only one post) go to:
Update the variables in .env
when you actually want to deploy the service somewhere, at which point did:plc:replace-me-with-your-did
should be replaced with the value of FEED_ACTOR_DID
.
This service exposes the following routes:
/.well-known/did.json
pkg/gin/endpoints.go:GetWellKnownDID()
/xrpc/app.bsky.feed.getFeedSkeleton
feed
, cursor
, and limit
pkg/gin/endpoints.go:GetFeedSkeleton()
/xrpc/app.bsky.feed.describeFeedGenerator
pkg/gin/endpoints.go:DescribeFeeds()
Once you've got your feed generator up and running and have it exposed to the internet, you can publish the feed using the script from the official BSky repo here.
Your feed will be published under your DID and should show up in your profile under the feeds
tab.
This repo is structured to abstract away a Feed
interface that allows for you to add all sorts of feeds to the router.
These feeds can be simple static feeds like the pkg/feeds/static/feed.go
implementation, or they can be much more complex feeds that draw on different data sources and filter them in cool ways to produce pages of feed items.
The Feed
interface is defined by any struct implementing two functions:
type Feed interface {
GetPage(ctx context.Context, feed string, userDID string, limit int64, cursor string) (feedPosts []*appbsky.FeedDefs_SkeletonFeedPost, newCursor *string, err error)
Describe(ctx context.Context) ([]appbsky.FeedDescribeFeedGenerator_Feed, error)
}
GetPage
gets a page of a feed for a given user with the limit and cursor provided, this is the main function that serves posts to a user.
Describe
is used by the router to advertise what feeds are available, for foward compatibility, Feed
s should be self describing in case this endpoint allows more details about feeds to be provided.
You can configure external resources and requirements in your Feed implementation before Adding
the feed to the FeedRouter
with feedRouter.AddFeed([]string{"{feed_name}"}, feedInstance)
This Feed
interface is somewhat flexible right now but it could be better. I'm not sure if it will change in the future so keep that in mind when using this template.
Go source code for Bluesky's atproto services.
A simplified JSON event stream for AT Proto
ATproto PDS indexer
Simple golang firehose for Bluesky.
Bluesky Bot library in Go
A handful of Go-based tools for poking around with BlueSky using the AT Protocol
Your Brand Here!
50K+ engaged viewers every month
Limited spots available!
📧 Contact us via email🦋 Contact us on Bluesky