Skip to content

TypeScript SDK ​

Official TypeScript SDK for the FAST platform. Zero dependencies. Works in Node.js 18+, Deno, Bun, and edge runtimes.


Install ​

bash
npm install @fundedfast/sdk

Quick Start ​

typescript
import { FastClient } from '@fundedfast/sdk';

const fast = new FastClient({ apiKey: process.env.FAST_API_KEY! });

// Forward a bet
await fast.bets.ingest({
  userId: 'player-42',
  externalBetId: 'BET-001',
  stakeAmount: 5.00,
  odds: 2.10,
  status: 'placed',
});

// Check progress
const progress = await fast.users.getProgress('player-42');

Namespaces ​

Operator (integration) ​

NamespacePurpose
fast.challengesPurchase, list tiers, tier terms, leaderboard
fast.betsValidate, ingest, batch ingest
fast.usersProgress, history, withdrawals, continue/refund choices, achievements, rewards, tournaments, loyalty
fast.eventsSSE token issuance and stream URL
fast.reconciliationCross-reference bet data
fast.widgetWidget module toggles and branding config
fast.sandboxReset staging data

Admin (backoffice) ​

NamespacePurpose
fast.admin.challengeTiersCRUD challenge tiers
fast.admin.rulesetsCRUD rulesets
fast.admin.betsList, settle, bulk operations
fast.admin.webhooksDeliveries, retry, dead letters, rotate secret, post-bet hook dead letters
fast.admin.settingsIntegration mode, URLs, theme, currency, widget layout
fast.admin.bonusesOffers, active bonuses, stats
fast.admin.missionsCRUD missions, stats
fast.admin.tournamentsCRUD tournaments, cancel, settle, invite
fast.admin.loyaltyConfig, tiers, user management
fast.admin.achievementsCRUD achievements, grant, GDPR export/erase
fast.admin.rewardsGrant, revoke, history
fast.admin.rewardRulesCRUD reward rules
fast.admin.selfExclusionExclude/lift users
fast.admin.adaptersPayload field mapping
fast.admin.reconciliationReconciliation flags
fast.admin.auditAudit log queries, GDPR bulk export, retention policy
fast.admin.analyticsOverview, challenges, revenue, users, funnel, engagement, benchmarks
fast.admin.notificationsNotification preferences
fast.admin.notificationChannelsSlack/Teams/Discord/custom channels
fast.admin.usersUser lookup, revoke funded account
fast.admin.templatesBrowse and clone challenge templates
fast.admin.supportSupport requests to the FAST team

Configuration ​

typescript
const fast = new FastClient({
  apiKey: 'key-...',
  baseUrl: 'https://api.fundedfast.eu/v1',  // default
  timeout: 10_000,                           // default 10s
  retry: { maxRetries: 3 },                  // exponential backoff; POSTs reuse one X-Idempotency-Key across retries
  debug: false,                              // console logging

  // Observability hooks
  onRequest: ({ method, url }) => logger.info(`${method} ${url}`),
  onResponse: ({ status, durationMs }) => metrics.record(status, durationMs),
});

Error Handling ​

typescript
import { FastApiError, FastTimeoutError, FastNetworkError } from '@fundedfast/sdk';

try {
  await fast.bets.ingest(bet);
} catch (err) {
  if (err instanceof FastApiError) {
    // err.status, err.code, err.correlationId, err.isRetryable
  } else if (err instanceof FastTimeoutError) {
    // err.timeoutMs
  } else if (err instanceof FastNetworkError) {
    // err.cause
  }
}

Webhook Verification ​

typescript
import { verifyWebhookSignature, parseWebhookEvent } from '@fundedfast/sdk/webhooks';

const valid = await verifyWebhookSignature(rawBody, signature, secret);
const event = parseWebhookEvent(rawBody);

rawBody must be the request body exactly as received (a string), not JSON.stringify of a parsed object; signature is the X-Webhook-Signature header.


Dual Build ​

Ships ESM and CommonJS. Both fully typed.

typescript
// ESM
import { FastClient } from '@fundedfast/sdk';

// CommonJS
const { FastClient } = require('@fundedfast/sdk');

BLACKLINE CONSULTING d.o.o.