Live data from Hacker News

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

news.ycombinator.com

1–10 of 30 posts

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

#1
I have an idea for a few apps that make sense to exist simultaneously as a web, mobile (Android and iOS), and desktop (Windows, Mac, and Linux) app. The research I have done so far is for utilizing JavaScript/TypeScript-based tech stack with React for the web, React Native for mobile, and Electron for desktop versions. Because I have yet not started learning those technologies I want to make sure that a common code base is achievable with them and also to consider some alternatives. For example, a commonly mentioned alternative of Electron is nw.js and I also found that React Native can be used not only for mobile but also for Desktop apps at least for Windows and MacOS.

What are your suggestions for a technological stack for the described cross-platform setting?

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

#4
post #2

Have you considered making it a website? Then it can be used on every device via the browser.

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.

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

#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.

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

#8
post #4
post #2

Have you considered making it a website? Then it can be used on every device via the browser.

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.

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

#10
post #7
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

Could you recommend a good book or online learning resource for Flutter?

Work through the "Get started" section of the official docs[1]. After this you could take a look at Awesome Flutter[2].

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

[5]: https://github.com/localsend/localsend

[6]: https://github.com/immich-app/immich/tree/main/mobile

Post reply on HN