🛡️Gatekeeper/ SDKs

Both SDKs wrap the same /v1 control plane. Pick the language you ship in, install it, then point the client at a Gatekeeper instance with a base URL (and an optional bearer token).

Requirements#

SDKPackageRuntime
TypeScript@orkait/sdkNode 18+, Bun, browsers, or Cloudflare Workers (anywhere fetch exists)
Pythongatekeeper-sdkPython 3.9+ (uses httpx)

Install#

The npm package is @orkait/sdk. Install with your package manager of choice.

# npm
npm install @orkait/sdk
 
# bun
bun add @orkait/sdk

The import module is @orkait/sdk:

import { GatekeeperCore, AuthService } from '@orkait/sdk';

Point the client at an instance#

Every client is built over a single GatekeeperCore, which holds the base URL, an optional bearer token, and the transport. The base URL is the origin of your Gatekeeper deployment. The SDK appends the /v1 version prefix for you (and will not double it if your URL already ends in /v1).

  1. Get the base URL of your Gatekeeper instance.

    • Running locally with Bun: http://localhost:8787 (see the Quickstart).
    • Deployed to Cloudflare Workers: your *.workers.dev URL or custom domain.
  2. Construct a core with that base URL.

    import { GatekeeperCore } from '@orkait/sdk';
     
    const core = new GatekeeperCore({
      baseUrl: 'https://gatekeeper-api.example.workers.dev',
    });
  3. Optionally pass a token up front, or set it later with setToken / set_token after you log in.

    const core = new GatekeeperCore({
      baseUrl: 'https://gatekeeper-api.example.workers.dev',
      token: 'an-access-token',
    });

Configure from environment#

Instead of hard-coding the base URL and token, build the core from environment variables. Both SDKs read the same two variables.

VariablePurpose
GATEKEEPER_BASE_URLRequired. Origin of the Gatekeeper instance.
GATEKEEPER_TOKENOptional. Bearer access token applied to authenticated calls.
import { GatekeeperCore } from '@orkait/sdk';
 
// Reads GATEKEEPER_BASE_URL (+ GATEKEEPER_TOKEN if set). Overrides win.
const core = GatekeeperCore.fromEnv();

Global configuration#

The core accepts a few global options applied to every request: a custom transport, a request timeout, default headers, and a user agent.

const core = new GatekeeperCore({
  baseUrl: 'https://gatekeeper-api.example.workers.dev',
  token: 'an-access-token',
  timeoutMs: 10_000,
  defaultHeaders: { 'x-trace': 'abc' },
  userAgent: 'myapp/1.0',
});

Pass fetch to supply a custom transport (a Workers service binding, a test SELF.fetch, or a mock).

Next, walk through your first end-to-end flow in the Quickstart.