Barua /Docs/Functions
Early access

Barua Functions

Paste a GitHub repository written in Rust or Go. We build it to WebAssembly and run it next to your data. You get a URL, logs, and a place for your environment. Nothing to install.

Deploy

Open fn.barua.app, paste the repository's URL, press Deploy. The build log appears as it happens — the same output you would see in your own terminal — and when it finishes the function is live at https://fn.barua.app/<name>.

Try it with nassdaq/hello-barua-fn: Rust at the root, the same function in Go under go/. On our box it builds in about four seconds.

What a function is

A program that reads its input on stdin and prints its answer on stdout. That is the whole contract — no framework, no SDK, no special types. The body of the request is the input; whatever you print is the response.

Rust

use std::io::{self, Read, Write};

fn main() {
    let mut input = String::new();
    io::stdin().read_to_string(&mut input).ok();
    let greeting = std::env::var("GREETING").unwrap_or("Hello".into());
    write!(io::stdout(), "{{\"message\":\"{}, {}!\"}}", greeting, input.trim()).ok();
}

Go

func main() {
    input, _ := io.ReadAll(os.Stdin)
    greeting := cmp.Or(os.Getenv("GREETING"), "Hello")
    fmt.Printf("{\"message\":\"%s, %s!\"}", greeting, strings.TrimSpace(string(input)))
}

We tell the language from the repository: a Cargo.toml is Rust, a go.mod is Go. No toolchain on your side, and no .wasm to look at — the build is ours.

Your URL

curl -X POST https://fn.barua.app/hello-barua-fn --data '{"name": "Asha"}'
# {"message":"Hello, Asha!","lang":"rust","greeting_from_env":false}

Environment

The Environment tab holds KEY=value pairs. Save them and the next call sees them — std::env::var in Rust, os.Getenv in Go. Keys and secrets belong here, not in the repository.

Logs

Two kinds. The build log is everything the compiler said, kept with the deployment. The call log records each request: when, status, how long, exit code, bytes in and out, and anything the function wrote to stderr — so a failing call explains itself.

Changing it

Push to GitHub, then press Deploy again with the same name. The moment the build finishes the URL serves the new code; a failed build never replaces a working function.

Limits

Access

Functions is in early access. The page asks for an access key once and keeps it in your browser; ask us for one. The URLs of your functions need no key — they are there to be called by your app and your users.

Barua Functions · fn.barua.app · Tasks Example repository Built in Dar es Salaam