Skyfeed
A library for quickly building bluesky feed generators.
Primarily uses, warp, and atrium api to greatly simplify the process of building a bluesky feed generator.
Quick Start
Create a .env file with the following variables:
Your DID.
This can be a little hard to track down - you can use this utility to check your DID
To run the my_did utility - clone this repo & run this command inside the crate directory
cargo run --bin my_did --handle <your handle> --app-password <app password>
PUBLISHER_DID="..."
The host name for your feed generator.
(In the URL https://github.com/cyypherus/skyfeed the host name is github.com)
You can develop your feed locally without setting this to a real value. However, when publishing, this value must be a domain that:
- Points to your service.
- Is secured with SSL (HTTPS).
- Is accessible on the public internet.
FEED_GENERATOR_HOSTNAME="..."
Once published, or while testing, your feed will be served at http://<host name>/xrpc/app.bsky.feed.getFeedSkeleton?feed=<feed name>.
Documentation on additional query parameters is available here.
Building a Feed
Let's build a simple feed generator about cats.
Note: In a real implementation storage should be implemented with a database such as sqlite for more efficient queries & persistent data. See the sqlite example
Implement the FeedHandler Trait
Your feed handler is responsible for storing and managing firehose input. For the sake of simplicity, we'll just use a Vec to manage posts and likes.
use ;
use ;
use Mutex;
Start your feed!
Now we can create an instance of our feed handler and start the server using the start() function with a Config.
async
Publish to BlueSky
This repo also contains publish (and unpublish) utilities for managing your feed's publicity.
To run these, clone this repo & run this command inside the crate directory
cargo run --bin publish
If you'd like to verify your feed server's endpoints locally before you publish, you can also use the verify utility.
Contributing
This repo uses cargo-public-api to snapshot test the public API.
If your PR changes the public API, one of the checks will fail by default.
If the changes to the public API were intentional you can update the snapshot by running:
UPDATE_SNAPSHOTS=yes cargo test --features test-api