Skip to main content
Merakla

Search Merakla Studio

Jump to any plugin, mobile app, free tool, or studio page.

Sign In
All Engineering Guides
Infrastructure2026-12-016 min read

Self-Hosting Next.js 16 + PostgreSQL + Caddy on a $10 VPS: Production Checklist

The exact Docker standalone, Caddy automatic HTTPS, Drizzle migration, and middleware TTFB checklist we use in production on merakla.com.

1. Always Enable Standalone Output & Copy /public

Setting output: 'standalone' in next.config.mjs trims your Docker image down by hundreds of megabytes. One common gotcha: Next.js standalone does not automatically bundle .next/static or public/ — make sure your runner stage explicitly copies both directories.

COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
COPY --from=builder --chown=nextjs:nodejs /app/public ./public

2. Never Block Public SEO Pages in Middleware

A subtle performance trap in auth starters is calling /api/auth/get-session on every request before checking if the route is even protected. Always match protected routes (/admin, /account, /dashboard) first so public pages and Googlebot bypass auth checks in 0 ms.

3. Safe Production Migrations Without Clobbering node_modules

Install drizzle-kit, drizzle-orm, and pg in an isolated /app/drizzle-tools directory inside your runner image and prepend it to PATH. Running `docker exec app drizzle-kit migrate` then applies versioned SQL migrations cleanly in seconds.

Book a 7-Day Turnkey Launch

Want us to architect and deploy your Next.js + MedusaJS v2 stack on your own Hetzner or Hostinger VPS?

Book a 7-Day Turnkey Launch

More Engineering Guides