Live data from Hacker News

Ask HN: How to create web, mobile, and desktop apps from a common code base?

news.ycombinator.com

21–30 of 30 posts

Re: Ask HN: How to create web, mobile, and desktop apps from a common code base?

#21
post #6
post #3

React Native. Why would you want a desktop app when it's already working in a browser? If you really want a desktop app, I would recommend using React for the web, React with Electron for desktop, and React with CapacitorJS for mobile.

I want the mobile and desktop versions to be able to operate in offline mode with a local database.

You can use the React + (Browser, Capacitor, Electron) stack to do this. I'd recommend against React Native. OP's suggestion is superior IMHO.

Re: Ask HN: How to create web, mobile, and desktop apps from a common code base?

#22
post #5

You could look into Flutter. It pretty much fits what you are looking for. I have tried it myself, but did not love it fwiw

This is what I went for after deciding against a web stack due to confusion over where even to start with it considering the ridiculous amount of competing frameworks. I also wanted a local first approach and didn't want to maintain a website. Happy with my choice though dart/flutter seem to be universally hated on HN.

Re: Ask HN: How to create web, mobile, and desktop apps from a common code base?

#23
post #5

You could look into Flutter. It pretty much fits what you are looking for. I have tried it myself, but did not love it fwiw

Flutter is great for hybrid app development but I am not sold on the web part yet.

That said, there is nothing that tackles iOS, Android and Web very well.

Re: Ask HN: How to create web, mobile, and desktop apps from a common code base?

#25
post #8

Earlier quoted context omitted.

Have you seen PWAs? https://www.google.com/search?q=pwa Websites already have access to offline storage via the localStorage API. When the user installs a PWA, it gets additional permissions which make it even more similar to a native app.

As a web dev, I'd recommend against this. They have pretty shitty UX and always feel like second class citizens... If you want your users to be happy, make a proper app

PWA tech has every building block needed to create a proper app besides the operator capable of creating the app

Re: Ask HN: How to create web, mobile, and desktop apps from a common code base?

#26

Earlier quoted context omitted.

As a web dev, I'd recommend against this. They have pretty shitty UX and always feel like second class citizens... If you want your users to be happy, make a proper app

PWA tech has every building block needed to create a proper app besides the operator capable of creating the app

They load slow, have poor menu bars, don't use native UI widgets, have unclear update/versioning systems, can't be on all app stores, have inferior notifications, etc.

How long have we been talking about them now as a replacement for native apps? I've still never seen one that's acceptable, much less equally good.

Re: Ask HN: How to create web, mobile, and desktop apps from a common code base?

#27
Highly recommend Tauri over Electron, if you are going to be using a web ui stack. Same kind of thing as Electron, just fresher so it's more streamlined (for now). It's Rust, but you can use extern libraries from most other languages, if you really need to.

https://tauri.app/

Re: Ask HN: How to create web, mobile, and desktop apps from a common code base?

#28
post #8
post #4

Earlier quoted context omitted.

One of the versions will be a website, but I want mobile and desktop versions to be able to operate in offline mode with a local database.

Have you seen PWAs? https://www.google.com/search?q=pwa Websites already have access to offline storage via the localStorage API. When the user installs a PWA, it gets additional permissions which make it even more similar to a native app.

Seconding the PWAs here, but I caution against thinking of it as an "either-or" situation.

If you're going to build an app that can be accessed in a browser from a url, there are only benefits to making it a PWA. Offline, local capabilities, wider native device access, first-class icon placement with mobile apps, and the simplest distribution network ever invented. Absolute win to make your app a PWA.

That said, it may lack some polish? I never had any issue with what they offered because I HATE apps. I will NEVER install an app on my device if I can help it. No facebook, no twitter, no amazon. If I should be able to do everything the app needs with a browser, then I will NOT download that app. Twitter and amazon at least understand that enough to have functional websites on all platforms. Things like facebook, on the other hand, are 'never installs' for me. So if there's something that capital-A Apps provide that you need, then you should probably go ahead and make one (hopefully using the same UI code you use for your PWA/web-app, but that's not always possible). Things like Twitch and YouTube get apps because they deal with a very specific type of data and can be (and are) optimized to handle that specific data type. Browsers just don't serve that kind of special-purpose design (nor should then), so there's valid reasons for those to be apps.

On the other hand, if you can avoid making a single-purpose app, you should probably try it? Besides the wonks like me refusing app downloads, you also have the headache of maintenance for multiple platforms and all of that pretty much necessitates code mutations and generations for each specific platform that then each all need to be maintained (or worse, in-house developed and maintained). For all of the people out there pitching "holy grail" versions of the write-once, publish-everywhere mantra, I haven't found any that don't include some pretty fine text to the tune of "we use these specific processes and you've just gotta roll with that, even though they will probably cause you compatibility issues in your codebase at least once"

As far as storage, though, localStorage is pretty sparse, it's true. But you can also use IndexedDB storage (pretty good!), and now there's a new file system api that mimics a disk file system in the browser, which is apparently way better but I don't have any first hand experience with that (and it's not useful to me until it can act like a database, but SQLite does seem to be working dilligently to make that happen ASAP). So there are options there, and while people may waffle about the reliability of some of them, I personally haven't run into any issues using IndexedDB (other than it's atrocious development experience).

Re: Ask HN: How to create web, mobile, and desktop apps from a common code base?

#29

Earlier quoted context omitted.

PWA tech has every building block needed to create a proper app besides the operator capable of creating the app

They load slow, have poor menu bars, don't use native UI widgets, have unclear update/versioning systems, can't be on all app stores, have inferior notifications, etc. How long have we been talking about them now as a replacement for native apps? I've still never seen one that's acceptable, much less equally good.

PWAs can be published on all app stores and you probably used it without knowing. Not using native UI widgets isn't really a disadvantage, just an opinion. Well developed web apps are as good as native apps with better and worse things like everything that can be compared.
Post reply on HN