Ask HN: How to create web, mobile, and desktop apps from a common code base?
What are your suggestions for a technological stack for the described cross-platform setting?
What are your suggestions for a technological stack for the described cross-platform setting?
Many people underestimate the power of webview based tech in mobile. For most usecases, webview based tech does just fine.
Furthermore, the deployment size of .NET is HUGE and NativeAOT is really hard to accomplish as soon as you have a few libraries. Startup times are also not that impressive and deploying for all platforms is really a pain.
For comparison the size of a simple hello world Android App
.NET > 70MB
Flutter < 15MB
That may sound like it's not relevant, but believe me, it is.I have tried it myself, but did not love it fwiw
If you are more into video tutorials, this one[3] is pretty compact but not made for total beginners.
If you really want to get into it, you could now start checking out a not too big Open Source project like Musify (music player)[4], Localsend (file sharing)[5] or immich (photo sync)[6].
[1]: https://flutter.dev
[2]: https://github.com/Solido/awesome-flutter
[3]: https://www.youtube.com/watch?v=D4nhaszNW4o
[4]: https://github.com/gokadzev/Musify
That said, there is nothing that tackles iOS, Android and Web very well.
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.
If you want your users to be happy, make a proper app
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.
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).
Flutter also does support Web but has a few issues. But still I wou choose it.
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.