Deploy Files
Server action for programmatically deploying files to Vercel, enabling platforms to create deployments on behalf of users
import { deployFiles } from "@/components/vercel-platform/actions/deploy-files";const example = async () => {  await deployFiles([], { domain: "test.com" });};export default example;Overview
The Deploy Files action is a server-side utility that allows platforms to programmatically deploy files to Vercel. This is the core functionality behind platforms like Mintlify and Hashnode that create Vercel deployments for their users without requiring direct Vercel account access.
Installation
npx @vercel/platforms@latest add deploy-filesFeatures
- Programmatic deployment: Deploy files directly to Vercel using the SDK
 - Custom domain support: Automatically configure custom domains for deployments
 - Project configuration: Pass custom build settings and environment variables
 - SSO protection handling: Optionally make preview deployments public
 - Unique deployment naming: Automatic UUID generation for deployment identification
 
Usage
import { deployFiles } from "@/actions/deploy-files"
import type { InlinedFile } from "@vercel/sdk/models/createdeploymentop"
// Example: Deploy a simple HTML site
const files: InlinedFile[] = [
  {
    file: "index.html",
    data: "<html><body><h1>Hello from my platform!</h1></body></html>"
  },
  {
    file: "package.json",
    data: JSON.stringify({
      name: "my-deployment",
      version: "1.0.0"
    })
  }
]
await deployFiles(files, {
  domain: "customer-site.com",
  deploymentName: "customer-deployment-1",
  projectId: "existing-project-id", // Optional: use existing project
  config: {
    framework: "nextjs",
    buildCommand: "npm run build",
    outputDirectory: ".next"
  }
})Parameters
files
Array of files to deploy. Can be either:
InlinedFile: File content provided directly as a stringUploadedFile: File content uploaded separately and referenced by SHA
args
Configuration object with the following options:
Prop
Type
Advanced Example
import { deployFiles } from "@/actions/deploy-files"
import type { InlinedFile, ProjectSettings } from "@vercel/sdk/models/createdeploymentop"
// Deploy a Next.js application with custom configuration
const files: InlinedFile[] = [
  // Your application files here
]
const config: ProjectSettings = {
  framework: "nextjs",
  buildCommand: "npm run build",
  outputDirectory: ".next",
  installCommand: "npm install",
  devCommand: "npm run dev",
  env: {
    API_KEY: "your-api-key",
    DATABASE_URL: "your-database-url"
  },
  buildEnv: {
    NODE_ENV: "production"
  }
}
const deployment = await deployFiles(files, {
  deploymentName: `deployment-${Date.now()}`,
  config,
  domain: "app.customer-domain.com"
})Integration with Claim Deployment
After creating a deployment with this action, you typically show the Claim Deployment component to allow users to take ownership:
// 1. Deploy files server-side
const deployment = await deployFiles(files, { domain })
// 2. Show claim interface client-side
<ClaimDeployment
  url={deployment.url}
  onClaimClick={handleTransferOwnership}
/>Security Considerations
- This action requires Vercel API credentials with deployment permissions
 - Always validate and sanitize file contents before deployment
 - Consider implementing rate limiting to prevent abuse
 - Store API credentials securely using environment variables