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 synchronize it with Optimizely CMS.

Get started with the Optimizely JavaScript SDK and Command line interface (CLI) to model content, upload content models, and integrate Optimizely CMS into your application. It walks through running the CLI, setting up a recommended Next.js project, and installing the SDK so you can begin configuring and managing content efficiently.

The SDK provides libraries to model content, fetch content, and render it in your application. The CLI is a command-line tool that uploads content models to Optimizely CMS by 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 setting up a new project.

1. Initialize a project

Optimizely recommends using a Next.js project.

Run the 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

2. 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.