Registry / cms / contentfully

contentfully

JSON →
library4.0.2jsnpmunverified

A simple but performant REST client for Contentful that transforms API responses into flat JavaScript objects, stripping metadata and recursively folding linked entries and assets without cloning. Version 4.0.2 is the current stable release, supporting TypeScript 5, React Native, and full Content Delivery API features including custom environments and preview servers. It differentiates from the official Contentful SDK by providing cleaner data structures and built-in asset URL transforms for caching or rewriting.

npm install contentfully
INSTALL
IMPORT
SIG · CONTENTFULLY
C
contentfully
cmsjavascriptv4.0.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Contentfully
import { Contentfully } from 'contentfully'
import Contentfully from 'contentfully'
Named export in ESM; CommonJS require works but ESM is preferred.
Contentfully
const { Contentfully } = require('contentfully')
const Contentfully = require('contentfully')
CommonJS destructured require yields correct named export.
createClient
import { createClient } from 'contentful'
import { createClient } from 'contentfully'
createClient is from 'contentful' package, not contentfully.

Initializes a Contentfully client and fetches entries of a specific content type with pagination.

import { Contentfully } from 'contentfully'; const contentfully = new Contentfully({ accessToken: process.env.CONTENTFUL_ACCESS_TOKEN ?? '', space: process.env.CONTENTFUL_SPACE_ID ?? '' }); interface BlogPost { title: string; body: string; } (async () => { const data = await contentfully.getEntries<BlogPost>({ content_type: 'blogPost', limit: 10 }); console.log(data.items); })();
Debug
Known issues
breakingVersion 2.x removed automatic inclusion of 'include' parameter; you must now set 'include' explicitly for linked assets/entries.
fix
Add 'include: 10' to your query object (or desired depth).
affects: >=2.0.0 <4.0.0
breakingVersion 3.x changed the default host from 'cdn.contentful.com' to 'cdn.contentful.com' (no change) but removed fallback to preview host when environment is 'master'.
fix
Explicitly set 'host' to 'preview.contentful.com' if using preview mode.
affects: >=3.0.0
deprecatedThe 'Contentfully' constructor option 'secure' is deprecated and ignored in contentful SDK v10+.
fix
Remove 'secure' option; connection is always HTTPS.
affects: >=4.0.0
gotchaContentfully does not support the Content Management API; only the Delivery and Preview APIs.
fix
Use the official Contentful SDK for management operations.
affects: *
gotchaLinked entries are resolved recursively but the same object is reused if referenced multiple times (no cloning). Mutating the resolved objects affects all references.
fix
Deep clone if you need independent copies.
affects: *
Errors
Common errors & fixes
Cannot find module 'contentfully'
Package not installed or wrong import path.
fix
Run 'npm install contentfully' and import using 'import { Contentfully } from 'contentfully'.
Contentfully is not a constructor
CommonJS import using default import instead of destructured.
fix
Use 'const { Contentfully } = require('contentfully')' or 'import { Contentfully } from 'contentfully'.
Property 'items' does not exist on type 'EntryCollection<unknown>'
Missing generic type parameter or incorrect type assertion.
fix
Use 'contentfully.getEntries<MyModel>()' where MyModel matches the entry shape.
Module '"contentfully"' has no exported member 'createClient'
Wrong import: createClient is from 'contentful'.
fix
Import createClient from 'contentful' instead.
UnhandledPromiseRejection: Error: Access token is required
Missing accessToken in configuration.
fix
Ensure accessToken is passed to the Contentfully constructor or set via environment variable.
Upgrade
Version history
4.0.2latest on npm
Audit
Dependencies
contentfulrequiredUnderlying Contentful SDK used for API calls
Agent activity
29 hits · last 30 days
node
22
OpenAI (training)
1
Resources
contentfully — npm install contentfully · libregistry