Skip to content
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
3cdb1e7
init
syd-shields Mar 30, 2026
2985f0f
add a build step that turns new ts templates into js in CI
syd-shields Mar 30, 2026
2942385
add file filter to build script
syd-shields Apr 8, 2026
6cc2dd6
add built js templates
syd-shields Apr 8, 2026
969f904
add exclude flag
syd-shields Apr 8, 2026
f3f7984
add comments to explain build filters
syd-shields Apr 8, 2026
ae17bb9
add build step to run on dev branch in CI
syd-shields Apr 8, 2026
48fc473
regen templats on each pr merge
syd-shields Apr 10, 2026
8ea723d
include all readme, package json and env examples in build
syd-shields Apr 10, 2026
c7dbcce
get paths to build js files first so that the entire repo isn't delet…
syd-shields Apr 14, 2026
fc8fd04
remove built js files
syd-shields May 4, 2026
3173ce4
only build js files to production branch
syd-shields May 4, 2026
ac53074
remove build javascript workflow
syd-shields May 4, 2026
541e995
before recursing, skip directories whose basename is in DEFAULT_EXCLU…
syd-shields May 4, 2026
b17759b
before recursing, skip directories whose basename is in DEFAULT_EXCLU…
syd-shields May 4, 2026
ed33a0c
if there are zero playground compatible templates, do not call build-…
syd-shields May 4, 2026
5b91a7e
add test-production branch support
syd-shields May 4, 2026
5d56277
build js templates
syd-shields May 4, 2026
0070df7
remove built js files
syd-shields May 11, 2026
009a835
add pkg.type = module to adaptPackageJsonForJavaScript so it's uncond…
syd-shields May 11, 2026
a240b02
consolidate workflows to one plauground.yml file to remove need to ma…
syd-shields May 11, 2026
a143d03
write contents to test-production and production branches
syd-shields May 11, 2026
1ba6a37
use hardcoded branch names instead of unused var
syd-shields May 11, 2026
3e85383
add --no-verify flag to build
syd-shields May 11, 2026
912d149
add stripLeadingTscBuildCommand to handle when multiple commands exis…
syd-shields May 13, 2026
2a862c0
add parseBuildOptions to parse CLI flags at once instead of in multip…
syd-shields May 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# When merging changes under these paths to `production`, require review from the
# Dashboard team.
/javascript/ @browserbase/dashboard
/scripts/fetch-playground-typescript-dirs.mjs @browserbase/dashboard
/scripts/validate-playground-templates.mjs @browserbase/dashboard
/scripts/playground-ci.mjs @browserbase/dashboard
/scripts/lib/playground-checks.mjs @browserbase/dashboard
/.github/workflows/playground-production.yml @browserbase/dashboard
60 changes: 60 additions & 0 deletions .github/workflows/playground-production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Validates TypeScript → JavaScript builds for templates exposed by the public
# templates API (playgroundRunnable). Intended for the `production` branch workflow
# described in https://github.com/browserbase/templates (branch protection: require
# this check + Dashboard team review before merge).
#
# Set TEMPLATES_API_URL to override the default public endpoint (e.g. staging).

name: Playground templates (production)

on:
pull_request:
branches:
- production
push:
branches:
- production
workflow_dispatch:

permissions:
contents: write

jobs:
playground-templates:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Clean javascript output directory
run: rm -rf javascript && mkdir -p javascript

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build and validate playground TypeScript templates
env:
TEMPLATES_API_URL: ${{ vars.TEMPLATES_API_URL }}
run: pnpm run ci:playground

- name: Commit and push playground javascript (push to production only)
if: github.event_name == 'push'
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add -A javascript/
if git diff --staged --quiet; then
echo "No javascript changes to commit."
else
git commit -m "chore: regenerate playground javascript templates"
git push
fi
60 changes: 60 additions & 0 deletions .github/workflows/playground-test-production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Validates TypeScript → JavaScript builds for templates exposed by the public
# templates API (playgroundRunnable). Intended for the `test-production` branch workflow
# described in https://github.com/browserbase/templates (branch protection: require
# this check + Dashboard team review before merge).
#
# Set TEMPLATES_API_URL to override the default public endpoint (e.g. staging).

name: Playground templates (test production)

on:
pull_request:
branches:
- test-production
push:
branches:
- test-production
workflow_dispatch:

permissions:
contents: write

jobs:
playground-templates:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Clean javascript output directory
run: rm -rf javascript && mkdir -p javascript

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build and validate playground TypeScript templates
env:
TEMPLATES_API_URL: ${{ vars.TEMPLATES_API_URL }}
run: pnpm run ci:playground

