Elm and Desktop Apps

Hi,

I have an idea for a hobby project that I would like to package as a Desktop App.

There have been a few posts in the past regarding solutions, such as Electron, for building desktop apps with Elm, but I’m wondering what the current lay of the land is.

If anyone would be kind enough to share their experiences I’d be very grateful.

Are there any specific solutions you would recommend? Or any that you would never use again!?

Thanks for any feedback provided.

I think @jxxcarlson likely has the most experience around this right now, and is using Tauri. I’ve been using Electron and have been very comfortable and productive with it and will likely continue using it for at least the near future. I’ll probably give Tauri another shot at some point, but I’ve used Electron enough that I’m just so much more productive in it.

I think first and foremost you should use what you’re most familiar with, and if you’re familiar with neither then I’d try Tauri first.

I think there are some other options out there as well, with Go and possibly other backends, but those 2 are likely to have the best documentation as of right now, that I’m aware of.

2 Likes

I developed a desktop application with Elm and Tauri and was decently satisfied. Obviously Tauri itself knows nothing about Elm (although there are a few other frameworks that are officially supported), but the integration is not harder than with your typical Elm web page.

There is a fundamental issue that I believe spans all tools like Tauri or Electron in the fact that Browser.application doesn’t understand URLs that don’t start with http or https - i.e. what most of those frameworks end up doing. Basically your Elm application will not work outside of a real browser if you base it on Browser.application. This has been known for a while https://github.com/elm/url/issues/10

There are some workarounds, I just ended up using Browser.document instead.

2 Likes

Not related to the choice of platform, but if I were making a Desktop app with Elm I would consider writing a CSS reset specifically for Desktop conventions.

For example, on the web dragging the mouse selects stuff by default. Often in quite buggy ways. Desktop applications the default is the other way around - dragging to select is something applications opt in to. So I would consider user-select: none for inclusion in a Desktop CSS reset. Perhaps someone has already compiled such a thing?

Also you will typically need some Javascript parts to this reset. For example, CTRL+mouse wheel resizes the page. Doesn’t seem like a behaviour many desktop applications do.

3 Likes

FWIW, I did a desktop app in Java that on launch opens a browser window with an Elm app.

So I run a web server locally plus an web app in the browser.

Since the URL starts with http, the problem that the mentioned solutions have, is not here.

1 Like

I also did no framework in the past. Just native platform directly. Like Xcode on IOS, Android studio, or rust / .net. As long as you can spin up a browser and that language has a json package you can use anything you like with just a simple fullscreen webview and ports. But port to native instead of javascript. And not be limited by the typical framework api’s. you can Even host the elm part on internet, super Easy to Update the app when there is only internal elm changes. With a webworker it will still load app when offline.
This was super Nice bypassing the apple AppStore approval prosess anytime you have small changes.

2 Likes

You may find this golang project useful: Wails.

I contributed the non-tailwind template for an Elm-based setup.

Advantages of this solution:

  • super easy cross platform development
  • easy/simple design
  • easy/simple setup
  • tiny generated binary in comparaison to other solutions (10MB)
  • easy backend language to get into

Disadvantages:

  • still need a Mac to compile to Mac targets, grrr
  • Golang’s type system is not very good
  • weak garanties from the compilers when crossing Go → Elm via ports

If you have the time to dig into Rust, this crate looks very useful https://crates.io/crates/elm-rs

I played with it for a tradition web app, and the compile-time garanties the macros bring to the table are quite remarkable

3 Likes

I wrapped kakuro-dojo.com in an iOS app wrapper, don’t remember which one. It works good, but nowadays I just build a progressive web app (PWA) in Elm, and save it as an app from Brave or Chrome, e.g. mammudeck.com

Both of those are open source, with a GitHub link at the bottom of the page.

2 Likes

Thanks everyone for the feedback.

I’ll probably try and have a play with Tauri first, this weekend.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.