Adding Plugins to Mastodon

Plugins could be a great way to encourage further development on Mastodon while releasing core developers from having to maintain every feature in use in the ecosystem.

My question is, has anyone created designs or is anyone familiar with how best to add plugins to a system like Mastodon? I see in RubyOnRails that some use Engines to accomplish what’s done in plugins but have also heard of Railties being used.

For my part, I’d like to create a system where features can be more easily turned on or off and a plugin would seem to make sense for this, at least in the case where some new feature is going to be turned on.