Step 34 of 36 (94% complete)

Deployment Instructions for Next.js App to Optimizely Frontend Hosting (Headless Deployment)

Szymon Uryga photo

Step 1: Run PowerShell

Step 2: Install and import the EpiCloud module

Install-Module -Name EpiCloud -Scope CurrentUser -Force
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Import-Module EpiCloud

Step 3: Set variables with your credentials

$projectId = "<your_project_id>"
$clientKey = "<your_client_key>"
$clientSecret = "<your_client_secret>"
$targetEnvironment = "Test1"  # Change to "Production" if needed

Step 4: Zip your Next.js application

Create a .zip package with the following naming pattern:

<name>.head.app.<version>.zip

Example:

optimizely-one.head.app.20250610.zip
Note
⚠️ Important: If the filename does not include .head.app., it will be treated as a NuGet package instead of a headless app.

Step 5: Connect to EpiCloud and get the SAS URL

Connect-EpiCloud -ProjectId $projectId -ClientKey $clientKey -ClientSecret $clientSecret
$sasUrl = Get-EpiDeploymentPackageLocation

Step 6: Upload the deployment package

Add-EpiDeploymentPackage -SasUrl $sasUrl -Path .\optimizely-one.head.app.20250610.zip

Step 7: Start the deployment

Start-EpiDeployment `
  -DeploymentPackage "optimizely-one.head.app.20250610.zip" `
  -TargetEnvironment $targetEnvironment `
  -DirectDeploy `
  -Wait `
  -Verbose

After the process completes, your application will be deployed to the selected Optimizely Frontend Hosting environment.

Have questions? I'm here to help!

Contact Me