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 Reposzymonuryga/Optimizely-SaaS-CMS-Next.js-15
Use Cases
Starter
CMS
Stack
Next.js
Tailwind

Related Templates

Contentstack Commerce

Learn to use Contentstack SDK to create apps with Next.js and Vercel.
Contentstack Commerce thumbnail

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

Get Started

  • Templates
  • Supported frameworks
  • Marketplace
  • Domains

Build

  • Next.js on Vercel
  • Turborepo
  • v0

Scale

  • Content delivery network
  • Fluid compute
  • CI/CD
  • Observability
  • AI GatewayNew
  • Vercel AgentNew

Secure

  • Platform security
  • Web Application Firewall
  • Bot management
  • BotID
  • SandboxNew

Resources

  • Pricing
  • Customers
  • Enterprise
  • Articles
  • Startups
  • Solution partners

Learn

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

Frameworks

  • Next.js
  • Nuxt
  • Svelte
  • Nitro
  • Turbo

SDKs

  • AI SDK
  • Workflow SDKNew
  • Flags SDK
  • Chat SDK
  • Streamdown AINew

Use Cases

  • Composable commerce
  • Multi-tenant platforms
  • Web apps
  • Marketing sites
  • Platform engineers
  • Design engineers

Company

  • About
  • Careers
  • Help
  • Press
  • Legal
  • Privacy Policy

Community

  • Open source program
  • Events
  • Shipped on Vercel
  • GitHub
  • LinkedIn
  • X
  • YouTube

Loading status…

Select a display theme:
    • AI Cloud
      • AI Gateway

        One endpoint, all your models

      • Sandbox

        Isolated, safe code execution

      • Vercel Agent

        An agent that knows your stack

      • AI SDK

        The AI Toolkit for TypeScript

      • v0

        Build applications with AI

    • Core Platform
      • CI/CD

        Helping teams ship 6Ɨ faster

      • Content Delivery

        Fast, scalable, and reliable

      • Fluid Compute

        Servers, in serverless form

      • Workflow

        Long-running workflows at scale

      • Observability

        Trace every step

    • Security
      • Bot Management

        Scalable bot protection

      • BotID

        Invisible CAPTCHA

      • Platform Security

        DDoS Protection, Firewall

      • Web Application Firewall

        Granular, custom protection

    • Company
      • Customers

        Trusted by the best teams

      • Blog

        The latest posts and changes

      • Changelog

        See what shipped

      • Press

        Read the latest news

      • Events

        Join us at an event

    • Learn
      • Docs

        Vercel documentation

      • Academy

        Linear courses to level up

      • Knowledge Base

        Find help quickly

      • Community

        Join the conversation

    • Open Source
      • Next.js

        The native Next.js platform

      • Nuxt

        The progressive web framework

      • Svelte

        The web’s efficient UI framework

      • Turborepo

        Speed with Enterprise scale

    • Use Cases
      • AI Apps

        Deploy at the speed of AI

      • Composable Commerce

        Power storefronts that convert

      • Marketing Sites

        Launch campaigns fast

      • Multi-tenant Platforms

        Scale apps with one codebase

      • Web Apps

        Ship features, not infrastructure

    • Tools
      • Marketplace

        Extend and automate workflows

      • Templates

        Jumpstart app development

      • Partner Finder

        Get help from solution partners

    • Users
      • Platform Engineers

        Automate away repetition

      • Design Engineers

        Deploy for every idea

  • Enterprise
  • Pricing
Log InContact
Sign Up
Sign Up
DeployView Demo
AI Gateway

One endpoint, all your models

Sandbox

Isolated, safe code execution

Vercel Agent

An agent that knows your stack

AI SDK

The AI Toolkit for TypeScript

v0

Build applications with AI

CI/CD

Helping teams ship 6Ɨ faster

Content Delivery

Fast, scalable, and reliable

Fluid Compute

Servers, in serverless form

Workflow

Long-running workflows at scale

Observability

Trace every step

Bot Management

Scalable bot protection

BotID

Invisible CAPTCHA

Platform Security

DDoS Protection, Firewall

Web Application Firewall

Granular, custom protection

Customers

Trusted by the best teams

Blog

The latest posts and changes

Changelog

See what shipped

Press

Read the latest news

Events

Join us at an event

Docs

Vercel documentation

Academy

Linear courses to level up

Knowledge Base

Find help quickly

Community

Join the conversation

Next.js

The native Next.js platform

Nuxt

The progressive web framework

Svelte

The web’s efficient UI framework

Turborepo

Speed with Enterprise scale

AI Apps

Deploy at the speed of AI

Composable Commerce

Power storefronts that convert

Marketing Sites

Launch campaigns fast

Multi-tenant Platforms

Scale apps with one codebase

Web Apps

Ship features, not infrastructure

Marketplace

Extend and automate workflows

Templates

Jumpstart app development

Partner Finder

Get help from solution partners

Platform Engineers

Automate away repetition

Design Engineers

Deploy for every idea