Browserbase Node.js SDK
Official Node.js and TypeScript SDK for the Browserbase cloud browser automation API
Repository Health
Technical Analysis
The Browserbase Node.js SDK provides convenient, fully typed access to the Browserbase REST API from server-side TypeScript or JavaScript. Browserbase runs headless browsers in the cloud, and this client wraps its endpoints for creating and managing browser sessions, projects, contexts, extensions, and uploaded assets behind an ergonomic object-oriented interface.
Generated with Stainless, the library ships complete TypeScript definitions for every request parameter and response field, automatic retries with exponential backoff, configurable timeouts, typed error classes, and support for a wide range of JavaScript runtimes including Node.js, Deno, Bun, Cloudflare Workers, and edge environments.
What You Get
- A typed client covering Browserbase sessions, projects, contexts, extensions, and certificates
- Full TypeScript definitions for all request params and response fields with editor autocomplete
- Built-in automatic retries with exponential backoff and configurable per-request timeouts
- Typed error classes (BadRequestError, RateLimitError, and more) mapped from HTTP status codes
- Flexible file-upload helpers and a customizable fetch client for proxies, logging, and middleware
Common Use Cases
- Programmatically creating and managing cloud browser sessions for automated web tasks
- Powering AI agents and scrapers that need a real remote browser to render pages
- Uploading browser extensions or certificates to configure managed sessions
- Integrating browser automation into serverless and edge runtimes like Cloudflare Workers
Under The Hood
Architecture - The SDK is organized around a central Browserbase client class (src/index.ts) that composes namespaced resource objects under src/resources/ (sessions, projects, contexts, extensions, certificates, agents, search) each mapping to REST endpoints; a shared core.ts handles request construction, retries, and response parsing, while _shims/ abstracts the fetch/HTTP transport per runtime. Tech Stack - Written in TypeScript (91% of the codebase) and generated by Stainless from the API spec, it targets TypeScript >= 4.5 and runs on Node 18+, Deno, Bun, Cloudflare Workers, and edge runtimes, using globalThis.fetch with node-fetch and web fetch shims as fallbacks. Code Quality - Being code-generated, the library is highly consistent with uniform resource modules, an error.ts hierarchy of typed API errors, uploads.ts for multipart handling, and pinned versioning; the generated nature means the structure is regular and well-covered by the upstream generator rather than hand-written tests. API Design - The developer experience is polished: a single client instantiation with an API key, resource-dot-method calls with typed params and responses, inline docstrings on hover, escape hatches like .asResponse()/.withResponse() and raw client.post() for undocumented endpoints, and sensible defaults for retries and timeouts.