In this page, you will learn to create content in the CMS. Once you created it, you will fetch it using the SDK in the next steps
-
Go to your CMS and click "Create Content"
-
Put "Home" as name and select content type Article
-
Fill some content
-
Click "Publish" → "Publish Content"
-
Go to Settings → Applications → Create Application
-
Enter an Application Name (e.g.,
my-app) - API ID is auto-generated -
Select a start page: From Existing → Home
-
Click Create Application
Create content and applications automatically using optimizely.config.mjs:
-
Define content array - specify content to create from existing contentTypes:
export default buildConfig({ components: ['./src/components/**/*.tsx'], content: [ { key: 'HomeContent', // unique key for reference displayName: 'Home', // display name in CMS contentType: 'Article', // existing contentType key }, ], applications: [ { key: 'my_app', displayName: 'My App', type: 'website', isDefault: true, entryPoint: 'HomeContent', // reference content key hosts: [ { authority: 'localhost:3000', type: 'primary', preferredUrlScheme: 'https', }, ], // Optional - defaults shown below previewUrlFormats: { any: '{host}/preview?key={key}&ver={version}&loc={locale}&ctx={context}', }, }, ], });
-
Run config push:
optimizely-cms-cli config push
This creates content instances from the
contentarray and applications automatically.
How it works:
The application creation operates on the following order with explicit dependencies:
-
Content instances (defined in the
contentarray) instantiate Page (_page) or Experience (_experience) content by referencing existing contentType definitions. Each instance specifies acontentTypekey and provides display metadata for CMS presentation. -
Applications (defined in the
applicationsarray) establish the deployment context for content. Each application designates anentryPointthat references a content instance key, defining the application's start page. Applications also configure routing hosts, preview URL patterns, and application-level settings.
The CLI enforces this dependency chain during config push: contentTypes must exist before content instances can reference them, and content instances must exist before applications can designate them as entry points.
- Go to your CMS → Content → Home
- Scroll down and under "Name in URL" click "Change"
- Leave the field blank.
- Click "Publish" → "Publish Content"
Now you are ready to fetch the content you just created.



