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>.
- Name — optional; taken from the repository. Deploying again under the same name replaces the function.
- Folder — if the function lives in a sub-folder (a monorepo, or one repository holding several functions).
- Branch — the default branch unless you say otherwise.
- Environment —
KEY=valuelines. Your code reads them as ordinary environment variables.
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}
- POST the input as the body. A GET with no body runs the function with empty input.
- If your function prints JSON the response is
application/json; otherwise plain text. x-fn-mson the response is how long the run took;x-fn-exitis the exit code.- Browsers can call it directly — the URL answers cross-origin requests.
- Every call is a fresh sandbox: fresh memory, nothing carried over from the last call or from anyone else's.
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
- A call has 5 seconds; past that it is stopped and answers
504. - Input up to 256 KB; a built module up to 32 MB.
- A function has no network and no filesystem in early access — input in, output out.
- One build runs at a time; a second deploy waits its turn, usually seconds.
- Public GitHub repositories today. Private repositories and other hosts are next.
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.