{"id":15304,"library":"configcat-js-ssr","title":"ConfigCat SDK for JavaScript SSR","description":"The `configcat-js-ssr` package provides an official ConfigCat SDK for integrating feature flags into Server-Side Rendered (SSR) JavaScript applications, such as those built with Nuxt.js or Vue.js. It allows developers to manage feature toggles remotely via the ConfigCat Dashboard, enabling the separation of releases from deployments and targeting specific user groups. Currently at version 8.5.3, this SDK is in maintenance mode, superseded by the unified ConfigCat SDK for JavaScript. It receives only critical security patches, with official support ending on August 31, 2026. Developers are strongly encouraged to migrate to the new unified SDK, which offers a consolidated experience for both browser and Node.js environments and removes the need for a separate SSR-specific SDK. Its key differentiator was its specialized focus on SSR environments, but this has been absorbed by the unified SDK.","status":"maintenance","version":"8.5.3","language":"javascript","source_language":"en","source_url":"https://github.com/configcat/js-ssr-sdk","tags":["javascript","feature flags","configcat","nuxtjs","vue","ssr","config","configuration","typescript"],"install":[{"cmd":"npm install configcat-js-ssr","lang":"bash","label":"npm"},{"cmd":"yarn add configcat-js-ssr","lang":"bash","label":"yarn"},{"cmd":"pnpm add configcat-js-ssr","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"HTTP client for making API requests to ConfigCat, frequently updated due to security vulnerabilities.","package":"axios","optional":false}],"imports":[{"note":"The `getClient` factory function returns a singleton client instance for a given SDK key. Subsequent calls with the same key return the shared instance. ESM is the primary import method.","wrong":"const configCatClient = require('configcat-js-ssr').getClient;","symbol":"getClient","correct":"import { getClient } from 'configcat-js-ssr';"},{"note":"Used to create a User Object for targeting specific feature flag values based on user attributes.","wrong":"const User = require('configcat-js-ssr').User;","symbol":"User","correct":"import { User } from 'configcat-js-ssr';"},{"note":"This is a common pattern shown in the documentation to import all named exports into a namespace object.","wrong":"import configcat from 'configcat-js-ssr';","symbol":"* as configcat","correct":"import * as configcat from 'configcat-js-ssr';"}],"quickstart":{"code":"import { getClient, User } from 'configcat-js-ssr';\n\n// Replace with your actual SDK Key from the ConfigCat Dashboard\nconst SDK_KEY = process.env.CONFIGCAT_SDK_KEY ?? 'YOUR_SDK_KEY';\n\nasync function initializeAndFetchFeatureFlags() {\n  if (SDK_KEY === 'YOUR_SDK_KEY') {\n    console.warn('Please replace YOUR_SDK_KEY with your actual ConfigCat SDK Key.');\n  }\n\n  const configCatClient = getClient(SDK_KEY);\n\n  // Example: Get a feature flag for a generic user\n  const isMyAwesomeFeatureEnabled = await configCatClient.getValueAsync('isMyAwesomeFeatureEnabled', false);\n  console.log(`'isMyAwesomeFeatureEnabled' for generic user: ${isMyAwesomeFeatureEnabled}`);\n\n  if (isMyAwesomeFeatureEnabled) {\n    console.log('Doing the new thing!');\n  } else {\n    console.log('Doing the old thing.');\n  }\n\n  // Example: Get a feature flag for a specific user\n  const userObject = new User('some-user-id'); // User ID can be any unique string\n  userObject.setEmail('user@example.com');\n  userObject.setCustom('region', 'eu');\n\n  const valueForSpecificUser = await configCatClient.getValueAsync('isMyAwesomeFeatureEnabled', false, userObject);\n  console.log(`'isMyAwesomeFeatureEnabled' for user 'some-user-id': ${valueForSpecificUser}`);\n\n  // Don't forget to close the client when done (e.g., on app shutdown)\n  // This ensures resources are released, especially important in environments like serverless functions.\n  configCatClient.dispose();\n}\n\ninitializeAndFetchFeatureFlags();\n","lang":"typescript","description":"This quickstart demonstrates how to initialize the ConfigCat client, fetch a feature flag value for both a generic and a specific user, and dispose of the client."},"warnings":[{"fix":"Migrate to the new unified SDK as described in the official ConfigCat documentation: https://configcat.com/docs/sdk-reference/js-ssr/#migration-to-the-new-sdk","message":"This SDK is superseded by the new unified ConfigCat SDK for JavaScript (configcat/js-unified-sdk). It is in maintenance mode and will only receive critical security patches.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Plan and execute migration to the unified ConfigCat SDK before the end-of-life date to ensure continued security and support.","message":"Official support for `configcat-js-ssr` will end on August 31, 2026. After this date, no further updates, including security patches, will be provided for this package.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Always upgrade to the latest available version of `configcat-js-ssr` to ensure all transitive dependency security fixes are applied. Currently, `v8.5.3` or newer is recommended.","message":"Multiple security vulnerabilities (CVE-2025-62718, CVE-2025-58754, CVE-2025-27152, XSS, etc.) have been found and fixed in the `axios` dependency across various `v8.x.x` releases. Running on older versions exposes applications to these risks.","severity":"breaking","affected_versions":"<8.5.3"},{"fix":"Be aware of the singleton behavior. If truly distinct client configurations are needed for the same SDK key within an application's lifecycle, ensure previous instances are explicitly disposed of, or consider using different SDK keys if appropriate. For most SSR scenarios, a single client per SDK key is desired.","message":"The `getClient(\"<sdkKey>\")` factory function returns a singleton instance. While convenient, this means subsequent calls with the same SDK Key will return the same client, which might lead to unexpected behavior if different configurations are intended for different parts of an application lifecycle without explicit client disposal or unique SDK keys.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-21T00:00:00.000Z","next_check":"2026-07-20T00:00:00.000Z","problems":[{"fix":"Verify your SDK Key directly from the ConfigCat Dashboard. Ensure there are no typos, extra spaces, or missing characters. Copy-pasting directly is recommended. Also, check for environment variable issues if the key is loaded from there.","cause":"The provided SDK Key for initializing the ConfigCat client is incorrect or malformed. The logged message now masks most of the key for security.","error":"Error 1100: Your SDK Key seems to be wrong. Please check your SDK Key. (SDK_KEY: *****YOUR-SDK-KEY-PARTIAL)"},{"fix":"Ensure `getClient()` is called with a valid SDK Key and that the returned client object is assigned and used. Also, verify that the `import { getClient } from 'configcat-js-ssr';` or `import * as configcat from 'configcat-js-ssr';` statement is correct and executes successfully.","cause":"The ConfigCat client instance was not correctly initialized, or the `getValueAsync` method is being called on an undefined or improperly imported object.","error":"TypeError: Cannot read properties of undefined (reading 'getValueAsync') or configCatClient.getValueAsync is not a function"}],"ecosystem":"npm"}