NexaCloud is open to everyone. Free to start, no credit card.Create a free account
NEXACLOUD / GUIDES

Deploy Next.js static export.

What works, what does not, and the exact settings.

NexaCloud hosts static files, so a Next.js app must be exported as a static site. This works for pages that do not need a server.

1. Turn on static export

// next.config.js module.exports = { output: 'export', images: { unoptimized: true }, };

npm run build now writes the site to the out folder.

2. Create the project and add the workflow

  1. Create a free NexaCloud account with GitHub or email.
  2. Open Projects, enter a name, your GitHub owner and repository, and create the project. Copy the deploy token shown once.
  3. In your repository open Settings → Secrets and variables → Actions and add a secret named NEXACLOUD_TOKEN with that token.
  4. Commit the workflow below as .github/workflows/nexacloud.yml and push.
name: Deploy NexaCloud on: push: branches: [main] jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: { node-version: 22 } - run: npm ci && npm run build - name: Send to NexaCloud env: NEXACLOUD_TOKEN: ${{ secrets.NEXACLOUD_TOKEN }} run: | cd out args=(); while IFS= read -r f; do args+=(-F "${f#./}=@$f"); done < <(find . -type f) curl --fail-with-body -sS -X POST "https://app.nexaclouds.online/api/deploy/my-project" \ -H "Authorization: Bearer $NEXACLOUD_TOKEN" "${args[@]}"

What does not work with static export

  • API routes and route handlers that run on a server.
  • Server-side rendering and incremental static regeneration.
  • The default image optimizer (use images.unoptimized, as above).
  • Middleware.

If you need these, use a platform with server support; NexaCloud plans server-side code for a later phase. Check the status page.