browserlayer / docsPrivate alphaDashboard ↗

Start here

Websites → endpoints and syncsInstallRun your first endpointAtlas walkthrough

Build integrations

Project structureCapture a websiteBuild with your coding agentEndpointsSteps and connector flowsTyped referencesAuthenticationUser input and MFABrowser interactions and HTTPSync recordsCheckpoints and deletionsTest an integrationDebug in Studio

Use in your app

Connect accounts with hosted LinkCall an endpointConsume sync recordsReceive webhooks

Deploy

Deploy and verify

Reference

SDK referenceHTTP APICLI reference
Build integrationsMarkdown

Sync records

A sync reads website data on a schedule and publishes records your app can consume.

integrations/atlas-demo/syncs/bookings.ts:

ts
import { randomUUID } from "node:crypto";
import { createSync } from "@browserlayer/sdk";
import { z } from "zod";
import listBookings from "../connector/flows/list-bookings.js";
import { publicBookings } from "../models/bookings.js";
import { Booking } from "../models/booking.js";
export default createSync({
  description:
    "Keep the application's bookings current, including cancellations and deletions.",
  connection: "required",
  schedule: "every 30 seconds",
  model: Booking,
  checkpoint: z.null(),
  async exec(ctx) {
    const scan = await ctx.step("scan", async () => randomUUID());
    const source = await ctx.run(listBookings, {});
    const records = await publicBookings(ctx, source);
    await ctx.publish("snapshot", records, {
      checkpoint: null,
      scan,
      completeScan: true,
    });
  },
});

This example publishes a complete snapshot. The connector and model are supplied by the Atlas tutorial.

Inspect and control locally

sh
browserlayer syncs list <connection-id> --local
browserlayer syncs trigger <connection-id> bookings --local
browserlayer syncs records <connection-id> bookings --local
browserlayer syncs pause <connection-id> bookings --local
browserlayer syncs start <connection-id> bookings --local

Keep browserlayer start running. Connected accounts get schedules automatically. Waiting runs prevent overlap. pause prevents the next occurrence; it does not cancel the current run. trigger enables the schedule and makes it due now.

Use the same commands with --env development after deploying.

OptionRequiredExample
connectionYes"required"
scheduleYes"every 5 minutes"
modelYesZod object with string id
checkpointYesz.null() or a source progress schema

Next: Checkpoints and deletions, then consume records.

← Browser interactions and HTTPCheckpoints and deletions →
On this pageInspect and control locally