Reference
Configuration Reference
Complete reference for all SDK configuration options across client, React, and server packages.
Client SDK Configuration (@sheepit-ai/sdk-js)
| Option | Type | Default | Description |
|---|---|---|---|
apiKey | string | (required) | Your publishable key (lp_pub_*) |
environment | string | "production" | Environment name for flag targeting |
apiUrl | string | "https://api.goatech.ai" | API base URL |
flushInterval | number | 5000 | Milliseconds between event flushes |
flushSize | number | 20 | Events per batch |
maxQueueSize | number | 1000 | Maximum queued events before dropping |
configRefreshInterval | number | 300000 | Flag config refresh interval (5 min) |
retryAttempts | number | 3 | API request retry attempts |
debug | boolean | false | Enable debug logging to console |
onEvent | function | — | Callback for every tracked event |
onDiagnostic | function | — | Subscribe to diagnostic events |
diagnosticBufferSize | number | 100 | Ring buffer size for diagnostics |
goatech.ts
import { GoaTech } from "@sheepit-ai/sdk-js";
const gt = GoaTech.create({
apiKey: "lp_pub_abc_...",
environment: "production",
flushInterval: 10_000,
flushSize: 50,
maxQueueSize: 2000,
debug: process.env.NODE_ENV === "development",
onEvent: (event) => console.log("Event:", event),
});React Provider Configuration (@sheepit-ai/react)
The React provider accepts the same config as the client SDK, plus:
| Option | Type | Default | Description |
|---|---|---|---|
config | GoaTechConfig | (required) | Client SDK configuration object |
user | { id: string; traits?: Record<string, unknown> } | null | — | Current user for automatic identity sync |
Server SDK Configuration (@sheepit-ai/server)
| Option | Type | Default | Description |
|---|---|---|---|
apiKey | string | (required) | Your secret key (lp_sec_*) |
environment | string | "production" | Environment name |
apiUrl | string | "https://api.goatech.ai" | API base URL |
cacheTtl | number | 60000 | Flag config cache TTL (ms) |
flushInterval | number | 5000 | Event flush interval (ms) |
flushSize | number | 50 | Events per batch |
maxBufferSize | number | 10000 | Max buffered events (prevents OOM) |
debug | boolean | false | Enable debug logging |
onDiagnostic | function | — | Subscribe to diagnostic events |
diagnosticBufferSize | number | 100 | Ring buffer size for diagnostics |
Environment Variables (Next.js)
The getGoaTech() helper reads the following environment variables at runtime:
| Variable | Required | Description |
|---|---|---|
GT_SECRET_KEY | Yes | Secret API key (lp_sec_*) |
GT_ENVIRONMENT | No | Environment name (default: "production") |
GT_API_URL | No | API base URL |
Client-side environment variables (for React):
| Variable | Description |
|---|---|
NEXT_PUBLIC_GT_KEY | Publishable API key (lp_pub_*) |