Deploy a server-rendered Next.js app to Wokku, with environment variables, a
database, and HTTPS.
Prerequisites
- A Wokku account and a connected server
- An SSH key registered for
git push - A Next.js app locally (
npx create-next-app@latest my-appif starting fresh)
1. Create the app
Apps → New App → pick a server, name it my-next-app, choose a box size, Create.
wokku apps:create my-next-app --server my-server
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):
{
"scripts": {
"build": "next build",
"start": "next start -p $PORT"
}
}
Add a Procfile (optional but explicit):
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.
wokku config:set my-next-app NODE_ENV=production
4. Add a database (optional)
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
git remote add wokku git@git.wokku.cloud:my-next-app
git push wokku main
Connect the repo under Apps → Connect GitHub for auto-deploy on push —
see GitHub Auto-Deploy.
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 applied —
NEXT_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.