connectedbrandapp_8f2c...21ad · synced 48 seconds ago

SDK-backed admin center

EH
live

1,248

OAuth sessions

99.98% success · secret due

live

18

EAV entities

3 synced today

live

8,420

AI credits

of 10,000 left

live

3/4

Published terms

refund policy draft

Runtime contract

lazy clients
// lib/brandapp-sdk.ts
import { createReoptEavClient } from "@reopt-ai/brandapp-sdk/eav";
import { createReoptTermsClient } from "@reopt-ai/brandapp-sdk/terms";

type BrandappClients = {
  eav: ReturnType<typeof createReoptEavClient>;
  terms: ReturnType<typeof createReoptTermsClient>;
};

let cachedClients: BrandappClients | undefined;

function readConfig() {
  return {
    clientId: process.env.BRANDAPP_CLIENT_ID!,
    clientSecret: process.env.BRANDAPP_CLIENT_SECRET!,
    brandappId: process.env.BRANDAPP_ID!,
    baseUrl: process.env.REOPT_BASE_URL,
  };
}

export function getBrandappClients() {
  if (!cachedClients) {
    const config = readConfig();
    cachedClients = {
      eav: createReoptEavClient(config),
      terms: createReoptTermsClient(config),
    };
  }
  return cachedClients;
}

Health checks

SDK verifier

verifies server-only config before release

ready

AI provider

Vercel AI SDK UIMessage stream

streaming

AI budget guard

enable before image or long reasoning runs

watch

Webhook delivery

terms.published failed at customer endpoint

failed

EAV schema

2 optional attrs need review

watch

Terms fallback

refund draft falls back to i18n copy

review

Auth session

expires in 58 minutes

fresh

OAuth secret

rotation due within 7 days

due

SDK client cache

route handlers reuse server clients

ready

BrandApp doctor

run before publishing config changes

ready

Operations log

2 of 2 events

SDK sync completed

ok

EAV, terms, auth, and AI clients checked 48 seconds ago

Schema drift detected

check

2 optional EAV attrs need owner review

reopt design example