What hollo does, you can do in Deno too. Keep the diplomatic floor plan as a shared blueprint (the builder), and several wings can reuse the same wiring—a model for where to put federation in an app that grows large.
inbox/mod.ts reads as a route map of verbs. Accept, Follow, Undo… an ambiguous verb is sorted by looking inside. The kinds of letters that arrive are all surveyable on a single sheet.
Highlights
- The shared inbox is /ap/inbox, the individual one /ap/actors/{identifier}/inbox. The identifier is an account's UUID, or the hostname of the instance itself
- The instance actor is an Application named "Hackers' Pub". A deleted resident becomes not null but a KeyedTombstone—at the end of the link, the shape of an absence remains
- The handlers are split into named functions—onPostCreated, onFollowed, onQuoteRequested—each with a companion test
A passage from the sutra
builder
.setInboxListeners("/ap/actors/{identifier}/inbox", "/ap/inbox")
.setSharedKeyDispatcher((ctx) => ({
identifier: new URL(ctx.canonicalOrigin).hostname,
}))
.onUnverifiedActivity(onUnverifiedActivity)
.on(Accept, async (fedCtx, accept) => {
if (await onQuoteRequestAccepted(fedCtx, accept)) return;
if (await onRelayFollowAccepted(fedCtx, accept)) return;
await onFollowAccepted(fedCtx, accept);
})