Rust on Falix

The Rust application compiles your project with cargo on every start — slow the first time, fast after that. Here's how the build cache works, a std-only web server, and how to add crates.

The Rust application does something the other compiled runtimes don't: it builds from source right on the server. When you press Start, Falix runs cargo run --release in your server folder — so as long as there's a Cargo.toml at the root, your project compiles and runs with one command. The catch is patience on that very first start. This guide explains the build cache, gives you a dependency-free web server to start from, and covers the memory pitfalls that bite on small plans.

At a glance
You need A Falix server running the Rust application (a little RAM headroom helps — Rust is memory-hungry to compile)
Plan Any — on free it runs while your session timer has time left, premium runs 24/7
Time Twenty minutes, most of it the first build
No server yet? Create your first app server

How the build works

cargo run --release compiles your project the first time you start the server. On a small plan this can take a while — a fresh dependency tree means cargo builds every crate before your code runs.

💡 Tip: Be patient and watch the console — cargo prints its progress line by line (Compiling ..., then Finished, then your program's output). It isn't stuck; it's working.

Cargo writes its output to a target/ folder, and that folder stays on disk between restarts. So the second start is dramatically faster — cargo reuses the cached build and only recompiles what changed. You pay the long build once (and again whenever you change dependencies or do a clean rebuild), not every time.

⚠️ Heads up: target/ survives restarts, but not a wipe. A reinstall — or switching the server to a different application — clears your files, the whole build cache included, so the next start pays the full first-build cost again. That's the one time the slow compile comes back.

Your project just needs a Cargo.toml at the file root. A minimal one:

[package]
name = "myapp"
version = "0.1.0"
edition = "2021"

A web server with no dependencies

Because every crate you add lengthens that first build, it's worth knowing you can serve HTTP with the standard library alone — no crates, no versions to pin. Here's a complete src/main.rs that reads SERVER_PORT, binds all interfaces, and answers every request:

use std::env;
use std::io::Write;
use std::net::TcpListener;

fn main() {
    let port = env::var("SERVER_PORT").unwrap_or_else(|_| "8080".to_string());
    let addr = format!("0.0.0.0:{}", port);
    let listener = TcpListener::bind(&addr).expect("could not bind");
    println!("Listening on {}", addr);

    for stream in listener.incoming() {
        let mut stream = match stream {
            Ok(s) => s,
            Err(_) => continue,
        };
        let body = "Hello from Rust on Falix!";
        let response = format!(
            "HTTP/1.1 200 OK\r\nContent-Length: {}\r\nContent-Type: text/plain\r\n\r\n{}",
            body.len(),
            body
        );
        let _ = stream.write_all(response.as_bytes());
    }
}

🎯 Good to know: Binding 0.0.0.0 on SERVER_PORT is what makes the app reachable from outside — never localhost.

The port and bind-address rules that apply to every web app are in Your first web app. When you outgrow the standard library, reach for a framework like a web crate — just expect that first build to grow.

Adding crates

The Rust application has a Packages page in the server menu. Open Packages, search for the crate, and press Install — it runs cargo add, updates your Cargo.toml for you, and shows the job under Tasks. Restart afterwards; the next start recompiles to pull the new crate in, so give that build a moment. Editing Cargo.toml by hand works too (and is what Git-based projects do) — the outcome is the same recompile.

To run a genuinely separate Rust project — another service, a second bot — give it its own Instance: an isolated application, files, and startup on the same server, each with its own target/ cache, switched whenever you like.

When things go wrong

  • The console fills with error[...] lines and stops — those are compile errors, printed exactly as cargo sees them. Fix them in your source (usually the first error is the real one), then restart to rebuild.
  • The first start takes forever — that's the initial compile, not a hang. Watch for Compiling progress; once you see Finished, your program runs and later starts are fast. Keeping your dependency list lean keeps this build short.
  • Build dies partway through, exit code 137 — the compiler ran out of memory, common on tiny plans with a big dependency tree. Trim dependencies, or give the server more RAM. See Out of memory.
  • Compiles and runs, but the page won't load — a port or bind-address problem: I can't reach my app.
Cheat sheet
Entry file A Cargo.toml at the root; cargo run --release builds and runs it
Dependencies Packages page runs cargo add and updates Cargo.toml; the next start recompiles
Web port rule Read SERVER_PORT, bind 0.0.0.0

Next steps

Was this guide helpful?