Skip to content

Full-stack frameworks

Deploy a Next.js app on Enzonic

Enzonic Deploy builds a Next.js app from your repository and runs it as a Node.js server with server components, route handlers, middleware and image optimization working as they do locally. If next.config sets output: 'export', the same project deploys as a static site instead.

At a glance

What Enzonic Deploy does with a Next.js project when you connect it. You can override any of it in the project settings.

Language
JavaScript / TypeScript
Detected from
next in dependencies or devDependencies; next.config.js, .mjs, .ts, .cjs or .mts (read to spot output: 'export'); Your lockfile, to pick npm, pnpm, Yarn or Bun
Build command
next build (or your build script)
Output
.next (server) or out (static export)
Runs as
Server or Static

Dependencies install with the package manager your lockfile names: npm ci, pnpm install --frozen-lockfile, yarn install --immutable (Berry) or --frozen-lockfile, or bun install --frozen-lockfile. Node.js 18, 20, 22 and 24 are available. Deploy reads engines.node in package.json, then .nvmrc or .node-version, and uses Node.js 22 when nothing pins a version.

How it runs

  • Server

    The default. Deploy sets NEXT_PRIVATE_STANDALONE=true for the build, so Next.js writes .next/standalone, and runs its server.js.

  • Static

    When next.config sets output: 'export'. The out folder is served from the edge with no server at all.

Deploy Next.js step by step

  1. 1Push the repository to GitHub, or upload a folder from the CLI or the API.
  2. 2Create a project on deploy.enzonic.com and pick the repository. The framework, build command and output directory fill themselves in.
  3. 3Add environment variables for production, preview and development if the app needs them. Variables used in the browser keep the NEXT_PUBLIC_ prefix.
  4. 4Deploy. Every later push to the production branch goes live, and every other branch gets its own preview URL.
next.config.mjs
/** Optional: only for a fully static site. Leave output unset to run as a server. */
const nextConfig = {
  output: 'export',
  images: { unoptimized: true },
};

export default nextConfig;
Static export has no server: route handlers that read the request, middleware and the image optimizer are not available in this mode.

Connect a database to Next.js

Create a database on Enzonic Databases (or from the project's settings) and its connection string is added to the project's environment variables. This example uses PostgreSQL.

app/api/now/route.ts
import postgres from 'postgres';

const sql = postgres(process.env.DATABASE_URL!);

export async function GET() {
  const [{ now }] = await sql`select now()`;
  return Response.json({ now });
}
Add an Enzonic Postgres database from the project's settings and DATABASE_URL is set for you, with separate values for production and previews.

Postgres projects get two variables: DATABASE_URL through the connection pooler for the app, and DATABASE_URL_UNPOOLED for migrations.

PostgreSQL on Enzonic DatabasesEvery database engine

Things to know

  • A custom output in next.config (anything other than unset, standalone or export) leaves Deploy without .next/standalone or out, and the build stops with a clear message.
  • next start is not used: the standalone server.js is. Code that depends on files outside the traced output should read them at build time.
  • On the Free plan a server project sleeps after 15 minutes without requests and wakes on the next one; paid plans keep servers always on.

Plan limits that matter here

From the live plan data. Every plan includes previews for each branch, instant rollback, environment variables and logs.

Plan limits that matter for Next.js
LimitFreePro
Build minutes3,000/mo, 1 concurrent10,000/mo, 3 concurrent
Servers1 instance, 512 MB, sleeps after 15 min idle3 always-on, 2 GB
Bandwidth150 GB/mo2 TB/mo

Compare every plan

Related guides

Ship your Next.js project tonight

Connect the repository and the build settings fill themselves in. Free plan, no card.

Start free