JavaScript tools for integration with Optimizely CMS
npm install @optimizely/cms-sdk
The official JavaScript/TypeScript SDK for building headless applications with Optimizely CMS. This comprehensive library provides everything you need to fetch, render, and manage content from Optimizely CMS with full type safety and intelligent code completion.
- Type-safe content modeling - Full TypeScript definitions for your content types
- Framework integration - First-class support for React and Next.js
- Live preview - Real-time content editing experience
- Rich text rendering - Advanced rich text component with extensibility
- DAM integration - Seamless digital asset management
``bash`
npm install @optimizely/cms-sdk
Or using other package managers:
`bashpnpm
pnpm add @optimizely/cms-sdk
Quick Start
`typescript
// Initialize the client
const client = new GraphClient('', {
graphUrl: 'https://your-cms-instance.com',
});// Fetch content
const c = await client.getContentByPath(
/);
`Documentation
For comprehensive guides and documentation, visit the main repository:
$3
- Installation - Set up your development environment
- Setup - Configure the SDK and CLI
- Modelling - Define your content types with TypeScript
$3
- Fetching Content - Query and retrieve content in your app
- Rendering (React) - Display content in React components
- Live Preview - Enable real-time content editing
$3
- Experience - Work with experiences and variations
- Display Settings - Configure content display options
- RichText Component (React) - Render rich text content
- DAM Assets - Manage digital assets
- Client Utils - Utility functions and helpers
Best Practices
This SDK works best when used with the @optimizely/cms-cli package, which enables code-first content modeling by syncing your TypeScript definitions to Optimizely CMS.
`bash
npm install -D @optimizely/cms-cli
``For complete setup instructions, see the main repository README.
- Community Slack - Join the Optimizely Community Slack
- GitHub Issues - Report bugs or request features on GitHub
Apache License 2.0
---
Built by the Optimizely CMS Team | Documentation | GitHub