Skip to content

Knowledgebase

Choosing a static export or a Next.js server deployment

development, servers

Next.js can produce a static website or run as an application server. Choose the deployment mode from the features your site uses, not simply from whether its pages contain React.

Information to have ready

List server-rendered pages, server functions, authentication behavior, image handling and request-dependent features. Confirm whether the hosting plan supports a persistent Node application.

01 Choose a static export or a Next.js server deployment

  1. Identify pages that can be fully generated at build time. A static export suits content that can be served as files, with any dynamic browser features calling a separate supported backend.

  2. Review the current Next.js static-export limitations against the actual application. Features requiring a live Next.js request handler need a server deployment or a different design.

  3. For a static build, configure the supported export output and deploy its generated directory to the web document root. Set route and asset handling for the emitted files.

  4. For a server build, prepare a production Next.js release and supervise the Node process behind the approved proxy.

  5. Test a representative page from every feature group before selecting the final plan or switching production traffic.

02 Example: export a brochure site as static Next.js files

For a brochure site whose pages can be generated at build time, merge this configuration into its existing next.config.mjs. Review the installed Next.js version’s export limitations before selecting this deployment mode.

Code or configuration example
const nextConfig = {
  output: 'export',
  trailingSlash: true,
};

export default nextConfig;

Run the project’s production build and publish the generated out contents to the intended document root. With this path style, a generated page can be served as a directory index. Request-dependent server features still need a server deployment or separate backend. Default server image optimisation also needs an export-compatible alternative.

Expected result: A direct visit and refresh of a generated inner page both work, and its CSS and images load. A static upload is not considered complete until every form, authentication requirement and other dynamic feature has a supported implementation.

Confirm the expected result

Test direct visits to nested URLs, refreshes, forms, authentication and image delivery. A homepage can work while a server-dependent feature is absent from a static export.

Troubleshoot unexpected results

If the build rejects a feature in export mode, investigate that feature’s server requirement. Uploading more source files to ordinary static hosting does not create an application server.

A common question

Is all React hosting the same as Next.js hosting?

A browser-only React build and a server-rendered Next.js application have different runtime needs. Match the plan and deployment method to the produced application.

Sources and further reading

Was this answer helpful?

Need a little more help?

Our support team can help you find the next step.

Contact support