- name: Commit and push playground javascript (push to test-production only)
if: github.event_name == 'push'
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add -A javascript/
if git diff --staged --quiet; then
echo "No javascript changes to commit."
else
git commit -m "chore: regenerate playground javascript templates"
git push
fi
Comment thread
cursor[bot] marked this conversation as resolved.
Outdated
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ Templates use the Model Gateway to route LLM requests -- you only need your `BRO

Each template's README contains detailed installation steps, environment variable requirements, and troubleshooting guides.

### TypeScript and generated JavaScript

- **Source of truth:** edit templates under `typescript/`. The `javascript/` tree is generated output, not authored by hand for day-to-day changes.
- **Local only:** run `pnpm run build:javascript` when you want a full mirror of `typescript/` into `javascript/` on your machine (for example to smoke-test the transpiler or compare JS output). There is **no** GitHub Actions workflow that builds the full tree into the repo anymore.
- **Playground releases:** the `production` branch is updated by CI (`.github/workflows/playground-production.yml`), which builds and commits **only** templates that are playground-runnable per the public templates API, then validates them.

## Resources

### Documentation
Expand Down
2 changes: 2 additions & 0 deletions javascript/amazon-global-price-comparison/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Browserbase credentials - get these from https://www.browserbase.com/settings
BROWSERBASE_API_KEY=your_browserbase_api_key
66 changes: 66 additions & 0 deletions javascript/amazon-global-price-comparison/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Amazon Global Price Comparison

## AT A GLANCE

- Goal: compare Amazon product prices across multiple countries using geolocation proxies.
- Uses Browserbase's managed proxy infrastructure to route traffic through different geographic locations (US, UK, Germany, France, Italy, Spain).
- Extracts structured product data (name, price, rating, reviews) using Stagehand's extraction capabilities with Zod schema validation.
- Sequential processing shows how different proxy locations return different pricing from the same Amazon search.
- Docs → https://docs.browserbase.com/features/proxies

## GLOSSARY

- geolocation proxies: route traffic through specific geographic locations (city, country) to access location-specific content and pricing
Docs → https://docs.browserbase.com/features/proxies#set-proxy-geolocation
- extract: extract structured data from web pages using natural language instructions and Zod schemas
Docs → https://docs.stagehand.dev/basics/extract
- proxies: Browserbase's managed proxy infrastructure supporting 201+ countries for geolocation-based routing
Docs → https://docs.browserbase.com/features/proxies

## QUICKSTART

1. cd amazon-global-price-comparison
2. pnpm install
3. cp .env.example .env
4. Add your Browserbase API key to .env
5. pnpm start

## EXPECTED OUTPUT

- Creates Browserbase sessions with geolocation proxies for each country (US, UK, DE, FR, IT, ES)
- Navigates to Amazon search results through location-specific proxies
- Extracts product name, price, rating, and review count for each location
- Displays formatted comparison table showing price differences across countries
- Outputs JSON results for programmatic use

## COMMON PITFALLS

- Browserbase Developer plan or higher is required to use proxies
- "Cannot find module": ensure all dependencies are installed (`pnpm install`)
- Missing credentials: verify .env contains BROWSERBASE_API_KEY
- Geolocation fields are case-insensitive (city, country can be any case)
- Amazon may show different products in different regions - comparison works best for globally available products
- ERR_TUNNEL_CONNECTION_FAILED: indicates either a temporary proxy hiccup or a site unsupported by built-in proxies

## USE CASES

• Price arbitrage: Find the best country to purchase products from for international shipping
• Market research: Compare pricing strategies across different Amazon regions
• Competitive analysis: Monitor how competitors price products globally
• Travel shopping: Check prices before international trips to plan purchases

## NEXT STEPS

• Add more countries: Extend the COUNTRIES array with additional regions (Japan, Australia, Canada, etc.)
• Currency conversion: Add real-time currency conversion to normalize prices for comparison
• Price tracking: Store results over time to track price changes across regions
• Email alerts: Send notifications when price drops below a threshold in any country

## HELPFUL RESOURCES

📚 Stagehand Docs: https://docs.stagehand.dev/v3/first-steps/introduction
🎮 Browserbase: https://www.browserbase.com
💡 Try it out: https://www.browserbase.com/playground
🔧 Templates: https://www.browserbase.com/templates
📧 Need help? support@browserbase.com
💬 Discord: http://stagehand.dev/discord
Loading
Loading