Use with AI agents

Point Lovable, Cursor, Replit, and other AI coding tools at the SDK so they generate correct, secure code.

Built for AI agents

The SDK is designed for AI coding tools (Lovable, Cursor, Replit, and the like). Every helper is fully typed, so the agent infers the right call straight from the types — and the docs are published as machine-readable text it can pull in directly.

Point your agent at those URLs, or paste the starter prompt below, and it has what it needs.

Prime your agent

Drop this into your agent's context before you ask it to build a native feature.

You're building with @bdk/native (docs: https://docs.native.thebdk.com).

Install:  npm install @bdk/native
Browser:  import { createBdkNative } from "@bdk/native/browser"
          const bdk = createBdkNative();

Rules:
- Use the typed namespaced helpers: bdk.media.*, bdk.ui.*, bdk.navigation.*,
  bdk.iap.*, bdk.auth.*, bdk.location.*, bdk.device.*, bdk.share.*, bdk.permissions.*.
- Results arrive on an event — subscribe with bdk.on(event, cb) BEFORE you call.
- Outside the app a call resolves with triggered: false; branch on
  !result.triggered to fall back to the web.
- Server features: import from @bdk/native/server/* in backend code only, and
  read credentials from env — never hardcode keys.

Full machine-readable reference: https://docs.native.thebdk.com/llms-full.txt

The patterns to follow

A handful of rules keep generated code correct.

  • Subscribe before you call. Interactive features (camera, pickers, biometrics, purchases) deliver their result on an event, not the returned promise.
  • Branch on !result.triggered. Outside the native app a call doesn't run — handle that path so your web build keeps working.
  • Keep server code on the server. @bdk/native/server/* runs on your backend with your credentials; never import it into a browser bundle.
import { createBdkNative } from "@bdk/native/browser";

const bdk = createBdkNative();

// Subscribe first…
bdk.on("photoCaptured", (photo) => console.log(photo.fileUrl));

// …then call. Outside the app, fall back to the web.
const result = await bdk.media.capturePhoto();
if (!result.triggered) openWebFilePicker();

Keys stay in the environment

Agents copy your examples closely, so every example here reads credentials from the environment. Follow the same rule: pass keys from env (or a secrets manager), never in client code or source.

Server helpers read their credentials from arguments or environment variables. Don't hardcode API keys, and never ship a server import to the browser.

import { sendPushNotification } from "@bdk/native/server/onesignal";

await sendPushNotification({
  message: "Your order shipped",
  playerIds: [playerId],
  oneSignalAppId: process.env.ONESIGNAL_APP_ID,
  oneSignalApiKey: process.env.ONESIGNAL_API_KEY
});