Documentation
v1
Frontend
Next.js (API Routes)

Deploy Next.js API

Use this guide when your Next.js project is mostly API endpoints, route handlers, or server-side logic, but you still want to deploy it through the nextjs dashboard runtime.

The Next.js API dashboard template packages the same standalone output used by the main Next.js template. The difference is only the guidance, not the runtime family.

1. Enable standalone output

/** @type {import('next').NextConfig} */
const nextConfig = {
  output: 'standalone',
}
 
export default nextConfig

2. Build the project

npm run build

3. Copy required runtime assets

cp -R public .next/standalone/public
mkdir -p .next/standalone/.next
cp -R .next/static .next/standalone/.next/static

4. Zip the standalone root

cd .next/standalone
zip -r ../../nextjs-api.zip .

Upload nextjs-api.zip with the Next.js API template in /dashboard/deploy.

Works for

  • pages/api/*
  • app/api/*
  • route handlers
  • mixed apps where APIs are the main concern

Archive expectation

After unzip, the standalone server root should be at the top level of the archive:

server.js
package.json
public/...
.next/static/...

When to use the main Next.js guide instead

Use Deploy Next.js when the project is a normal full app with pages and UI as the primary concern.