Skip to content

ServerClientOptions

ServerClientOptions<S> = object

Options for createServerClient. S is one site’s schema, indexed out of the types edgekit types pull generates: createServerClient<EdgeKitDecisions['site_example']>({ siteId: 'site_example', … }).

Pass the site, not all of EdgeKitDecisions. TypeScript has no partial type-argument inference, so createServerClient<EdgeKitDecisions>(…) drops the 'site_example' literal and leaves only the feature names every site shares, which is often none. With the site as the type argument, siteId: S['id'] makes calling a feature on a site that does not run it a compile error.

S extends SiteSchema

apiKey: string

A site-pinned tenant API key from the console. Keep it on your server.


baseUrl: string

Your tenant host, as an absolute URL, e.g. https://edgekit.example.com. Required: there is no default, and the client does not discover it.


siteId: S["id"]

The site this client serves. It must be S’s id and the site the API key is pinned to; the route answers 403 on a mismatch. One client serves one site: three sites need three keys and three clients.


optional timeoutMs?: number

Request timeout in milliseconds. Defaults to 5000.