Jira connect app for on jira server setup

Hi all,
While installing Jira connect app with on Jira server setup its failed with

Could not install the file https:///atlassian-connect.json. Check that the file is valid.

same works fine on jira cloud setup.

Do this connect app works on jira server as it is or not ?
Any help is appreciated

Welcome to the Atlassian developer community @MayankPande,

No. Atlassian Connect does not work on Jira Server. Connect Apps are for Jira Cloud only.

So need to develop two separate apps? for Jira server and jira cloud ?
I am kind of lost in all documentation with Atlassian SDK for the Jira server and connect/forge for the Jira cloud.

Can anyone please help with what is the correct/ideal way to create an app that works on both the Jira server and the Jira cloud?

Yes, you need two separate apps.

The frameworks Cloud and DC have for supporting apps are totally different, and in no way compatible (the apps have to work totally differently)

You may be able to reuse logic or even code from your first app in the second, but the apps will have to be totally different.

It is better to think of them as separate apps, even if they provide broadly the same functionality.