Crescendo Lab

Next.js deploy guide · Agent Lab Deploy

Deploy Next.js
in one sentence.

Upload your Next.js project as it is — no Dockerfile — or tell Claude Code, Codex or Cursor "deploy this". Agent Lab builds it into a web service, or a static web page when it is fully static, gives every version a preview URL with rollback, and checks uploads for leaked keys. Apps and databases run on Google Cloud in Taiwan.

Start freeSee the setup

Why deploy Next.js on Agent Lab

Next.js online without running a server yourself

JavaScript / TypeScript project, built from source with no Dockerfile, deployed as a web service, or a static web page when it is fully static.

No Dockerfile

The platform detects Next.js from package.json, picks the build and start commands, and lists the environment variables your code reads.

Preview, go live, roll back

Every upload is a new version with its own URL. Look first, then go live; switch back to any version in one click.

Leaked keys caught

Uploads are checked for API keys and credentials before they can go live. Secrets go in the console, never in the code.

PostgreSQL in one click

Create a database and connect it; the connection is written into the app's environment and the password is never shown.

Your options

Next.js on Agent Lab, or on your own VPS

Scroll the table sideways.

Deploying Next.js on Agent Lab compared with a self-managed VPS
What you care aboutAgent Lab DeployYour own VPS
SetupUpload or say one sentence; no DockerfileSSH, a runtime, a process manager, a reverse proxy
HTTPS and domainsAutomatic, custom domains on paid plansCertbot and DNS by hand
Preview and rollbackEvery version has its own URL; roll back in one clickWrite your own scripts
Before going liveUploads checked for leaked keysNothing unless you set it up
DatabasePostgreSQL in one click, connection written into the appInstall and back it up yourself
Cost to startFree plan: NT$0, one size-S app (sleeps when idle)A VPS at roughly NT$200–600 a month, plus your time

Steps

Deploy Next.js in four steps

  1. Prepare

    Keep package.json at the top of the project and commit the lockfile. Leave out node_modules, .git, dist and .env.

  2. Upload or ask

    Drop the folder on a project's Deploy tab, push from GitHub, or ask your AI tool through Agent Lab MCP.

  3. Build and check

    The platform builds the version and checks it for leaked keys. Enter any secrets it lists in Settings.

  4. Preview and go live

    The first version goes live once it builds. Later ones get a preview URL; go live when you're happy.

Setup

What Agent Lab runs for Next.js

A project with API routes, Server Actions or SSR becomes a web service; one with output: "export" becomes a static web page on the CDN. NEXT_PUBLIC_ variables are fixed at build time; changing one needs a new build. For a monorepo (Turborepo, Nx), upload the whole repository and set Root Directory to apps/web in the build settings.

Detected

Build and start

# Agent Lab 偵測到 Next.js 後執行
# What Agent Lab runs once it detects Next.js
npm ci            # 依 lockfile 選 npm / pnpm / Yarn / Bun
npm run build     # next build
npm start         # next start,監聽 $PORT(預設 8080)

# next.config.js 設 output: "export" → 改成靜態網頁,放 CDN
  • PORT the port the platform gives (8080 by default); the server must listen on it.
  • NEXT_PUBLIC_* baked into the page at build time and visible to anyone; never put a secret here.
  • AUTH_SECRET with Auth.js, generate a random value in the console in one click.
  • DATABASE_URL written for you when you connect an Agent Lab PostgreSQL.
Prompt

Or ask your AI tool

Read https://app.agentlab.cresclab.com/agent/deploy.md and deploy this Next.js project to Agent Lab. Show me the build plan and the environment variables it needs first, tell me where to enter any secrets, and wait for my OK before it goes live.

FAQ

Deploying Next.js: questions

Do I need a Dockerfile to deploy Next.js?
No. Upload the Next.js project with package.json at the top and Agent Lab detects the framework, builds it and starts it. A Dockerfile at the top, if there is one, is used instead. Docs →
Do Next.js Image Optimization and Middleware work?
Deployed as a web service, next start serves image optimization and Middleware itself; nothing else to set up. A static output: "export" site has no server, so neither is available there.
Where do API keys and other secrets go?
In the project's Settings, under Secrets; the code reads them as environment variables. Random values such as session secrets can be generated in the console without anybody seeing them. A key found in an upload stops it before it goes live.
Can I deploy Next.js from Claude Code or Codex?
Yes. Connect Agent Lab MCP once (one command, sign in in the browser, no API key), then say "deploy this Next.js app". The tool creates the project, uploads, waits for the build and asks before going live. Connect MCP →
Is there a free way to host Next.js?
The Free plan is NT$0: one size-S app that sleeps after 15 idle minutes, one size-S database, three static web pages, 100 build minutes and 5 GB of traffic a month, pausing at the limit instead of charging. Pro (US$29 a month before tax) keeps apps running and adds custom domains. Pricing →