Node SDK
The official Node.js / TypeScript SDK for GGNomad is published as
@ggnomad/sdk. It is a thin
shell over @burdenoff/sdk-libs that mounts the GGNomad domain module plus all
shared platform modules.
Installation
bun add @ggnomad/sdk
# or
npm install @ggnomad/sdk
Environment selection
The SDK defaults to production endpoints. Set BURDENOFF_ENV before
initializing the SDK to target alpha or local:
BURDENOFF_ENV | Workspace endpoint | Global endpoint |
|---|---|---|
prod (default) | https://graphqlworkspaces.burdenoff.com/workspaces/graphql | https://graphql.burdenoff.com/global/graphql |
alpha | https://alphagraphqlworkspaces.burdenoff.com/workspaces/graphql | https://alphagraphql.burdenoff.com/global/graphql |
local | http://localhost:4003/workspaces/graphql | http://localhost:4000/global/graphql |
export BURDENOFF_ENV=alpha
Quick start
import { GgnomadSDK } from '@ggnomad/sdk';
const sdk = new GgnomadSDK({
workspaceEndpoint: 'https://graphqlworkspaces.burdenoff.com/workspaces/graphql',
globalEndpoint: 'https://graphql.burdenoff.com/global/graphql',
});
// Sign in
// Fetch workspaces and issue workspace token
const workspaces = await sdk.auth.fetchWorkspaces();
await sdk.auth.issueWorkspaceToken(workspaces[0].id, workspaces[0].organizationId);
// Use the SDK
const providers = await sdk.ggnomad.providers.list();
const orders = await sdk.ggnomad.orders.list();
Authentication
Email / Password
OAuth2 Device Code Flow
const { userCode, verificationUri, promise } = await sdk.auth.loginWithDeviceCode();
console.log(`Open ${verificationUri} and enter: ${userCode}`);
const tokens = await promise;
OAuth2 Authorization Code + PKCE
const challenge = sdk.auth.getAuthorizationUrl({
redirectUri: 'http://localhost:8400/callback',
scopes: ['openid', 'profile', 'email', 'offline_access'],
});
// Redirect user to challenge.url, then exchange the code:
const tokens = await sdk.auth.exchangeAuthCode(code, challenge.codeVerifier, challenge.redirectUri);
Client Credentials (M2M / App Auth)
const result = await sdk.auth.authenticateApp(clientId, clientSecret);
Workspace Token
await sdk.auth.issueWorkspaceToken(workspaceId, organizationId);
Modules
The SDK mounts each domain as a nested namespace:
| Namespace | Description |
|---|---|
sdk.auth | Sign in/up, OAuth flows, token management |
sdk.ggnomad | GGNomad domain — providers, properties, activities, events, tours, trips, bookings, favorites, analytics |
sdk.billing | Subscriptions, invoices, plans, addons, credits, refunds |
sdk.conversations | Conversation CRUD + settings |
sdk.devportal | Apps, OAuth, API keys, webhooks, delegations |
sdk.export | Export jobs, templates, downloads |
sdk.files | Browse, upload, share files |
sdk.groups | Group management |
sdk.integrations | Third-party integrations + connections |
sdk.notifications | Notification center + preferences |
sdk.organizations | Organizations + invites |
sdk.products | Products, shortcuts, content pages, feature flags |
sdk.rbac | Permissions, role assignment |
sdk.tags | Tag CRUD + tagging |
sdk.workspaces | Workspace CRUD + members + projects + invites |
Configuration
interface GgnomadSDKConfig {
workspaceEndpoint: string; // Workspace gateway GraphQL endpoint
globalEndpoint: string; // Global gateway GraphQL endpoint
oidcIssuer?: string; // OIDC issuer URL (derived from globalEndpoint if omitted)
clientId?: string; // OAuth2 client ID
clientSecret?: string; // OAuth2 client secret
redirectUri?: string; // Redirect URI for auth code flow
apiKey?: string; // API key authentication
accessToken?: string; // Pre-existing access token
refreshToken?: string; // Pre-existing refresh token
workspaceToken?: string; // Pre-existing workspace token
timeout?: number; // Request timeout in ms (default: 30000)
autoRefresh?: boolean; // Auto-refresh tokens (default: true)
onTokenRefresh?: (tokens: TokenPair) => void | Promise<void>;
}
Error handling
import { GgnomadError, AuthenticationError, NetworkError } from '@ggnomad/sdk';
try {
await sdk.auth.signIn({ username: 'invalid', password: 'invalid' });
} catch (error) {
if (error instanceof AuthenticationError) {
console.error('Auth failed:', error.message);
} else if (error instanceof NetworkError) {
console.error('Network error:', error.message);
}
}
Development
git clone https://github.com/algoshred/ggnomad-sdk-node.git
cd ggnomad-sdk-node
bun install
bun run dev # Watch mode
bun run build # Production build
bun run test # Run tests
bun run sanity # All checks (format, lint, type-check, test, build)