How to run a Rust web application on


This guide shows how to deploy a simple Rust web app on


To complete this, you will need:

Problems does not provide a dedicated Rust runtime container. It will thus be necessary to install Rust as the project is built.


1. Create a Rust application

Create a new Rust project:

cargo new platform_howto && cd platform_howto

Set the platform remote:

platform project:set-remote <project id>

Add the following under [dependencies] in Cargo.toml:

warp = "0.1"
clap = "2.32.0"

Replace src/ with:

extern crate clap;
use clap::{Arg, App};

use warp::Filter;

fn main() {
    let args = App::new("HOWTO")
        .author(" <>")
        .about("How to run a Rust app on")
             .help("Sets a custom port")

    // Get port from command-line arguments
    let port = value_t!(args, "port", u16).unwrap_or_else(|e| e.exit());

    // Match any request and return hello world!
    let routes = warp::any().map(|| "Hello, World!");

        .run(([127, 0, 0, 1], port));

2. Configure the application to run on

Add the following to

name: app

# Any type will work here
type: "php:7.3"

    build: |
      set -e
      curl >
      sh -y --default-toolchain stable
      . "$HOME/.cargo/env"
      cargo build --release

        socket_family: tcp
        protocol: http

        start: |
          target/release/platform_howto --port $PORT

disk: 1024

Define a route in .platform/routes.yaml:

    type: upstream
    upstream: "app:http"

Add an empty .platform/services.yaml file:

touch .platform/services.yaml

3. Add, commit and push:

git add .
git commit -m "Rust on"
git push platform master

4. Test by visiting the URL of your project:

platform url

Which should open a browser tab showing Hello, World!


Even without a dedicated runtime, running a Rust application on can be done by leveraging the build hook and the PORT variable.

1 Like