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.
Requirements
Section titled “Requirements”- Next.js 13.3+ (static export support)
output: 'export'innext.config.js
Configuration
Section titled “Configuration”next.config.js
Section titled “next.config.js”/** @type {import('next').NextConfig} */const nextConfig = { output: 'export',}
module.exports = nextConfigdeploybase Defaults
Section titled “deploybase Defaults”| Setting | Value |
|---|---|
| Framework | nextjs |
| Build command | npm run build |
| Output directory | out |
| Docker image | node:24-alpine |
Create and Deploy
Section titled “Create and Deploy”# Create projectcurl -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 deploymentcurl -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"}'Common Issues
Section titled “Common Issues”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.