Skip to content

Deploy Next.js

deploybase supports Next.js in static export mode only. Server-side rendering (SSR) and API routes are not supported — deploybase serves static files from CDN.

  • Next.js 13.3+ (static export support)
  • output: 'export' in next.config.js
/** @type {import('next').NextConfig} */
const nextConfig = {
output: 'export',
}
module.exports = nextConfig
SettingValue
Frameworknextjs
Build commandnpm run build
Output directoryout
Docker imagenode:24-alpine
Terminal window
# Create project
curl -X POST https://api.deploybase.eu/api/v1/projects \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "My Next.js Site",
"framework": "nextjs",
"git_repo_url": "https://github.com/user/nextjs-site.git",
"git_provider": "github"
}'
# Trigger deployment
curl -X POST https://api.deploybase.eu/api/v1/deployments \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"project_id": "PROJECT_ID", "branch": "main"}'

Build fails with “Page … couldn’t be rendered statically” — Some pages use getServerSideProps or dynamic server features. Convert to getStaticProps with getStaticPaths for dynamic routes, or exclude those pages.

Images not loading — Next.js <Image> component with default loader requires a server. Use unoptimized: true in next.config.js:

const nextConfig = {
output: 'export',
images: { unoptimized: true },
}

Trailing slashes — If links break after deployment, set trailingSlash: true in next.config.js to generate page/index.html instead of page.html.