« Back to Search  |  Reader Mode  |  Switch to Full Retro Site View Links: Stay in Reader  |  Retro Mode: ON  |  Original »
GitHub · Extracted in 1513 ms

GitHub - tinybrowser-dev/tinybrowser: A pretty tiny browser you can embed anywhere.

Source: https://github.com/tinybrowser-dev/tinybrowser

Repository navigation

tinybrowser
Public

About

A pretty tiny browser you can embed anywhere.

tinybrowser.ericc.ch

Topics

browser playwright rust wasm webassembly webdriver

Resources

Readme MIT license

Contributing

Contributing Activity Custom properties

Stars

380 stars

Watchers

1 watching

Forks

18 forks Report repository
Branches

Tags
Go to Branches page Go to Tags page

Latest commit

 

History


1,865 Commits
View commit history for this file.

Folders and files

Name Name Last commit message Last commit date
.cargo .cargo    
.cursor .cursor    
.github .github    
.zed .zed    
apps apps    
crates crates    
docs docs    
examples/ e2e examples/ e2e    
packages packages    
src src    
tests tests    
third_party third_party    
tools tools    
.envrc .envrc    
.gitignore .gitignore    
.gitmodules .gitmodules    
AGENTS.md AGENTS.md    
CONTRIBUTING.md CONTRIBUTING.md    
CREDITS.md CREDITS.md    
Cargo.lock Cargo.lock    
Cargo.toml Cargo.toml    
LICENSE LICENSE    
NOTICE NOTICE    
README.md README.md    
build.rs build.rs    
bun.lock bun.lock    
clippy.toml clippy.toml    
flake.lock flake.lock    
flake.nix flake.nix    
install.ps1 install.ps1    
install.sh install.sh    
mise.toml mise.toml    
package.json package.json    
rust-toolchain.toml rust-toolchain.toml    

Repository files navigation

tinybrowser

A pretty tiny browser you can embed anywhere.

It speaks the Chrome DevTools Protocol and W3C WebDriver (Classic and BiDi), so Playwright and Selenium can drive it. It also compiles to WebAssembly, which is how the live demo runs inside your browser.

tinybrowser is experimental:

  • Not every Web API is implemented yet. The WPT page shows current coverage.
  • JavaScript runs on QuickJS-ng with no JIT, so JS-heavy pages are slower than on V8.
  • There is no out-of-process iframe isolation yet, and OS sandboxing is not battle-tested.
  • Rendering is headless, one-shot screenshots only.

Full documentation: https://tinybrowser.ericc.ch/#documentation

Install

WebAssembly SDK:

npm install @tinybrowser/wasm
# or
bun add @tinybrowser/wasm

macOS and Linux:

curl -fsSL https://raw.githubusercontent.com/tinybrowser-dev/tinybrowser/main/install.sh | sh

Windows (PowerShell):

irm https://raw.githubusercontent.com/tinybrowser-dev/tinybrowser/main/install.ps1 | iex

npm:

npx tinybrowser --help
npx tinybrowser daemon start

# or install globally
npm install -g tinybrowser

Archives for every platform are on GitHub Releases .

WebAssembly

@tinybrowser/wasm ships as a WASI Preview 2 component. You pass the component, the module loader, the WASI shims, and the transport. The Node entry needs Node 22 or later; Bun, browsers, and Workers use their own loaders.

import { createTinyBrowser } from "@tinybrowser/wasm"
import { instantiate } from "@tinybrowser/wasm/instantiate"
import {
  createNodeModuleLoader,
  createNodeTransport,
  createNodeWasi,
} from "@tinybrowser/wasm/node"

const browser = await createTinyBrowser({
  instantiate,
  module: createNodeModuleLoader(import.meta.resolve("@tinybrowser/wasm/core.wasm")),
  wasi: createNodeWasi(),
  transport: createNodeTransport(),
})

const tab = browser.createContext().openTab()
const result = await tab.goto("https://example.com/", { waitUntil: "networkidle" })

console.log(result.ok, result.reason, tab.title())
browser.dispose()

The waitUntil modes and the full API are in packages/wasm/README.md and on the website .

Daemon

Start the daemon. It prints its endpoint as JSON:

tinybrowser daemon start
# {"profile":"default","pid":12345,"host":"127.0.0.1","port":41234,"url":"http://127.0.0.1:41234"}

tinybrowser daemon status
tinybrowser daemon stop

To connect Playwright over CDP, pass the printed URL to chromium.connectOverCDP:

import { chromium } from "playwright-core"

const browser = await chromium.connectOverCDP("http://127.0.0.1:41234")
const page = browser.contexts()[0].pages()[0]
await page.goto("https://example.com")
console.log(await page.title())

For WebDriver Classic, send POST /session to the same port. For BiDi, connect to ws://127.0.0.1:<port>/session.

Source reference

Need File
Exact WIT interface: types, resources, host imports crates/wasm/wit/browser.wit
Wasm driver internals: waitUntil, pump budgets, wakeups, public types packages/wasm/src/driver.ts , types.ts
Browser loader, Workers loader, hop proxy, storage state schemas packages/wasm/README.md
Every CLI subcommand, flag, environment variable, and path src/cli.rs or tinybrowser --help
npm CLI platform packages, target mapping, SHA-256 fallback, cache packages/cli/README.md
Hosted Executor MCP app: Cloudflare Workers, SQLite persistence apps/executor/README.md
Web Platform Tests coverage and failing tests https://tinybrowser.ericc.ch/wpt

Building from source

git clone https://github.com/tinybrowser-dev/tinybrowser
cd tinybrowser
git submodule update --init third_party/blitz third_party/rquickjs third_party/html5ever
git -C third_party/rquickjs submodule update --init sys/quickjs
nix develop          # or rustup; rust-toolchain.toml selects the pinned nightly
cargo build --release

The release profile needs the pinned nightly (build-std, force-unwind-tables=no). The WPT harness also needs third_party/wpt; see tools/wpt/README.md . Before you change engine code, read CONTRIBUTING.md , docs/owners.md , and docs/adr/ .

License and credits

MIT licensed (LICENSE ). Third-party notices are in NOTICE , and acknowledgements are in CREDITS.md .

About

A pretty tiny browser you can embed anywhere.

tinybrowser.ericc.ch

Topics

browser playwright rust wasm webassembly webdriver

Resources

Readme MIT license

Contributing

Contributing Activity Custom properties

Stars

380 stars

Watchers

1 watching

Forks

18 forks Report repository

Releases

Sponsor this project

Contributors

Languages