Configuration
VeloraClient accepts an optional ClientOptions object. All fields are optional — the SDK applies sensible defaults and reads from well-known environment variables where possible.
ClientOptions#
Type signature
interface ClientOptions {
/** Velora API key. Defaults to globalThis.VELORA_API_KEY. */
apiKey?: string
/** Base URL override. Defaults to globalThis.VELORA_API_URL ?? DEFAULT_BASE_URL. */
baseUrl?: string
/** Custom fetch implementation. Required in Node.js < 18. */
fetch?: typeof fetch
}| Option | Type | Default | Description |
|---|---|---|---|
apiKey | string | VELORA_API_KEY env var | API key sent as Authorization: Bearer on every request |
baseUrl | string | https://velora-api.psalinks.com | Base URL for all API requests. Uses VELORA_API_URL env var as fallback |
fetch | FetchLike | globalThis.fetch | Fetch implementation. Pass node-fetch in Node.js environments < 18 |
Examples#
ts
// API key from VELORA_API_KEY env var, base URL from DEFAULT_BASE_URL
import { VeloraClient } from '@rimora/velora'
const client = new VeloraClient()DEFAULT_BASE_URL#
The package exports DEFAULT_BASE_URL so you can reference or override the constant in tests or wrapper code.
ts
import { DEFAULT_BASE_URL } from '@rimora/velora'
console.log(DEFAULT_BASE_URL) // https://velora-api.psalinks.comOption precedence#
For baseUrl, the SDK applies this resolution order: constructor option › globalThis.VELORA_API_URL › DEFAULT_BASE_URL. This means you can set the URL in your environment without rebuilding the SDK.
In Cloudflare Workers or Deno, you can set
globalThis.VELORA_API_URL at the top of your worker/script to point the SDK at a staging environment without changing code.