The only pointer I can give, is that you would probably want to use ActivityPub for the federation protocol, and you could potentially look at Mastodon's implementation of that, since it's also implemented in Ruby On Rails.
Mind that there can be differences in how the federation should work, for example Mastodon doesn't have post titles, which you would presumably want on a fan fiction site...