What is a Labeler?
A Labeler is a service on the AT Protocol (Bluesky) that attaches labels to content. Labels can be used for moderation, content classification, and custom filtering. You should understand the Labeler concept before proceeding. Starter kits for other languages are also useful for reference. Sample implementation:Preparation
To run a Labeler you need:- A new Bluesky account dedicated to the Labeler — do not use your regular account.
- A new Laravel project dedicated to the Labeler — keeping projects separate is strongly recommended.
- A (sub)domain
- A production Linux server such as a VPS or AWS EC2. Laravel Cloud, Laravel Vapor, and Vercel will not work.
If you can only use a shared server, running a Labeler will not be practical.
Install additional packages
Configuration
First, generate a private key..env file.
Create a Labeler class
Create a class that extendsAbstractLabeler. You can place the file anywhere in your application.
Sample implementation: ArtisanLabeler.php
labels()
Returns the label definitions for your Labeler. The constants in the skyware starter kit are a useful reference.subscribeLabels()
Called immediately after a client connects via WebSocket. ReturnsSubscribeLabelResponse as an iterator.
emitEvent()
Called when a label is added or removed. ReturnsUnsignedLabel as an iterator.
saveLabel()
Persists a signed label to the database. Returns aSavedLabel.
createReport()
Called when a user submits an appeal or report.queryLabels()
Serves labels via the HTTP API instead of WebSocket. Bluesky itself does not use this endpoint; third-party clients do. Return an empty array if you don’t need it.Register the Labeler class in AppServiceProvider
Register your Labeler class inAppServiceProvider::boot().
Account setup
Initialize your account as a Labeler.Declare label definitions
Register your label definitions on the Labeler account.Additional commands
Delete label definitions:Running on Laravel Forge
Once SSL is enabled, configure the server using the instructions below.nginx configuration
Add threelocation blocks to the Forge nginx configuration.
Deploy script
Stop the Labeler server during deployment. Supervisor will restart it automatically afterward.Background process (daemon) configuration
On the Forge background process screen, select the Custom tab instead of the Queue Worker tab. Command:bluesky:ws or bluesky:firehose commands.
Adding labels
How you actually label content is entirely up to your application. The sample implementation uses Laravel’s event system to label users when they follow the Labeler account.Source: docs/labeler.md
Sample: invokable/laralabeler