{"id":18826,"library":"storyblok-js-client","title":"Storyblok JS Client","description":"Universal JavaScript SDK for Storyblok's Content Delivery and Management APIs. Version 7.3.0 supports Node.js 18+ and modern browsers, with full TypeScript types included. Released as part of the monoblok monorepo, this package is the core client for fetching and manipulating Storyblok content. It provides a thin wrapper around the REST APIs, with built-in caching, rich text rendering, and component resolver support. Key differentiators: isomorphic (works in Node and browser without polyfills), first-class TypeScript support, and seamless integration with Storyblok's visual editor and preview features. Alternatives like @storyblok/js offer framework-agnostic helpers, but this client is the foundational SDK.","status":"active","version":"7.3.0","language":"javascript","source_language":"en","source_url":"https://github.com/storyblok/monoblok","tags":["javascript","storyblok","api","typescript"],"install":[{"cmd":"npm install storyblok-js-client","lang":"bash","label":"npm"},{"cmd":"yarn add storyblok-js-client","lang":"bash","label":"yarn"},{"cmd":"pnpm add storyblok-js-client","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required for Node.js environments that lack native fetch (pre-Node 18). Optional if using Node 18+ or modern browsers.","package":"isomorphic-fetch","optional":true}],"imports":[{"note":"Default export is the class. CommonJS require works with default export: const StoryblokClient = require('storyblok-js-client').default.","wrong":"const { StoryblokClient } = require('storyblok-js-client')","symbol":"default (StoryblokClient)","correct":"import StoryblokClient from 'storyblok-js-client'"},{"note":"Named export also available. Both work, but named export is preferred for clarity.","wrong":"import StoryblokClient from 'storyblok-js-client'","symbol":"StoryblokClient (named)","correct":"import { StoryblokClient } from 'storyblok-js-client'"},{"note":"RichTextResolver is a named export, not default. Available since v5.","wrong":"import RichTextResolver from 'storyblok-js-client'","symbol":"RichTextResolver","correct":"import { RichTextResolver } from 'storyblok-js-client'"}],"quickstart":{"code":"import StoryblokClient from 'storyblok-js-client';\n\nconst client = new StoryblokClient({\n  accessToken: process.env.STORYBLOK_ACCESS_TOKEN ?? '',\n  cache: { type: 'memory', clear: 'auto' },\n});\n\nasync function main() {\n  try {\n    const response = await client.getStory('home', { version: 'draft' });\n    console.log('Story:', response.data.story);\n  } catch (error) {\n    console.error('Error:', error);\n  }\n}\n\nmain();","lang":"typescript","description":"Initializes the Storyblok client with an access token and in-memory caching, then fetches a story by slug in draft version."},"warnings":[{"fix":"Upgrade to Node 18+ or install isomorphic-fetch and import it before using the client.","message":"Version 7.0.0 dropped support for Node.js < 18 and removed the built-in polyfill for fetch. Users on older Node versions must provide a fetch polyfill like isomorphic-fetch.","severity":"breaking","affected_versions":">=7.0.0"},{"fix":"Update imports: import { RichTextResolver } from 'storyblok-js-client' instead of requiring it from a separate package.","message":"Version 6.0.0 restructured exports: RichTextResolver moved from a separate package to a named export.","severity":"breaking","affected_versions":">=6.0.0"},{"fix":"Replace `client.get('cdn/stories/home', ...)` with `client.getStory('home', ...)`.","message":"The method `get` is deprecated in favor of dedicated methods like `getStory`, `getStories`, `getDataSource`, etc.","severity":"deprecated","affected_versions":">=5.0.0"},{"fix":"Use `const StoryblokClient = require('storyblok-js-client').default;` or switch to ESM imports.","message":"When using CommonJS require(), the default export is nested under `.default`. Many users mistakenly import as `const StoryblokClient = require('storyblok-js-client')` which returns an object with a `default` property.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Install isomorphic-fetch: npm install isomorphic-fetch, then add `import 'isomorphic-fetch'` at the top of your entry file.","cause":"Node.js version < 18 does not have native fetch, and no polyfill was provided.","error":"TypeError: fetch is not a function"},{"fix":"Run `npm install storyblok-js-client` and ensure your import path is correct.","cause":"Package not installed or missing from node_modules.","error":"Cannot find module 'storyblok-js-client'"},{"fix":"Use `const StoryblokClient = require('storyblok-js-client').default;` instead of `const { StoryblokClient } = require('storyblok-js-client');`.","cause":"Using CommonJS require without accessing the default export.","error":"StoryblokClient is not a constructor"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}