Sample.app
Framework Guides

Next.js

Deploy a statically exported Next.js project to Sample.app.

Sample.app serves static files only. To deploy a Next.js project, you need to enable static export.

Static export doesn't support server-side rendering, API routes, middleware, or image optimization. See the Next.js static export docs for full details.

Deploy

Configure static export

Add output: 'export' to your Next.js config:

next.config.js
/** @type {import('next').NextConfig} */
const nextConfig = {
  output: "export",
};

module.exports = nextConfig;

Build your project

npm run build

This outputs to out/ by default.

Deploy to Sample.app

samplex deploy ./out

Image optimization

Next.js image optimization requires a server, which isn't available with static export. Add this to your config:

next.config.js
const nextConfig = {
  output: "export",
  images: {
    unoptimized: true,
  },
};

Consider using a third-party image CDN or pre-optimizing images at build time as an alternative.

On this page