{"id":28268018,"url":"https://github.com/hyperbrowserai/node-sdk","last_synced_at":"2026-06-12T00:01:29.454Z","repository":{"id":264909614,"uuid":"894664735","full_name":"hyperbrowserai/node-sdk","owner":"hyperbrowserai","description":null,"archived":false,"fork":false,"pushed_at":"2026-06-01T23:23:40.000Z","size":506,"stargazers_count":15,"open_issues_count":2,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-05T11:33:17.262Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hyperbrowserai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2024-11-26T18:59:48.000Z","updated_at":"2026-06-01T23:23:06.000Z","dependencies_parsed_at":"2026-04-06T04:03:01.257Z","dependency_job_id":null,"html_url":"https://github.com/hyperbrowserai/node-sdk","commit_stats":null,"previous_names":["hyperbrowserai/node-sdk"],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/hyperbrowserai/node-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperbrowserai%2Fnode-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperbrowserai%2Fnode-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperbrowserai%2Fnode-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperbrowserai%2Fnode-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hyperbrowserai","download_url":"https://codeload.github.com/hyperbrowserai/node-sdk/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperbrowserai%2Fnode-sdk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34222709,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-11T02:00:06.485Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-20T15:12:06.633Z","updated_at":"2026-06-12T00:01:29.438Z","avatar_url":"https://github.com/hyperbrowserai.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hyperbrowser Node SDK\n\nCheckout the full documentation [here](https://hyperbrowser.ai/docs)\n\n## Installation\n\nHyperbrowser can be installed via npm by running:\n\n```bash\nnpm install @hyperbrowser/sdk\n```\n\nor\n\n```bash\nyarn add @hyperbrowser/sdk\n```\n\n## Usage\n\n### Playwright\n\n```typescript\nimport { chromium } from \"playwright-core\";\nimport { Hyperbrowser } from \"@hyperbrowser/sdk\";\nimport { config } from \"dotenv\";\n\nconfig();\n\nconst client = new Hyperbrowser({\n  apiKey: process.env.HYPERBROWSER_API_KEY,\n});\n\nconst main = async () =\u003e {\n  const session = await client.sessions.create();\n\n  try {\n    const browser = await chromium.connectOverCDP(session.wsEndpoint);\n\n    const defaultContext = browser.contexts()[0];\n    const page = await defaultContext.newPage();\n\n    // Navigate to a website\n    console.log(\"Navigating to Hacker News...\");\n    await page.goto(\"https://news.ycombinator.com/\");\n    const pageTitle = await page.title();\n    console.log(\"Page 1:\", pageTitle);\n    await page.evaluate(() =\u003e {\n      console.log(\"Page 1:\", document.title);\n    });\n\n    await page.goto(\"https://example.com\");\n    console.log(\"Page 2:\", await page.title());\n    await page.evaluate(() =\u003e {\n      console.log(\"Page 2:\", document.title);\n    });\n\n    await page.goto(\"https://apple.com\");\n    console.log(\"Page 3:\", await page.title());\n    await page.evaluate(() =\u003e {\n      console.log(\"Page 3:\", document.title);\n    });\n\n    await page.goto(\"https://google.com\");\n    console.log(\"Page 4:\", await page.title());\n    await page.evaluate(() =\u003e {\n      console.log(\"Page 4:\", document.title);\n    });\n  } catch (err) {\n    console.error(`Encountered error: ${err}`);\n  } finally {\n    await client.sessions.stop(session.id);\n  }\n};\n\nmain();\n```\n\n### Puppeteer\n\n```typescript\nimport { connect } from \"puppeteer-core\";\nimport { Hyperbrowser } from \"@hyperbrowser/sdk\";\nimport { config } from \"dotenv\";\n\nconfig();\n\nconst client = new Hyperbrowser({\n  apiKey: process.env.HYPERBROWSER_API_KEY,\n});\n\nconst main = async () =\u003e {\n  const session = await client.sessions.create();\n\n  try {\n    const browser = await connect({\n      browserWSEndpoint: session.wsEndpoint,\n      defaultViewport: null,\n    });\n\n    const [page] = await browser.pages();\n\n    // Navigate to a website\n    console.log(\"Navigating to Hacker News...\");\n    await page.goto(\"https://news.ycombinator.com/\");\n    const pageTitle = await page.title();\n    console.log(\"Page 1:\", pageTitle);\n    await page.evaluate(() =\u003e {\n      console.log(\"Page 1:\", document.title);\n    });\n\n    await page.goto(\"https://example.com\");\n    console.log(\"Page 2:\", await page.title());\n    await page.evaluate(() =\u003e {\n      console.log(\"Page 2:\", document.title);\n    });\n\n    await page.goto(\"https://apple.com\");\n    console.log(\"Page 3:\", await page.title());\n    await page.evaluate(() =\u003e {\n      console.log(\"Page 3:\", document.title);\n    });\n\n    await page.goto(\"https://google.com\");\n    console.log(\"Page 4:\", await page.title());\n    await page.evaluate(() =\u003e {\n      console.log(\"Page 4:\", document.title);\n    });\n  } catch (err) {\n    console.error(`Encountered error: ${err}`);\n  } finally {\n    await client.sessions.stop(session.id);\n  }\n};\n\nmain();\n```\n\n### Sandboxes\n\nFor local sandbox development, you can explicitly route sandbox runtime traffic\nthrough a regional proxy override:\n\n```typescript\nconst client = new Hyperbrowser({\n  apiKey: process.env.HYPERBROWSER_API_KEY,\n  runtimeProxyOverride: process.env.REGIONAL_PROXY_DEV_HOST,\n});\n```\n\n```typescript\nimport { Hyperbrowser } from \"@hyperbrowser/sdk\";\n\nconst client = new Hyperbrowser({\n  apiKey: process.env.HYPERBROWSER_API_KEY,\n});\n\nconst main = async () =\u003e {\n  const sandbox = await client.sandboxes.create({\n    imageName: \"ubuntu-24-node\",\n    region: \"us-west\",\n    cpu: 4,\n    memoryMiB: 4096,\n    diskMiB: 8192,\n  });\n\n  // Provide exactly one launch source:\n  // snapshotName or imageName.\n  // snapshotId requires snapshotName and imageId requires imageName.\n  // cpu, memoryMiB, and diskMiB are only available for image launches.\n\n  const version = await sandbox.exec(\"node -v\");\n  console.log(version.stdout.trim());\n\n  await sandbox.files.writeText(\"/tmp/hello.txt\", \"hello from sdk\");\n\n  const content = await sandbox.files.readText(\"/tmp/hello.txt\");\n  console.log(content);\n\n  const watch = await sandbox.files.watchDir(\n    \"/tmp\",\n    (event) =\u003e {\n      if (event.type === \"write\") {\n        console.log(event.name);\n      }\n    },\n    {\n      recursive: false,\n    }\n  );\n\n  await sandbox.files.writeText(\"/tmp/watch-demo.txt\", \"watch me\");\n  await watch.stop();\n\n  const proc = await sandbox.processes.start(\n    \"echo process-started \u0026\u0026 sleep 1 \u0026\u0026 echo process-finished\",\n    {\n      runAs: \"root\",\n    }\n  });\n\n  for await (const event of proc.stream()) {\n    if (event.type === \"stdout\") {\n      process.stdout.write(event.data);\n    }\n  }\n\n  const terminal = await sandbox.terminal.create({\n    command: \"bash\",\n    cols: 120,\n    rows: 30,\n  });\n\n  const connection = await terminal.attach();\n  await connection.write(\"echo terminal-ok\\n\");\n\n  for await (const event of connection.events()) {\n    if (event.type === \"output\" \u0026\u0026 event.data.includes(\"terminal-ok\")) {\n      break;\n    }\n  }\n\n  await connection.close();\n\n  const snapshot = await sandbox.createMemorySnapshot();\n  console.log(snapshot.snapshotId);\n\n  await sandbox.stop();\n};\n\nmain().catch(console.error);\n```\n\nReconnect an existing sandbox:\n\n```typescript\nconst sandbox = await client.sandboxes.connect(\"sandbox-id\");\nawait sandbox.files.readText(\"/tmp/hello.txt\");\nawait sandbox.stop();\n```\n\n`connect()` refreshes runtime auth and throws if the sandbox is no longer running.\n\nCreate a sandbox with pre-exposed ports:\n\n```typescript\nconst sandbox = await client.sandboxes.create({\n  imageName: \"node\",\n  cpu: 2,\n  memoryMiB: 2048,\n  diskMiB: 8192,\n  exposedPorts: [{ port: 3000, auth: true }],\n});\n\nconsole.log(sandbox.exposedPorts[0].browserUrl);\n```\n\nManage volumes and mount them into a sandbox:\n\n```typescript\nconst volume = await client.volumes.create({ name: \"project-cache\" });\nconst volumes = await client.volumes.list();\nconst sameVolume = await client.volumes.get(volume.id);\n\nconst sandbox = await client.sandboxes.create({\n  imageName: \"node\",\n  mounts: {\n    \"/workspace/cache\": {\n      id: sameVolume.id,\n      type: \"rw\",\n      shared: true,\n    },\n  },\n});\n\nawait sandbox.stop();\n```\n\nList sandboxes with time-range and search filters:\n\n```typescript\nconst sandboxes = await client.sandboxes.list({\n  status: \"active\",\n  start: Date.now() - 60 * 60 * 1000,\n  end: Date.now(),\n  search: \"sbx_\",\n  limit: 25,\n});\n```\n\nList snapshots for a specific image:\n\n```typescript\nconst snapshots = await client.sandboxes.listSnapshots({\n  imageName: \"node\",\n  status: \"created\",\n  limit: 10,\n});\n```\n\nExpose and unexpose ports:\n\n```typescript\nconst sandbox = await client.sandboxes.create({ imageName: \"node\" });\n\nconst exposure = await sandbox.expose({ port: 8080, auth: true });\nconsole.log(exposure.url, exposure.browserUrl, exposure.browserUrlExpiresAt);\n\nawait sandbox.unexpose(8080);\n```\n\nWrite batch files with per-entry options:\n\n```typescript\nawait sandbox.files.write([\n  {\n    path: \"/tmp/hello.txt\",\n    data: \"hello\",\n    append: true,\n    mode: \"600\",\n  },\n  {\n    path: \"/tmp/payload.bin\",\n    data: Buffer.from([1, 2, 3]).toString(\"base64\"),\n    encoding: \"base64\",\n  },\n]);\n```\n\nResume a PTY attach from a cursor:\n\n```typescript\nconst terminal = await sandbox.terminal.create({\n  command: \"bash\",\n  rows: 24,\n  cols: 80,\n});\n\nconst connection = await terminal.attach(10);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperbrowserai%2Fnode-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhyperbrowserai%2Fnode-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperbrowserai%2Fnode-sdk/lists"}