I know Jira Server will be discontinued soon, but data center will be still on the wild with cloud. So my question is:
if i create a plugin for cloud, can be reused for data center, or most of features are internally different and i should create 2 different plugins for the same thing?
Reasonable people will disagree with me because there are Marketplace vendors here who have built for both, with shared code. While possible, I consider it difficult and Atlassian provides no guidance on the matter. When I advise “technology partners”, I explain how the 2 products are diverging at the level of both API and UI. That means whatever overlap does exist is shrinking and will be a constant struggle to maintain for both. In short, I recommend treating Cloud vs Data Center as if they were different products.
You can definitely do it BUT it is very different between the platforms. Cloud is an integration platform - P2 is a plug-in framework - that’s just on the backend of things. (Ie for Cloud you have to build the auth, the db etc - you’re integrating your app with atlasian. For Server you don’t but have to deal with the atlassian database etc - you’re plugging into the atlassian app).
Then you have the front end. While the ui is pretty easy nowadays - use atlaskit and in 95% of the cases you’ll be fine. But when you’re not - it’s painful.
If you’re still in the product planning stage - start with the cloud version and keep the front end separate from the backend. Use something like lagomFetch - a library to abstract out http requests (blatant plug ) to abstract out the http calls. You’ll have to do something similar for any other AP calls you might do.
Then once you’ve got the cloud version - you’ll need to backport any logic you’ve implemented on your backend to p2 logic.
In the end you’ll get a good start but the apps will start to deviate quickly and keeping them in sync is a constant effort.
I feel flattered to be called reasonable. Many will disagree with that qualification of my character
Anyway, we built all our apps Cloud first and port them to Server/DC as soon as they start gaining traction. We can do that with relative ease because our Cloud and Server apps share ~95% of the code base.
However, we made some significant investments to achieve this. In short, all business logic is on the front-end. The back-end only consists of an API for basic CRUD (with authentication). There is no logic involved. The front-end is based on IoC principle with dependency injection. This allows us to create abstract logic for most operations and inject detailed implementations for each platform.
In addition, the front-end is built to only work with Atlassian Connect Javascript API. This means running all server code in iframe with an Atlassian Connect AP & host polyfill. Doing this has significantly reduced a lot of bugs concerning Velocity and possible javascript module collisions.
If you’re serious for long-term support of both Cloud and Server/DC, I think this is a worthwhile investment.