Local Development
Build and refine experiment variation code on your own machine, in your own IDE, with live preview in a real browser. Edit TypeScript and SCSS files, see changes instantly in Chrome, and push the finished code to the platform when you are ready.
Prerequisites
- Node.js 18+ — required to run the CLI and compile TypeScript/SCSS.
- Personal access token — create one in Account Settings → Auth Tokens. See Personal Access Tokens.
Install the CLI
Install the CLI globally using npm:
1npm install -g @avsbhq/cliVerify by running avsb --version. Then authenticate:
1$ avsb login2Paste your personal access token: pat_...3Logged in as jane@example.com (Acme Corp)Install the Chrome extension
The Chrome extension connects to the CLI dev server and injects your local variation code into the real website. Install it from the Chrome Web Store. If the store listing is not available yet (it is currently under review), you can download the extension zip — unzip it, go to chrome://extensions, enable Developer mode, click Load unpacked, and select the unzipped folder.
After installing, click the puzzle-piece icon in the Chrome toolbar and pin the A vs B extension so it is always visible.
The workflow
Clone the experiment
1avsb clone 300015Understand the file structure
1.2├── .avsb.json ← Manifest: experiment ID, variation IDs, language choice3├── trigger.ts ← Page trigger logic (read-only — edit in the platform)4├── control/5│ ├── control.ts ← Control variation code6│ └── control.scss ← Control variation styles (usually empty)7└── variant-a/8 ├── variant-a.ts ← Variant A code9 └── variant-a.scss ← Variant A styles.js and .css instead.Start the dev server
1avsb dev4400. Open Chrome and navigate to the website where the experiment targets. The extension connects to the dev server automatically — the terminal will show Chrome extension connected.Edit and see changes live
- CSS/SCSS changes hot-swap instantly — styles are injected without reloading the page.
- JS/TS changes trigger a full page reload so the new code runs clean.
Push to the platform
1avsb pushThe extension popup
Click the A vs B icon in the Chrome toolbar to open the popup. It shows four things:
- Connection status — green if connected to a local
avsb devserver, grey if not. - Active experiment — the experiment matching the current page URL.
- Variation switcher — click any variation to switch to it immediately.
- Event log — a live feed of events tracked on the current page (exposures, conversions, revenue).
How live preview works
The extension receives compiled CSS and JS from the dev server and injects them into the page. It also sets a _avsb_dev cookie that tells the production snippet to skip injection for the experiment being developed locally. Other experiments on the page continue to run normally. When you stop avsb dev, the cookie is cleared on the next page load and the production snippet resumes control.
Conflict detection
If someone edits the variation code in the web editor while you are working locally, avsb push detects the conflict and warns you before overwriting. To pull the remote changes first:
1avsb pull # fetch latest from platform2# manually merge any changes3avsb push # push your merged versionavsb pullreplaces your local variation files with the platform's version. Back up your changes before pulling.CLI command reference
avsb login
Authenticates with your personal access token. Stored securely in your system's credential store.
avsb logout
Removes stored credentials. You will need to log in again.
avsb org
Show, list, or switch your active organization.
1avsb org # show current org2avsb org list # list all orgs3avsb org switch # switch orgavsb clone <shortId | url>
Download an experiment to a local directory by short ID or URL.
1avsb clone 3000152avsb clone https://app.avsb.cloud/projects/123/experiments/exp_abc123avsb dev
Start the file watcher and WebSocket server. Keep it running while you edit. Press Ctrl+C to stop.
avsb status
Show the experiment name, status, and whether local changes are ahead of or behind the platform.
avsb pull
Fetch the latest code from the platform and overwrite local files.
avsb push
Compile and upload local code. Choose to publish or save as pending.