
Shirabe
Headless browser automation
Introduction
shirabe is a lightweight, Rust-native browser automation library and debug server. It drives any browser that speaks the Chrome DevTools Protocol — Google Chrome, Chromium, Microsoft Edge — through one hand-rolled CDP engine, and exposes the whole thing over a small HTTP API. It is the browser backbone extracted from the tairitsu packager, hardened to stand on its own.
The guiding idea is the same as ort for ONNX Runtime: you should never have to install a browser by hand. A pinned Chrome for Testing build is fetched into a shared cache at build time (or on first use), located transparently, and driven through CDP. Pin a different backend, ship native libs with your product, route the download through a mirror or proxy — all from environment variables.
Quick Start
CLI
# Zero-config: auto-discovers Chrome/Chromium/Edge, or fetches Chrome for Testing.
shirabe debug --port 3001
# Pin a backend, route the browser through a proxy.
SHIRABE_BACKEND=chromium shirabe debug --port 3001 --proxy http://localhost:7890
# Then drive it over HTTP.
curl -X POST http://localhost:3001/navigate \
-H "Content-Type: application/json" -d '{"url":"https://example.com"}'
curl -X POST http://localhost:3001/screenshot -d '{}'
Library
use shirabe::{start_debug_server, DebugServerConfig};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let cfg = DebugServerConfig {
base_url: "about:blank".to_string(),
dev_port: 0,
dist_dir: String::new(),
package_name: String::new(),
proxy: Some("http://localhost:7890".to_string()),
};
start_debug_server(cfg, 3001).await
}
Backends & zero-config resolution
Pick a backend with SHIRABE_BACKEND=chrome|chromium|edge|firefox|servo|auto
(default auto). The Chromium family (Chrome / Chromium / Edge) is driven
in-process through our own CDP engine; Firefox and Servo take a
different path — their cores are built by the browser vendors and shipped as
dynamic libraries, which shirabe drives through a thin C-binding FFI contract
(the foreign-engine feature, see
Foreign Engines). Whichever is chosen,
shirabe resolves it in this order:
- Backend-specific override —
CHROME_PATH/CHROMIUM_PATH/EDGE_PATH. - Build-time baked path —
SHIRABE_BROWSER_PATH, emitted bybuild.rswhen the `auto-fetch` feature downloads Chrome for Testing during the build. - System binary on
$PATHand well-known install locations. - Runtime fetch (the
runtime-fetchfeature) — download the pinned build into the shared cache.
Download knobs (build time and runtime alike):
| Env | Purpose |
|---|---|
SHIRABE_CHROME_VERSION | Override the pinned Chrome for Testing version. |
SHIRABE_CHROME_MIRROR | Download from a mirror instead of storage.googleapis.com. |
SHIRABE_CHROME_SHA256 | Optional hex checksum to verify the download. |
SHIRABE_DOWNLOAD_PROXY | Route the download through http:// / https:// / socks5:// proxy. |
SHIRABE_DOWNLOAD_TIMEOUT_SECS | Per-request timeout (default 600). |
SHIRABE_SKIP_BROWSER_FETCH | Skip both build-time and runtime downloads. |
SHIRABE_BACKEND | Which Chromium-family backend to drive. |
Shipping native libraries with your product
A fetched Chrome build (and your own crate) depend on native libraries that a clean container may lack. shirabe gives packagers two tools:
- Declarative bundle — list the
.so/.dylib/.dllfiles to ship via `SHIRABE_BUNDLE_LIBS` (path-sep list) or `SHIRABE_BUNDLE_MANIFEST` (a `bundle.toml` of `[[lib]]` tables). Example manifest:
[[lib]]
path = "third_party/libfoo.so"
optional = true
target_os = "linux"
[[lib]]
path = "third_party/foo.dll"
- Dependency scan —
shirabe::collect_runtime_deps(exe)enumerates the shared libraries a binary links against (`ldd` / `otool -L` / a PE import scan), and `shirabe::render_bundle_report(&BundleReport::build(&exe))` prints everything a release script should copy alongside the binary.
use shirabe::{BundleReport, render_bundle_report};
let report = BundleReport::build(&backend_exe);
print!("{}", render_bundle_report(&report));
HTTP API
| Method | Path | Description |
|---|---|---|
GET | /health | Server health |
GET | /info | Browser status + selected backend |
POST | /navigate | Navigate to a URL |
POST | /click | Click an element |
POST | /type | Type text |
POST | /evaluate | Execute JavaScript |
POST | /screenshot | Capture a screenshot |
POST | /wait-for-selector | Wait for an element |
GET | /dom | Query the DOM |
GET | /a11y | Accessibility tree |
POST | /batch | Batch operations |
…plus console, network and websocket capture endpoints for full control.
Development
SHIRABE_SKIP_BROWSER_FETCH=1 cargo clippy --all-targets --all-features -- -D warnings
SHIRABE_SKIP_BROWSER_FETCH=1 cargo test --all-features
Screenshots

License
SySL-1.0 (Synthetic Source License). See LICENSE.