How to Deploy the AI Website Cloner to a Production Environment: Complete Guide

Deploy the AI website cloner to production by running npm run build to create an optimized Next.js 16 bundle, then either push to Vercel for automatic serverless hosting or use the supplied Dockerfile and docker-compose.yml for containerized deployment on any VPS or cloud platform.

The JCodesMore/ai-website-cloner-template is built on Next.js 16 with the App Router, React 19, and TypeScript strict mode. When you are ready to ship your cloned site beyond localhost, the repository provides production-ready configurations for both static-hosted and containerized infrastructure.

Build the Production Bundle

Before deploying to any environment, you must generate the production build. The build process compiles TypeScript, bundles React components, extracts Tailwind CSS, and prepares the application for server-side rendering.

Understanding the Build Process

Run the following commands from the repository root to create a production-ready output:


# Install dependencies

npm install

# Create the production build

npm run build   # Executes next build

The npm run build command generates a .next/ folder containing the optimized server-rendered output. This folder includes compiled JavaScript, static assets, and the Next.js runtime required to serve requests.

Optional: Export a Fully Static Site

If you prefer to deploy without a Node.js server, generate a static export:

npm run export   # Generates out/ folder with static HTML/CSS/JS

This creates an out/ directory containing entirely static files that can be served by any web server or CDN, though you lose Next.js server-side features like API routes.

Vercel provides first-class support for Next.js 16 applications and automatically optimizes the build for global edge delivery.

  1. Push your cloned repository to GitHub using the Use this template button from the original repo.
  2. Import the repository into Vercel; the platform automatically detects the Next.js framework.
  3. Vercel executes npm install followed by npm run build on each commit, deploying the .next/ output to its global CDN.

The next.config.ts file in the repository root contains production optimizations specific to the Vercel platform, ensuring optimal cold-start performance and asset caching.

Containerized Deployment with Docker

For self-hosted VPS, Kubernetes, or cloud providers like AWS ECS and GCP Cloud Run, use the containerized deployment option included in the repository.

Multi-Stage Docker Build

The Dockerfile implements a multi-stage build using Node 24 Alpine to minimize image size:


# Dockerfile (simplified view)

FROM node:24-alpine AS builder
WORKDIR /app
COPY . .
RUN npm ci && npm run build   # Builds the Next.js app

FROM node:24-alpine AS runtime
WORKDIR /app
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json .
EXPOSE 3000
CMD ["npm", "start"]

The builder stage compiles the application, while the runtime stage copies only the necessary artifacts to serve the site on port 3000.

Orchestration with Docker Compose

The docker-compose.yml file simplifies local and production container management:


# docker-compose.yml (excerpt)

services:
  app:
    build: .
    ports:
      - "3000:3000"
    env:
      NODE_ENV: production

This configuration builds the image and maps port 3000 from the container to your host machine.

Running the Production Container

Execute these commands to deploy the containerized application:


# Build the production image

docker compose build app

# Start the container in detached mode

docker compose up -d app

# Verify the deployment

curl http://localhost:3000

For cloud deployment, push the built image to a container registry (Docker Hub, AWS ECR, or GCP Artifact Registry) and reference it in your service definition.

Key Source Files for Production

Several files in the repository directly impact the production build:

  • next.config.ts – Configures Next.js build settings, including output directories and platform-specific optimizations.
  • src/app/layout.tsx – The root React component that wraps all pages; loads global fonts and metadata critical for SEO.
  • src/app/globals.css – Imports Tailwind CSS v4 and custom design tokens that are extracted and optimized during the build process.
  • Dockerfile – Defines the multi-stage container build process using Node 24 Alpine.
  • docker-compose.yml – Orchestrates container networking and environment variables for production deployments.

Summary

  • Run npm run build to generate the production-ready .next/ folder containing the optimized Next.js 16 application.
  • Choose Vercel for zero-configuration serverless deployment with automatic builds and global CDN distribution.
  • Choose Docker when you need containerized deployments on VPS, Kubernetes, or proprietary cloud infrastructure using the provided multi-stage Dockerfile.
  • Both methods leverage the same production build pipeline, ensuring identical behavior whether you run on edge networks or self-hosted servers.

Frequently Asked Questions

Does the AI website cloner require a Node.js server in production?

Yes, for full functionality. The Next.js 16 App Router requires a Node.js runtime to handle server-side rendering and API routes. However, you can use npm run export to generate a fully static site that runs on any static file server, though this limits dynamic features.

Can I deploy this template to Netlify or other static hosts?

Absolutely. While Vercel is recommended for Next.js applications, you can deploy the npm run build output to Netlify, Cloudflare Pages, or AWS Amplify. Configure your build command as npm run build and set the publish directory to .next/ (or out/ for static exports).

How do I change the production port in the Docker container?

Modify the docker-compose.yml file to map a different host port. For example, change "3000:3000" to "8080:3000" to expose the application on port 8080. Alternatively, update the EXPOSE directive in the Dockerfile and ensure your orchestration platform routes traffic accordingly.

What Node.js version does the production build require?

The repository targets Node.js 24 and above, as specified in the Dockerfile using node:24-alpine. Ensure your production environment runs Node 24+ to maintain compatibility with Next.js 16 and React 19 features used throughout the src/app/ directory.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →