The code for my Bluesky feed generator
Python 99.7%
Shell 0.3%
Other 0.1%
6 1 0

Clone this repository

https://tangled.org/ezraboeth.com/bsky-feed-generator
git@tangled.org:ezraboeth.com/bsky-feed-generator

For self-hosted knots, clone URLs may differ based on your setup.

README.md

ATProto Feed Generator powered by The AT Protocol SDK for Python#

Feed Generators are services that provide custom algorithms to users through the AT Protocol.

Official overview (read it first): https://github.com/bluesky-social/feed-generator#overview

Getting Started#

We've set up this simple server with SQLite to store and query data. Feel free to switch this out for whichever database you prefer.

Next, you will need to do two things:

  1. Implement filtering logic in server/data_filter.py.
  2. Copy .env.example to .env
  3. Optionally implement custom feed generation logic in server/algos.

We've taken care of setting this server up with a did:web. However, you're free to switch this out for did:plc if you like - you may want to if you expect this Feed Generator to be long-standing and possibly migrating domains.

Publishing your feed#

To publish your feed, simply run python publish_feed.py.

To update your feed's display data (name, avatar, description, etc.), just update the relevant variables in .env and re-run the script.

After successfully running the script, you should be able to see your feed from within the app, as well as share it by embedding a link in a post (similar to a quote post).

Running the Server#

Install uv.

Run the following to install python, create a virtual environment with uv, and install dependencies:

uv python install 3.12
uv python pin 3.12
uv venv --python 3.12
uv sync

Note: To get value for FEED_URI you need to publish the feed first

To run a development Flask server:

flask run

Warning The Flask development server is not designed for production use. In production, you should use production WSGI server such as waitress behind a reverse proxy such as NGINX instead.

uv add waitress
waitress-serve --listen=127.0.0.1:8080 server.app:app

To run a development server with debugging:

flask --debug run

Note: Duplication of data stream instances in debug mode is fine.

Warning: If you want to run server in many workers, you should run Data Stream (Firehose) separately.

Endpoints#

  • /.well-known/did.json
  • /xrpc/app.bsky.feed.describeFeedGenerator
  • /xrpc/app.bsky.feed.getFeedSkeleton

License#

MIT