Skip to main content
DeployHub supports deploying static sites built with popular frameworks like React, Vue, Angular, and more. Static sites are built during deployment and served via NGINX.

Supported Frameworks

  • React (Create React App, Vite)
  • Vue (Vue CLI, Vite)
  • Angular
  • Svelte
  • Next.js (static export)
  • Any framework that produces static HTML/CSS/JS

Project Type Configuration

When creating a deployment, you must set projectType: "static" for static sites.

Required Configuration

Static sites require two mandatory fields:

Build Command

The command to build your project. This is executed during the build phase. Common examples:

Publish Directory

The directory where your build output is located. This directory is served by NGINX. Common examples:

Deployment API Request

1

Prepare your deployment configuration

Create a deployment request with all required fields:
2

Send POST request to create deployment

3

Monitor build status

The build worker will:
  • Clone your repository
  • Run npm ci to install dependencies
  • Execute your build command
  • Create a Docker image with NGINX
  • Deploy the container

Environment Variables

Add environment variables for build-time configuration:
Environment variables are written to a .env file during the build process and are available during build time.

Build Process Details

When you deploy a static site, DeployHub:
  1. Clones your repository from the specified branch
  2. Installs dependencies using npm ci
  3. Creates .env file with your environment variables
  4. Runs build command (or defaults to npm run build if not specified)
  5. Builds Docker image using multi-stage build:
    • Stage 1: Node.js 20 for building
    • Stage 2: NGINX Alpine for serving
  6. Copies build output from publishDir to /usr/share/nginx/html
  7. Deploys container on port 80 with NGINX

Dockerfile Template

DeployHub uses this Dockerfile for static deployments:

Framework-Specific Examples

Vite (React/Vue)

Create React App

Angular

Vue CLI

Validation Rules

DeployHub validates your configuration:
Required for static projects:
  • projectType must be "static"
  • buildCommand is required and cannot be empty
  • publishDir is required and cannot be empty
  • branchname is required
  • isFolder must be a boolean
From the validation schema:

Updating Build Settings

You can update build settings after deployment:

Troubleshooting

Build Fails

  • Verify your buildCommand is correct
  • Check that all dependencies are in package.json
  • Ensure environment variables are properly set

Wrong Files Served

  • Verify publishDir matches your build output directory
  • Check your framework’s build configuration

Environment Variables Not Working

  • Ensure you’re using the correct prefix for your framework:
    • Vite: VITE_
    • Create React App: REACT_APP_
    • Next.js: NEXT_PUBLIC_
  • Environment variables are only available at build time for static sites

Next Steps

Deploy Node.js Apps

Learn how to deploy backend applications

Monorepo Support

Deploy from specific folders in monorepos

Branch Management

Configure branch and commit tracking