How to convert a desktop app into a web app? lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- tatamata · 2018-07-25 06:58 A have never done any web application, so please excuse me if my question is stupid, is there a simple way to convert a Lazarus desktop application into a web application? ---------------------------------------------------------------------- marcov · 2018-07-25 08:11 Other than approach through a webbased terminal server: no. it sounds like you have a lot of reading to do. ---------------------------------------------------------------------- valdir.marcos · 2018-07-25 19:01 Quote from: tatamata on July 25, 2018, 08:58:20 amA have never done any web application, so please excuse me if my question is stupid, is there a simple way to convert a Lazarus desktop application into a web application?None that I know. Take a look on these videos to have an idea of what a web application might be: HTML 5, CSS 3, PHP , Jquery, Ajax website design (E.commerce) - Younes RM https://www.youtube.com/playlist?list=PLQsP7Ksoaqq1JZQqd3K2O5a5ic9R5TU Qq There are many languages, frameworks and technologies you could choose from, including Pascal CGIs: CGI (Common Gateway Interface). https://en.wikipedia.org/wiki/Common_Gateway_Interface Object Pascal para Web - aula 00 - Zendrael https://www.youtube.com/watch?v=wRRDjQk9kjM Formulario de cadastro simples para web com Lazarus e fcl-Web - ANDERSON JUNIOR GADO DA SILVA https://www.youtube.com/watch?v=iZNx-44Rtn8 I have been consulting for teams that develop only desktop, desktop + web, desktop + mobile, desktop + web + mobile. And teams that decided to migrate from desktop to web, to mobile, and to web + mobile. It's not easy at all. It demands a lot of hard work keeping everything fast, UX and UI high quality, integrated and making sense. ---------------------------------------------------------------------- valdir.marcos · 2018-07-25 19:07 Some extra information just in case you decide to keep Pascal for everything: FCGI (FastCGI) step by step, using fpweb/fcl-web for Windows/Linux https://forum.lazarus.freepascal.org/index.php/topic,13312.0.html ---------------------------------------------------------------------- soerensen3 · 2018-07-25 22:00 What exactly do you mean by web application? Web application can be an application that is run on the server as a service or on demand like php. A web application can also be a desktop application that is run on the client only (usually in a browser or a plugin). If not for the plugin it is usually a website that uses java script so you have to convert your project to java script. Where probably pas2js is your best choice but there might be other ways. Don't expect your application to just work out of the box. The interface of a website is usually very different from a desktop application. There was another thread about using electron (A JS framework for a user interface) with lazarus I think. In theory you can even generate java byte code with fpc but I only read that and I don't know the status of that. However the browser must allow to call jar files and java vm must be installed on the client. If you want to address a big mass of users this is probably not a good idea. ---------------------------------------------------------------------- lainz · 2018-07-25 22:05 You can! But you need to learn new stuff. There is no automatic conversion. Basically you can port your application but not convert. ---------------------------------------------------------------------- Chronos · 2018-07-26 15:11 The question is natural as we all need to build applications for desktop, web and mobile. And it would be really nice to keep just one code for all those targets. But the ultimate solution to build such universal application is not easy task and it would take lots of time to develop. There are many differences between platforms and such framework would need to generalize and abstract from all of them. For example LCL would need a new widgetset which would be web server generating HTML, CSS and Javascript. Not all components would be fully supported. Also classic desktop applications are designed as single user, while web applications are designed as multi-user and client- server connection needs to be basically stateless and state needs to be kept using cookies and other means. But it should be feasible. There are some solutions like https://www.xojo.com/ which tries to target Desktop, mobile and web. I would like to see FPC/Lazarus moving in similar direction. But there aren't enough programmers to work on this huge task. Lazarus/FPC can't even simply target Android and iOS mobile platforms. So for the web we need to implement own CGI or web server without any web page design-time support from IDE. So for now, no, you can't simply convert Lazarus desktop application to web application. ---------------------------------------------------------------------- tatamata · 2018-07-27 05:30 Thank you all for answers. Is there any way to embed a Lazarus desktop app into a simple web app, so that it appears as if it was a web app? Or some kind of application virtualization that can expose a desktop application via internet? ---------------------------------------------------------------------- fred · 2018-07-27 07:19 This is for Delphi to change from desktop to web with one line they say, Thinfinity VirtualUI. I do not have a recent Delphi so can't test it. I think they create a virtual desktop on a server which you can access. Would be nice for Lazarus... https://www.cybelesoft.com/delphi-web/ ---------------------------------------------------------------------- sash · 2018-07-29 22:19 Quote from: tatamata on July 27, 2018, 07:30:09 amexpose a desktop application via internet? In my time they called it "download link". Ok, RDP server will work too. ---------------------------------------------------------------------- egsuh · 2018-07-30 05:56 ActiveX would have been the nearest.  But probably only within Internet Explorer. I'm not sure whether it is still supported. If you want your application to communicate to webserver, it is possible via webservice. ---------------------------------------------------------------------- marioluna · 2019-05-29 13:52 Quote from: fred on July 27, 2018, 09:19:11 amThis is for Delphi to change from desktop to web with one line they say, Thinfinity VirtualUI. https://www.cybelesoft.com/delphi-web/ Hi Fred! You happened to land on the Delphi page, but VirtualUI can conver almost any PC-based app into HTML5 to be served on a web browser. Here you have the tutorial page that lists many examples, including a Lazarus one: https://www.cybelesoft.com/thinfinity/virtualui/tutorials/ ---------------------------------------------------------------------- fred · 2019-06-03 10:26 Yes I see it now, thank you. Sadly at my work they started using M$ PowerApps... ---------------------------------------------------------------------- zamronypj · 2019-08-12 02:09 Converting desktop application into web application is not an easy task. It may require a complete redesign. If the goal is just to be able to run desktop application over network, you can try running application over virtual desktop infrastructure, such as Citrix, which allow users to remotely access a desktop application on other remote machine from a web browser. It will be much slower but it works. ---------------------------------------------------------------------- ASBzone · 2019-08-12 02:17 Quote from: tatamata on July 25, 2018, 08:58:20 amA have never done any web application, so please excuse me if my question is stupid, is there a simple way to convert a Lazarus desktop application into a web application? As long as the following is part of the requirement, I'm going to say that the most accurate answer is "NO" --- "a simple way to convert" Moving away from the theoretical, it really depends on what the app does today, and what technologies it uses.  But there is no easy way to simply convert apps from one modality to another (certainly not both easy and inexpensive) unless they were designed to be in both modalities. ---------------------------------------------------------------------- trev · 2019-08-12 03:05 It's been 20 odd years since I last used Delphi 5 and webbroker (required Delphi Pro version), but it was fairly trivial at the time to convert my various tax calculator programs to run as ISAPI DLLs under the IIS webserver. I'm not sure Lazarus has anything equivalent... (The calculators were originally distributed in DynaText ebooks on CDROM, but the company moved to also using the DynaWeb webserver for DynaText ebooks, hence the need for both desktop and web calculators.) ---------------------------------------------------------------------- Thaddy · 2019-08-12 07:04 Well, ISAPI can be done in Freepascal too, although not with components, but based on classes or procedural code. You write: "fairly trivial" so I suppose the logic is already sufficiently separated from the user interface? In that case there are many more modern libraries/web techniques available too. Ludo Schmal has a good introduction how to do it in Freepascal here: https://www.gocher.me/ISAPI with examples how to use the ISAPI extensions. (in German) TMS has a good (commercial) library built on top of the pastojs transpiler with good UI web components for Lazarus and Pas2js can already be used with many JavaScript web UI libraries. In a company setting I would recommend the above: the cost is fairly low and it is a reputable company with usually high quality code.. https://www.tmssoftware.com/site/tmswebcoreintro.asp You can ask for the Lazarus version (I believe they are working on it) They are also often on this forum. ---------------------------------------------------------------------- trev · 2019-08-13 00:11 Quote from: Thaddy on August 12, 2019, 09:04:44 amWell, ISAPI can be done in Freepascal too, although not with components, but based on classes or procedural code. You write: "fairly trivial" so I suppose the logic is already sufficiently separated from the user interface? Yes, the logic was well separated from the UI, in part due to my having previously written an SGML publishing system for print, CD and web for the editorial department on a Sun SPARCstation 5 running the CERN webserver for the front-end UI, Bourne shell scripts for the logic and RCS for the CMS. QuoteIn that case there are many more modern libraries/web techniques available too. Ludo Schmal has a good introduction how to do it in Freepascal here: https://www.gocher.me/ISAPI with examples how to use the ISAPI extensions. (in German) TMS has a good (commercial) library built on top of the pastojs transpiler with good UI web components for Lazarus and Pas2js can already be used with many JavaScript web UI libraries. Very interesting, and useful information for those contemplating desktop-web convergent programs. However, these days I'm just a simple hobbyist having retired from being a lawyer/author/programmer $working$ for commercial and not-for-profit  legal publishing entities.