Wiring Up
ActivityPubService is the central struct. Build it once at startup, share it via Arc.
Build the service
The base URL ("https://example.com") is used for all AP URLs the library generates — actor IDs, inbox URLs, collections. It must match the public URL of your service.
All seven setters are required. Calling .build() before any of them panics with a descriptive message.
Mount on axum
service.router() registers 7 routes. See Routes Reference for the full list and the content negotiation pattern for actor/followers/following.
Optional builder settings
| Method |
Default |
Description |
.allow_registration(bool) |
false |
Reported in NodeInfo openRegistrations |
.software_name(&str) |
"" |
Reported in NodeInfo software.name |
.delivery_max_attempts(u32) |
3 |
Max retry attempts per delivery |
.delivery_initial_delay_secs(u64) |
1 |
Initial backoff before first retry (doubles each attempt) |
.event_publisher(Arc<dyn EventPublisher>) |
in-process spawn |
Route delivery/backfill through a job queue |
.debug(bool) |
false |
Enable debug mode in activitypub_federation |
Real-world examples
Both implement all seven traits on a single Arc<Db> struct:
thoughts — microblogging; one of the sources k-ap was extracted from
movies-diary — movie logging; the other source