/brightdata-pack:brightdata-reference-architecturefrom brightdata-pack
Provides a production-ready project layout and integration patterns for Bright Data scraping systems, covering Web Unlocker, Scraping Browser, SERP API, and Datasets API.
Ships in brightdata-pack. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Production-ready architecture for Bright Data scraping systems. Covers project layout, data pipeline design, and integration patterns for Web Unlocker, Scraping Browser, SERP API, and Datasets API.
my-scraper/
├── src/
│ ├── brightdata/
│ │ ├── proxy.ts # Proxy config helper (zone, country, session)
│ │ ├── client.ts # Axios client with proxy + retry
│ │ ├── browser.ts # Scraping Browser connection manager
│ │ ├── api.ts # REST API client (trigger, snapshot)
│ │ ├── cache.ts # Response cache (LRU + optional Redis)
│ │ └── types.ts # Shared TypeScript interfaces
│ ├── scrapers/
│ │ ├── product-scraper.ts # Domain-specific scraper
│ │ ├── serp-scraper.ts # Search result collector
│ │ └── parser.ts # HTML → structured data (cheerio)
│ ├── pipeline/
│ │ ├── scheduler.ts # Cron-based scraping scheduler
│ │ ├── processor.ts # Raw HTML → clean data
│ │ └── storage.ts # Database/file output
│ ├── webhooks/
│ │ └── brightdata.ts # Webhook delivery handler
│ └── api/
│ ├── health.ts # Health check endpoint
│ └── scrape.ts # On-demand scrape endpoint
├── tests/
│ ├── unit/ # Mocked tests (no proxy needed)
│ ├── integration/ # Live proxy tests
│ └── fixtures/ # Cached HTML for testing
├── config/
│ ├── zones.json # Zone configuration per environment
│ └── targets.json # Target URLs and scraping schedules
└── .env.example
┌──────────────────────────────────────────────────────┐
│ API / Scheduler │
│ (On-demand scrape, cron jobs, webhooks) │
├──────────────────────────────────────────────────────┤
│ Scraper Layer │
│ (Product scraper, SERP scraper, custom parsers) │
├────────────┬─────────────────┬───────────────────────┤
│ Web │ Scraping │ SERP / Datasets │
│ Unlocker │ Browser │ API │
│ (Proxy) │ (WebSocket) │ (REST) │
├────────────┴─────────────────┴───────────────────────┤
│ Bright Data Infrastructure Layer │
│ (Proxy config, retry, cache, session management) │
├──────────────────────────────────────────────────────┤
│ Storage / Pipeline │
│ (Database, file output, webhook delivery) │
└──────────────────────────────────────────────────────┘
// src/brightdata/client.ts
import axios, { AxiosInstance } from 'axios';
import https from 'https';
import { chromium } from 'playwright';
export class BrightDataClient {
private proxyClient: AxiosInstance;
private apiToken: string;
constructor(private config: {
customerId: string;
zone: string;
zonePassword: string;
apiToken: string;
}) {
this.apiToken = config.apiToken;
this.proxyClient = axios.create({
proxy: {
host: 'brd.superproxy.io',
port: 33335,
auth: {
username: `brd-customer-${config.customerId}-zone-${config.zone}`,
password: config.zonePassword,
},
},
httpsAgent: new https.Agent({ keepAlive: true, rejectUnauthorized: false }),
timeout: 60000,
});
}
// Web Unlocker — simple HTTP through proxy
async scrape(url: string, country?: string): Promise<string> {
const response = await this.proxyClient.get(url);
return response.data;
}
// Scraping Browser — Playwright over CDP
async scrapeWithBrowser(url: string, extract: (page: any) => Promise<any>) {
const auth = `brd-customer-${this.config.customerId}-zone-scraping_browser1:${this.config.zonePassword}`;
const browser = await chromium.connectOverCDP(`wss://${auth}@brd.superproxy.io:9222`);
try {
const page = await browser.newPage();
await page.goto(url, { waitUntil: 'domcontentloaded', timeout: 60000 });
return await extract(page);
} finally {
await browser.close();
}
}
// Web Scraper API — async bulk collection
async triggerCollection(datasetId: string, inputs: any[]) {
const response = await fetch(
`https://api.brightdata.com/datasets/v3/trigger?dataset_id=${datasetId}&format=json`,
{
method: 'POST',
headers: { 'Authorization': `Bearer ${this.apiToken}`, 'Content-Type': 'application/json' },
body: JSON.stringify(inputs),
}
);
return response.json();
}
}
// src/pipeline/scheduler.ts
import cron from 'node-cron';
interface ScrapeJob {
name: string;
urls: string[];
product: 'web_unlocker' | 'scraping_browser' | 'datasets_api';
schedule: string; // cron expression
parser: (html: string) => any;
}
export function startScheduler(jobs: ScrapeJob[], client: BrightDataClient) {
for (const job of jobs) {
cron.schedule(job.schedule, async () => {
console.log(`Running job: ${job.name}`);
if (job.product === 'datasets_api') {
await client.triggerCollection('dataset_id', job.urls.map(url => ({ url })));
} else {
for (const url of job.urls) {
const html = await client.scrape(url);
const data = job.parser(html);
await saveToDatabase(job.name, data);
}
}
});
}
}
// config/zones.json
{
"development": {
"web_unlocker": "web_unlocker_dev",
"scraping_browser": "scraping_browser_dev",
"api_datasets": true
},
"production": {
"web_unlocker": "web_unlocker_prod",
"scraping_browser": "scraping_browser_prod",
"api_datasets": true
}
}
| Scenario | Product | Why |
|---|---|---|
| Simple HTML pages | Web Unlocker | Cheapest, fastest |
| JavaScript SPA | Scraping Browser | Needs browser rendering |
| Search results | SERP API | Pre-parsed JSON output |
| 1000+ URLs one-time | Web Scraper API | Async, handles parallelism |
| Amazon/LinkedIn/etc. | Pre-built Datasets | No code needed |
| Login-required pages | Scraping Browser + sticky session | Session persistence |
| Issue | Cause | Solution |
|---|---|---|
| Mixed product confusion | Wrong zone for task | Use decision matrix above |
| Circular dependencies | Tight coupling | Keep scraper layer separate from proxy layer |
| Test pollution | Shared mocks | Use dependency injection |
| Config mismatch | Wrong environment | Load zone config from zones.json |
For multi-environment setup, see brightdata-deploy-integration.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
18 skills in this plugin
/brightdata-ci-integrationConfigure Bright Data CI/CD integration with GitHub Actions and testing.
Use when setting up automated testing, configuring CI pipelines,
or integrating Bright Data tests into your build process.
Trigger with phrases like "brightdata CI", "brightdata GitHub Actions",
"brightdata automated tests", "CI brightdata".
/brightdata-common-errorsDiagnose and fix Bright Data common errors and exceptions.
Use when encountering Bright Data errors, debugging failed requests,
or troubleshooting integration issues.
Trigger with phrases like "brightdata error", "fix brightdata",
"brightdata not working", "debug brightdata".
/brightdata-core-workflow-aScrape structured data with Bright Data Scraping Browser using Playwright/Puppeteer.
Use when scraping JavaScript-rendered pages, SPAs, or sites requiring browser interaction.
Trigger with phrases like "brightdata scraping browser", "brightdata playwright",
"brightdata puppeteer", "scrape SPA with brightdata", "browser scraping".
/brightdata-core-workflow-bExecute Bright Data secondary workflow: Core Workflow B.
Use when implementing secondary use case,
or complementing primary workflow.
Trigger with phrases like "brightdata secondary workflow",
"secondary task with brightdata".
/brightdata-cost-tuningOptimize Bright Data costs through tier selection, sampling, and usage monitoring.
Use when analyzing Bright Data billing, reducing API costs,
or implementing usage monitoring and budget alerts.
Trigger with phrases like "brightdata cost", "brightdata billing",
"reduce brightdata costs", "brightdata pricing", "brightdata expensive", "brightdata budget".
/brightdata-debug-bundleCollect Bright Data debug evidence for support tickets and troubleshooting.
Use when encountering persistent issues, preparing support tickets,
or collecting diagnostic information for Bright Data problems.
Trigger with phrases like "brightdata debug", "brightdata support bundle",
"collect brightdata logs", "brightdata diagnostic".
npx claudepluginhub flight505/skill-forge --plugin brightdata-packOther plugins' skills for the same job