Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

HomeDev GuideRecipesAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

Install JavaScript SDK

Install the Optimizely JavaScript SDK and CLI to model content and sync it with Optimizely CMS.

Use the Optimizely JavaScript SDK and command line interface (CLI) to model content, upload content models, and integrate Optimizely CMS (SaaS) into your application. This documentation explains how to run the CLI, configure a recommended Next.jsproject, and install the SDK to configure and manage content efficiently.

The SDK provides libraries to model content, fetch content, and render it in your application. The CLI uploads content models to Optimizely CMS using the CMS REST API.

Install and use the CLI

You can run the CLI command without installing the SDK globally.

npx @optimizely/cms-cli@latest

When the command runs successfully, the CLI displays a list of available commands to install the SDK.

Alternative installation workflow

Use this workflow if you are configuring a new project.

Initialize a project

Optimizely recommends using a Next.js project.

Run the following command:

npx create-next-app@latest

When prompted, select the following options:

  • Use TypeScript – Yes
  • Use a src/ directory – Yes
  • Use App Router (recommended) – Yes

Install the SDK

Install the Optimizely JavaScript SDK in your project.

npm install @optimizely/cms-sdk

Next steps

After installing the SDK, configure and use the CLI to upload content models to Optimizely CMS.