misskey-dev / misskey

🌎 A completely free and open interplanetary microblogging platform 🚀
https://misskey-hub.net/
GNU Affero General Public License v3.0
10.03k stars 1.37k forks source link

Make misskey more extensible via plugins #9418

Open chualuoi opened 1 year ago

chualuoi commented 1 year ago

Summary

Since Misskey is aiming to be a widely-used all-purpose platform, it would be great to make it as extensible as possible so people can tailor it to their purpose without having to make changes to Misskey's source code.

I'm thinking we can achieve that via some plugin architecture similar to WordPress where plugin developers can hook into different part of the system to provide custom code. I'm aware that it's already possible now to create plugin on the frontend (although I'm not very familiar with it and not sure to what extend a plugin can customise the system). However, I don't think it's possible to create plugin in backend yet. For backend, we may consider using forrestjs or similar approach to create a WordPress-like plugin architecture.

@syuilo: If you're open to this idea, I'm happy to give it a try and create PR for it.

syuilo commented 1 year ago

The plug-ins are interesting, but even a cursory consideration raises the following questions

acid-chicken commented 1 year ago

Duplicate of #4529

chualuoi commented 1 year ago

Thanks for the feedback @syuilo. I have not spent a lot of time of this yet and not very familiar with Misskey (and even the tech stack) so the answers below may be naive.

How does a plugin extend the front end? How do I call a Misskey component from a plugin?

Can't we use the existing Plugin API? I think the features provided by API are still limited so we can consider extend that. Otherwise, I think we can organise Misskey frontend code as a UI design system and expose all the UI components so that it can used by custom plugins. There are multiple level of customisation on the UI and each may require different approach, e.g.

How does the plugin manage database migration?

I imagine each plugin will have its own migration folder if required and this will need to be passed to typeorm config.

How do I install or update a plugin?

The use case that I'm after right now is to allow the Misskey instance administrator to customise their instance and this will require some level of development. However, the goal is to keep all custom development outside of Misskey. For example, the instance admin (developer) can have the following code structure for their instance.

|- src
  index.ts (entrypoint to startup Misskey)
  |- misskey (git submodules)
  |- plugins
    |- pluginA
      index.ts
      |- migrations (plugin migration folder)
    |- pluginB
  ormconfig.js (include both Misskey migrations and plugin migrations)

Let me know what you think.