Warning: Still a Proof of Concept with a lot of bad code! Wrapper around Tauri to enable the development of Phoenix Desktop applications
- Tauri App for building it and providing a ton of support to find the right way to build the PoC
- Digit / Doawoo for Burrito which enables us to build the binary to be used as a sidecar
- Kevin Pan / Feng19 for their example that heavily inspired the approach taken with their phx_new_desktop repository
- yos for a great discussion and bringing Feng19 example into the mix (no pun intended)
- Phoenix Framework Tailwind which was a big inspiration on the approach to be taken when it came to install an outside package and use it within an Elixir project
- Using Rusts cargo install, installs Tauri in your local dependencies
- Runs
tauri init
with the given configuration to create yoursrc-tauri
folder in your project root - Overrides
Cargo.toml
since original Tauri depends on installation folders which made it trickier - Moves
build.rs
intosrc-tauri/src
due to an error during development - Setups the required sidecars in
src-tauri/tauri.conf.json
- Turns off
TAURI_SKIP_DEVSERVER_CHECK
which was blocking the Tauri code from runningmain.rs
- Checks if the project has a Burrito release configured
- Wraps the Phoenix application using Burrito
- Renames the output from Burrito to be compatible with Tauri's way of calling a sidecar
- Runs
tauri
and passes the arguments into Tauri
- Zig (0.10.0)
- Rust
For reference please check the example folder in this repository
- Add dependency
def deps do
[
{:ex_tauri, git: "https://github.com/filipecabaco/ex_tauri.git"}
]
end
- Add configuration
config :ex_tauri, version: "1.4.0", app_name: "Example Desktop", host: "localhost", port: 4000
- Add burrito release
def project do
[
app: :example_desktop,
version: "0.1.0",
elixir: "~> 1.14",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
aliases: aliases(),
deps: deps(),
releases: releases()
]
end
# ...
defp releases do
[
desktop: [
steps: [:assemble, &Burrito.wrap/1],
burrito: [
targets: [
# At the moment we still need this really specific names
"aarch64-apple-darwin": [os: :darwin, cpu: :aarch64]
]
]
]
]
end
- Add
:inets
and otherextra_applications
you might need since burrito needs to be aware of them
def application do
[
mod: {ExampleDesktop.Application, []},
extra_applications: [:logger, :runtime_tools, :inets]
]
end
- Extra: Have a way to start up your repos during startup:
defmodule ExampleDesktop.Starter do
alias ExampleDesktop.Repo
def run() do
Application.ensure_all_started(:ecto_sql)
Repo.__adapter__().storage_up(Repo.config())
Ecto.Migrator.run(Repo, :up, all: true)
end
end
-
Check your runtime.exs, there's a lot of environment variables that you might need to build your server
-
Setup tauri by running
mix ex_tauri.install
-
Run tauri in development mode with
mix ex_tauri dev
-
Build a distributable package with
mix ex_tauri build