Node.js SDK

High-performance, zero-dependency client for fetching secrets in real-time.

Installation

npm install @customkeys-sdk/node

Basic Usage

const { CustomKeysClient } = require('@customkeys-sdk/node'); const client = new CustomKeysClient({ token: process.env.CUSTOMKEYS_TOKEN, env: "production" }); async function main() { // Fetch a single secret const dbUrl = await client.get('DATABASE_URL'); // Fetch all secrets for the environment const secrets = await client.getAll(); }

Advanced Features

Real-time Invalidations

The SDK automatically connects to our WebSocket cluster. When a secret is rotated or updated in the dashboard, the SDK evicts the local cache and fetches the new value — no app restart required.

Cache Management

By default, the SDK caches secrets for 5 minutes. You can customize this:

const client = new CustomKeysClient({ token: "...", env: "...", cacheTTL: 300 // in seconds });

Falling Back to Polling

In environments where WebSockets are restricted, the SDK seamlessly falls back to periodic polling.

Last updated: 4/20/2026Report Issue