Skip to content
VercelLogotypeVercelLogotype
LoginSign Up

Optimizely SaaS CMS + Next.js 15

A comprehensive starter template for building modern websites with Optimizely SaaS CMS and Next.js 15 App Router.

DeployView Demo

Optimizely SaaS CMS + Next.js 15

A comprehensive starter template for building modern websites with Optimizely SaaS CMS and Next.js 15 App Router. This template serves as an excellent starting point for projects integrating with Optimizely SaaS CMS.

This project was built based on a free course on how to get started with Optimizely SaaS CMS. You can find step-by-step information on how this project was built at: https://opti-masterclass.vercel.app

Note: This template requires an Optimizely SaaS CMS instance to retrieve content. Please connect with the Optimizely team to receive CMS access.

Features

  • ⚔ Next.js 15 with App Router
  • šŸ—ļø Static Site Generation (SSG) for optimal performance
  • šŸ”„ On-Demand Cache Revalidation via webhooks for real-time content updates
  • šŸ‘ļø Draft Mode for content previews
  • 🌐 Multi-language Support with automatic language detection
  • 🧩 Block Factory Mapper for dynamic content rendering
  • šŸŽØ Visual Builder Integration for intuitive content editing
  • šŸ” SEO Optimized with metadata support
  • šŸ’… Tailwind CSS & shadcn/ui for beautiful, responsive designs
  • šŸ“Š TypeScript for type safety
  • šŸ“ GraphQL Codegen for type-safe API calls

Important Note

  • This repository includes an ExportedFile.episerverdata file in the root folder, which contains all initial content for Optimizely SaaS CMS. You can import this file into your Optimizely instance to get started with pre-configured content.
  • This template focuses on core functionality that is common to all projects, such as fetching content from Optimizely Graph, preview functionality, routing, Visual Builder and cache revalidation. The design is intentionally simple and serves as an example — each project will have its own design requirements.

Getting Started

Prerequisites

  • Node.js 18.17 or later
  • An Optimizely SaaS CMS instance
  • Optimizely Content Graph API key

Setup Instructions

  • Clone the repository:
git clone https://github.com/szymonuryga/Optimizely-SaaS-CMS-Next.js-15.git
cd Optimizely-SaaS-CMS-Next.js-15
  • Install dependencies:
npm install
  • Set up environment variables:

Create a .env file in the root directory with the following variables:

OPTIMIZELY_API_URL="https://cg.optimizely.com/content/v2"
OPTIMIZELY_SINGLE_KEY=""
OPTIMIZELY_PREVIEW_SECRET=""
OPTIMIZELY_REVALIDATE_SECRET=""
OPTIMIZELY_START_PAGE_URL=""
NEXT_PUBLIC_CMS_URL="https://app-{your-data}.cms.optimizely.com"
  • Generate GraphQL types and SDK with all methods:
npm run gen-types
  • Start the development server:
npm run dev
  • Open http://localhost:3000 in your browser.

Documentation

This project includes comprehensive documentation on various aspects of integrating Next.js with Optimizely SaaS CMS:

  • Project Setup - Basic setup instructions
  • Block Factory Mapper - Pattern for dynamically rendering content blocks
  • Fetching Data - How to fetch data from Optimizely Graph
  • Cache Revalidation - Implementing cache revalidation with webhooks
  • Visual Builder - Integration with Optimizely's Visual Builder
  • Draft Mode - Setting up preview/draft mode
  • Multi-language Support - Implementing localization

šŸ‘‰ A complete step-by-step guide and course on how to build everything from scratch can be found here: https://opti-masterclass.vercel.app

Importing Content to Optimizely

  1. Log in to your Optimizely SaaS CMS instance
  2. Important: Make sure to add "Polish" language in your CMS settings before importing content to ensure successful import
  3. Go to Admin > Tools > Import Data
  4. Upload the ExportedFile.episerverdata file from the root of this project
  5. Follow the import wizard to complete the process

