Moving existing functionality from Jira Cloud to Jira Server

Hi all,
we have built a plugin for Jira Cloud and wish to make it possible to use this plugin on Jira Server too.
Is there some sort of easy way to do it?

I see found out 2 options for now:

  1. Just go by guidelines and actually rewrite whole application from scratch. It feels like not right way
  2. Try to use microservice approach like presented here: Build a JIRA Server Add-on as a Microservice - You Can Do It! - AtlasCamp 2017 - YouTube
    It looks like an easier way to provide already existing functionality, but there is no really documentation about this topic, only this presentation. So it feels very risky.

Is there some sort of right way?
Will be very thankful for any comments.