3

We want to launch a new open source project that will present as a Desktop app. We want to use Java Spring for business logic (backend) and Flutter to build the GUI (As we may create mobile and web applications).

The idea is that user has the choice to use its Flutter desktop app as standalone (business logic processed locally with java spring) or to connect its desktop app to an external server java spring that we provide (exactly the same processing features, just computation are done on OUR server).

Our initial idea is to just embed a Spring web server in the desktop app, that will launch and be used if user doesn't want to use our external server.

I feel this approach is overkilled. Why launching a web server locally just for 1 consumer (the desktop app itself)?

There should be a better approach... I made my researches but I found nothing, most solutions are to use front and back end solutions on same language (i.e, Flutter only application with business logic, or using Java Spring for backend and JavaFX for frontend) but we definitely want to avoid that and use both Flutter and Java Spring.

Maybe I am not addressing the right question. Does anyone can help me to achieve this goal or to better formulate my issue?

Many thanks !

  • Flutter has nothing to do with your question. Probably, you don't want Srping as backend, because Spring is overkill here. You should reconsider backend, maybe you need somethig less heavy. You can use any language for backend to create rest api and consume it in client app. – user1209216 Jul 07 '21 at 11:46
  • Hey @user1209216 ! You may be right, it can be useful to think the problem as general rather than focusing on the technologies I use. Btw, I am obliged to use these technologies (Spring + Flutter) for external reasons, so maybe some solutions exist in these specific frameworks. I also thought about MQ messages but it looks as overkill as creating a Rest API exposed by a web server. – Julien Elkaim Jul 07 '21 at 15:14
  • I am wondering how other desktop app creators do. I suppose some separate frontend and backend ! .... Maybe I should use the simple "web server" solution, and add restrictions on localhost clients only... But it seems not optimal. – Julien Elkaim Jul 07 '21 at 15:22
  • 1
    Do you mean you are forced to use Spring? So, use Spring. Locally or remotely. `Why launching a web server locally just for 1 consumer (the desktop app itself)?` That's the reason to not use Spring – user1209216 Jul 07 '21 at 17:12
  • So what other technology do you have in mind that avoid creating a web server ? – Julien Elkaim Jul 07 '21 at 18:24
  • You can look at this: https://www.c-sharpcorner.com/UploadFile/2b481f/self-hosting-in-Asp-Net-web-api/ – user1209216 Jul 08 '21 at 05:03

1 Answers1

2

What about using platform cannels? I think they are made for this. https://flutter.dev/docs/development/platform-integration/platform-channels

mipa
  • 10,369
  • 2
  • 16
  • 35
  • How is it related to question? – user1209216 Jul 07 '21 at 11:49
  • Direct Flutter to Java communication to avoid the overhead of a web server. – mipa Jul 07 '21 at 12:58
  • Hey @mipa, thank you for your help :) I did not know about platform channels! I checked documentation and articles on internet, and it seems it is useful to trigger platform-specific features (So using java on Android), but not designed to be connected with a Spring boot application running on Windows, Linux or MacOS for instance. Do you know an example of Flutter channels connecting to java but not on Android? – Julien Elkaim Jul 07 '21 at 15:29