Environment Variables

  • OPTIMIZELY_API_URL: The base URL for the Optimizely Graph (typically "https://cg.optimizely.com/content/v2")
  • OPTIMIZELY_SINGLE_KEY: Your Optimizely Content Graph API key
  • OPTIMIZELY_PREVIEW_SECRET: Generated base64 string based on your AppKey and AppSecret credentials. For more details I recommend you to take a look at Kunal's article: https://kunalshetye.com/posts/optimizely-graph-using-appkey-appsecret/
  • OPTIMIZELY_REVALIDATE_SECRET: A secret key used for revalidating cached content
  • OPTIMIZELY_START_PAGE_URL: Defines the full route URL of the Start Page in Optimizely CMS. When using hierarchical routing, Optimizely does not assign the root path / to the Start Page by default. Instead, the Start Page must have an explicit URL like "/start-page". This impacts the overall routing logic and cache revalidation mechanisms. Therefore, this variable must be set manually to indicate the correct URL of the Start Page.
  • NEXT_PUBLIC_CMS_URL: The URL of your SaaS CMS instance

Future Enhancements

This template is actively maintained and will be updated to support new features and improvements in Optimizely SaaS CMS as they become available. Stay tuned for future enhancements!

License

MIT [blocked]

GitHub
Ownerszymonuryga
RepositoryOptimizely-SaaS-CMS-Next.js-15
Use Cases
Starter
CMS
Stack
Next.js
Tailwind

Related Templates

Sitecore XM Cloud Next.js Starter

Simple Next.js blog site that connects to a Sitecore XM Cloud site using the Sitecore JavaScript Rendering SDK (JSS).
Sitecore XM Cloud Next.js Starter thumbnail

Agent Stack

  • AI SDK
  • AI Gateway
  • Sandbox
  • Workflows
  • EveNew
  • ConnectNew

Core Platform

  • CI/CD
  • Content Delivery
  • Fluid Compute
  • Observability

Security

  • Platform Security
  • WAF
  • Bot Management
  • Bot ID

Tools

  • Vercel DropNew
  • Vercel Agent
  • Vercel PluginNew
  • Next.js
  • Domains
  • v0

Frameworks

  • Nuxt
  • SvelteKit
  • Nitro
  • Turborepo
  • Tanstack Start
  • FastAPI
  • xmcp
  • All frameworks

SDKs

  • Vercel SDK
  • Workflow SDKNew
  • Flags SDK
  • Chat SDKNew
  • Queues SDKNew
  • Streamdown

Build

  • AI Apps
  • Web Apps
  • Marketing Sites
  • Platforms
  • Commerce
  • Platform Engineers
  • Design Engineers

Learn

  • Docs
  • Blog
  • Changelog
  • Knowledge Base
  • Academy
  • Articles
  • Community

Explore

  • Customers
  • Marketplace
  • Templates
  • Partner Finder
  • Vercel + AWS

Company

  • About
  • Careers
  • Press
  • Events
  • Startups
  • Shipped on Vercel
  • Open Source Program
  • Enterprise
  • Pricing
  • Help

Legal & Trust

  • Privacy Policy
  • Terms of Service
  • Cookie Policy
  • DPA
  • Acceptable Use Policy
  • Legal (all documents)
  • Trust Center
  • Status

Social

  • GitHub
  • X
  • LinkedIn
  • YouTube
  • Instagram
  • VercelVercel
Agent Stack
  • AI SDK
  • AI Gateway
  • Sandbox
  • Workflows
  • Eve
Core Platform
  • Security
  • Content Delivery
  • Fluid Compute
  • Observability
  • CI/CD
Tools
  • Next.js
  • Vercel Agent
  • Vercel Plugin
  • Domains
  • v0
Learn
  • Docs
  • About
  • Blog
  • Changelog
  • Knowledge Base
Build
  • AI Apps
  • Web Apps
  • Marketing Sites
  • Platforms
  • Commerce
Explore
  • Customers
  • Marketplace
  • Partner Finder
  • AWS
  • Community
EnterprisePricing
Contact
Log InSign Up
Dashboard

Products

Agent Stack

  • AI SDK
  • AI Gateway
  • Sandbox
  • Workflows
  • Eve

Core Platform

  • Security
  • Content Delivery
  • Fluid Compute
  • Observability
  • CI/CD

Tools

  • Next.js
  • Vercel Agent
  • Vercel Plugin
  • Domains
  • v0
Resources

Learn

  • Docs
  • About
  • Blog
  • Changelog
  • Knowledge Base

Build

  • AI Apps
  • Web Apps
  • Marketing Sites
  • Platforms
  • Commerce

Explore

  • Customers
  • Marketplace
  • Partner Finder
  • AWS
  • Community
Enterprise
Pricing
Sign UpLog In
Contact
DeployView Demo

Loading status…

Select a display theme: