Skip to content

# Deploy to Production

How to deploy Zenith Dashboard to Vercel, a self-hosted server, or Docker.

## Vercel (Recommended)

Vercel is the easiest way to deploy a Next.js application. It provides automatic builds, preview deployments, and a global edge network.

1. Push your code to a GitHub, GitLab, or Bitbucket repository.
2. Go to vercel.com/new and import your repository.
3. Vercel auto-detects Next.js — accept the defaults and click "Deploy".
4. Every push to the main branch triggers a production deployment. Pull requests get preview URLs automatically.

No build configuration is needed. Vercel handles `npm run build` and serves the output from their global CDN.

## Self-Hosted (Node.js)

You can run the production build on any server with Node.js 20.9+ installed.

    # Build the application
    npm run build

    # Start the production server
    npm run start

    # The server runs on port 3000 by default.
    # Use the PORT environment variable to change it:
    PORT=8080 npm run start

For production, use a process manager like PM2 to keep the server running and handle restarts:

    npm install -g pm2
    pm2 start npm --name "zenith-dashboard" -- start
    pm2 save

## Docker

Create a `Dockerfile` at the project root for containerized deployments:

    FROM node:20-alpine AS base

    # Install dependencies
    FROM base AS deps
    WORKDIR /app
    COPY package.json package-lock.json ./
    RUN npm ci --only=production

    # Build the application
    FROM base AS builder
    WORKDIR /app
    COPY --from=deps /app/node_modules ./node_modules
    COPY . .
    RUN npm run build

    # Production image
    FROM base AS runner
    WORKDIR /app
    ENV NODE_ENV=production
    COPY --from=builder /app/public ./public
    COPY --from=builder /app/.next/standalone ./
    COPY --from=builder /app/.next/static ./.next/static

    EXPOSE 3000
    ENV PORT=3000
    CMD ["node", "server.js"]

Build and run the container:

    docker build -t zenith-dashboard .
    docker run -p 3000:3000 zenith-dashboard

Note: For the standalone output to work, add `output: "standalone"` to your `next.config.ts`.

## Environment Variables

Zenith Dashboard currently uses no required environment variables since all data is mock/hardcoded. When you connect a real backend, you will typically need:

Variable | Description
--- | ---
NEXT_PUBLIC_API_URL | Base URL for your API (accessible in browser)
DATABASE_URL | Database connection string (server-only)
NEXTAUTH_SECRET | Auth secret for NextAuth.js (if using auth)

Create a `.env.local` file at the project root for local development. Never commit this file to version control.

## Next Steps

Check the Changelog for the latest updates and release notes.