Real C++, in the browser tab
Compile unmodified C and C++ source targeting BrowserPod, then run the binary in a pod on your user’s device. Node.js itself reaches the browser this way, built from its C++ source.
$npm i @leaningtech/browserpod 1#include <stdio.h> 2 3struct Greeter { 4 const char* who; 5 void hello() const { 6 printf("Hello, %s, from C++ 👋\n", who); 7 } 8}; 9 10int main(int argc, char** argv) { 11 Greeter{argc > 1 ? argv[1] : "BrowserPod"}.hello(); 12 13 auto square = [](int n) { return n * n; }; 14 long version = __cplusplus / 100 % 100; 15 int n = square(12); 16 printf("C++%ld says 12 squared is %d\n", version, n); 17}
From clang++ to a running pod
Build on your machine, serve the binary with your web app and copy it into the pod.
-
1Install the toolchain
Use the deb package, the macOS or Windows installer, or build it from source.
cheerp.io -
2Compile
Target the BrowserPod platform with clang++.
$ /opt/cheerp/clang++ hello.cpp -o hello \ --target=wasm32-browserpod-linux -
3Serve the binary
Put the binary in your web app’s public folder.
$ cp hello public/ -
4Run it in a pod
Fetch the binary, write it to the pod with createFile and run it.
pod.run("/hello", [], { terminal })
Hello, World! in C++
A standard C++ program, compiled on your machine. The 184K binary goes into your public folder, ready to copy into a pod.
1$ cat hello.cpp 2#include <iostream> 3 4int main() { 5 std::cout << "Hello, World!\n"; 6} 7 8$ /opt/cheerp/clang++ hello.cpp -o hello \ 9 --target=wasm32-browserpod-linux 10$ ls -lh hello 11-rwxr-xr-x 1 you staff 184K hello 12 13$ cp hello public/
What every pod includes
Your C++ binary runs in the same pod as Node.js, with the same command line beside it.
Runs on the user’s device
Each pod runs inside the browser tab, on the user’s own machine.
Isolated from the host
A dedicated syscall layer keeps the pod apart from the host operating system.
Command-line tools included
bash, git, coreutils and more are ready in every pod.
Storage you choose
Pods are ephemeral by default. Pass a storageKey to keep files between sessions.
Other runtimes
One API boots a pod, opens a terminal and runs a program, whichever language it is written in.
Get started
Install BrowserPod from npm and boot your first pod.
$npm i @leaningtech/browserpod Need public URLs, GitHub or TCP from a pod? Add an API key for BrowserPod Edge, free for 1,000 hours a month.Get an API key










