@grishka the way I do it in littr.me:
1. Aggregating recipients:
To: if the activity is in reply to another Object, I add that Object's author
CC: the explicitly at-mentioned actors
CC: the author's followers collection
2. Disseminating to local recipients.
From the list above I get all local actors. Things that are local collections are dereferenced and the local actors are kept.
The resulting list receives a copy of the activity in their inboxes.
@mariusor local recipients is another story. My internal database structure has nothing at all similar with ActivityPub, it instead follows user-facing presentation.
The primary problem I want to solve is that in Mastodon world, only the instance that hosts the post has a complete list of accounts that liked it. It's a bit better with reply threads, but boosts break everything, and, again, because of how mentions work here, only the OP instance has the complete threads.