Skip to main content
Getting an application running on Fly.io is essentially working out how to package it as a deployable image. Once packaged, it can be deployed to the Fly.io platform. In this guide we’ll learn how to deploy a Dioxus Liveview application on Fly.io. Dioxus Liveview allows apps to run on the server and render in the browser. It uses WebSockets to communicate between the server and the browser. Bring Liveview app to life on Fly.io is a breeze! With the help of the cargo chef, we get great build times and small images.

Speedrun

First, install flyctl, the Fly.io CLI, and sign up to Fly.io if you haven’t already. The fastest way to get a basic Dioxus Liveview server on Fly.io is to use our dioxus-liveview template:

Deploy a Dioxus Liveview App from scratch

If you don’t already have an existing Dioxus Liveview application, you can create one with cargo:
Then we have to add some dependencies to the project:
Now, let’s create a simple count incrementing app in src/main.rs:
This will display a counter that can be incremented using a button. The value will be updated over a websocket. We can confirm everything works fine by running cargo run and checking out http://localhost:8080. And with that you can deploy the app!
This will generate a fly.toml file with the configuration for your app and a Dockerfile that uses cargo chef. Refer to the fly.toml docs for more configuration options. To deploy a new version of your app, simply run fly deploy in the project directory. You can check out the full (yet minimal) example in this GitHub repository for a reference.