w wokku
Get Started
~/docs
/
frameworks

# Deploy Next.js

Updated · Edit on GitHub ↗

Deploy a server-rendered Next.js app to Wokku, with environment variables, a
database, and HTTPS.

Prerequisites

1. Create the app

Apps → New App → pick a server, name it my-next-app, choose a box size, Create.

2. Prepare your Next.js app

The Node buildpack auto-detects Next.js from package.json. Make sure you have
build and start scripts (create-next-app adds these):

json
{
  "scripts": {
    "build": "next build",
    "start": "next start -p $PORT"
  }
}
// note

Add a Procfile (optional but explicit):

procfile
web: npm run start

For a smaller image, enable standalone output in next.config.js
(output: "standalone").

3. Set environment variables

App → Config. Add NODE_ENV=production and any NEXT_PUBLIC_* /
server-side secrets your app needs.

// careful

4. Add a database (optional)

bash
wokku addons:create postgres my-next-app

Wokku injects DATABASE_URL; read it from process.env.DATABASE_URL in your
Prisma/Drizzle/pg config. See Create & Link a Database.

5. Deploy

bash
git remote add wokku git@git.wokku.cloud:my-next-app
git push wokku main

Live at https://my-next-app.wokku.app when the build finishes.

Static export?

If your site has no server code, build a static export (output: "export") and
deploy it as a static site — that path is coming in a dedicated guide. For now,
next start (above) works for both SSR and static-with-server apps.

Add a custom domain

See Custom Domains — SSL is automatic.

Troubleshooting

  • App crashes on boot — almost always a hardcoded port. Use -p $PORT.
  • Env var not appliedNEXT_PUBLIC_* is build-time; redeploy after changing it.
  • Build runs out of memory — pick a larger box size for the build, or set NODE_OPTIONS=--max-old-space-size.

Next steps

Was this page helpful?