Q44: How do deployment architectures differ between Vercel and self-hosted Docker containers?

  • Vercel: Fully managed serverless execution. Routes deploy to Edge networks and Serverless Functions with zero infrastructure setup.
  • Self-Hosted Docker: Runs a persistent Node.js server container using output: 'standalone' in next.config.js to minimize image sizes.
Standalone Output Config for Docker
// next.config.mjs
export default {
  output: 'standalone', // Copies only necessary node_modules required for running server
};

standalone mode creates a minimal server bundle folder optimized for Docker containers.

Key Takeaways
  • Vercel auto-splits routes into Edge and Serverless Lambdas.

  • Self-hosted Docker uses output: 'standalone' to produce lightweight minimal production builds.

Knowledge Check

What next.config.js setting reduces Docker image sizes by copying only necessary production dependencies?