SDK reference

SDK overview

One package tracks events, identifies users and serves feature flags, in the browser and on your server.

bun add @databuddy/sdk
app/layout.tsx
import { DatabuddyProvider } from "@databuddy/sdk/react";

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <body>
        <DatabuddyProvider clientId={process.env.NEXT_PUBLIC_DATABUDDY_CLIENT_ID} />
        {children}
      </body>
    </html>
  );
}

Then call track("signup_clicked") from @databuddy/sdk anywhere. See React.

Pick an entry point

ImportFor
@databuddy/sdkBrowser functions: track, identify, reset, init, defineFlag
@databuddy/sdk/reactDatabuddyProvider and the flag hooks
@databuddy/sdk/vueThe <Databuddy> component and flag composables
@databuddy/sdk/nodeServer events and server flags
@databuddy/sdk/agentsAI crawler and agent traffic from your server
@databuddy/sdk/mcpTool calls to your MCP server
@databuddy/sdk/posthog, /posthog/react, /posthog/nodeDrop-in PostHog adapters
@databuddy/sdk/vite, /next, /sourcemapsSource map uploads
@databuddy/nuxtA separate package: the Nuxt module

Every browser option is in the configuration reference. To check events, identity and flags on a running page, add DevTools.

How is this guide?