💚 Deploy Vue on Cloudflare with GitHub Actions

Deployment blueprint • 2026 • ⚙️ GitHub Actions

Advertisement Space - Google AdSense

Key Features

⚡ Vue 3 Composition API with <script setup>
🌍 Global CDN with 300+ edge locations
🔒 Automatic HTTPS with SSL certificates
🔄 Preview deployments for pull requests
💰 Free tier: 500 builds/month, unlimited bandwidth
📦 Optimized builds with code splitting

📋 Configuration Files

Copy these files into your project:

.github/workflows/deploy.yml
# .github/workflows/deploy.yml
name: Deploy Vue to Cloudflare Pages

on:
  push:
    branches:
      - main
  pull_request:

jobs:
  deploy:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      deployments: write
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '20'
          cache: 'npm'

      - name: Install dependencies
        run: npm ci

      - name: Build Vue app
        run: npm run build
        env:
          NODE_ENV: production

      - name: Deploy to Cloudflare Pages
        uses: cloudflare/pages-action@v1
        with:
          apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
          accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
          projectName: my-vue-app
          directory: dist
          gitHubToken: ${{ secrets.GITHUB_TOKEN }}

# vite.config.ts
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { fileURLToPath, URL } from 'node:url'

export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    }
  },
  build: {
    outDir: 'dist',
    sourcemap: true,
    rollupOptions: {
      output: {
        manualChunks: {
          vendor: ['vue', 'vue-router'],
        },
      },
    },
  },
})

# package.json
{
  "name": "my-vue-app",
  "version": "0.0.0",
  "private": true,
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "run-p type-check build-only",
    "preview": "vite preview",
    "build-only": "vite build",
    "type-check": "vue-tsc --noEmit"
  },
  "dependencies": {
    "vue": "^3.3.11",
    "vue-router": "^4.2.5"
  },
  "devDependencies": {
    "@vitejs/plugin-vue": "^5.0.0",
    "@vue/tsconfig": "^0.5.0",
    "npm-run-all2": "^6.1.1",
    "typescript": "~5.3.0",
    "vite": "^5.0.10",
    "vue-tsc": "^1.8.27"
  }
}

# tsconfig.json
{
  "extends": "@vue/tsconfig/tsconfig.dom.json",
  "include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "@/*": ["./src/*"]
    }
  }
}

# env.d.ts
/// <reference types="vite/client" />

📦 Need all the files?

Download the complete blueprint with README, package.json, and all configuration files.

📥 Browse All Files

Configuration Summary

🚀
Framework
Vue
☁️
Cloud Provider
Cloudflare Pages & Workers
⚙️
Deployment Tool
GitHub Actions
💰
Pricing
Free tier generous, zero egress fees, flat-rate pricing

☁️ About Cloudflare Pages & Workers

Edge-first platform with zero egress fees

✓ Best For
Static sites, edge computing, cost-effective CDN, global performance
💰 Pricing
Free tier generous, zero egress fees, flat-rate pricing

Available Services:

Pages - Static Site Hosting
Workers - Edge Computing
R2 - Object Storage (S3-compatible)
D1 - SQLite Database
KV - Key-Value Storage
Durable Objects - Stateful Edge
Stream - Video Streaming
Images - Image Optimization
CDN - Global Network
DNS - Managed DNS

✅ Prerequisites

Make sure you have these ready before starting:

Node.js 18+ installed
GitHub account with repository admin access
Cloudflare account (free tier works)
Git installed locally
Basic knowledge of Vue 3 and TypeScript

🚀 Step-by-Step Implementation

Follow these steps to deploy your Vue application:

  1. 1
    Create Vue app: npm create vue@latest my-vue-app
  2. 2
    Select TypeScript, Vue Router (optional), and other features
  3. 3
    Navigate to project: cd my-vue-app
  4. 4
    Install dependencies: npm install
  5. 5
    Test locally: npm run dev
  6. 6
    Create GitHub repository and push code
  7. 7
    In Cloudflare Dashboard → Pages → Create project
  8. 8
    Get Account ID from Pages dashboard
  9. 9
    Create API Token with Cloudflare Pages Edit permissions
  10. 10
    Add CLOUDFLARE_API_TOKEN to GitHub Secrets
  11. 11
    Add CLOUDFLARE_ACCOUNT_ID to GitHub Secrets
  12. 12
    Create .github/workflows/deploy.yml
  13. 13
    Update projectName in workflow
  14. 14
    Commit and push to main branch
  15. 15
    Monitor deployment in GitHub Actions
  16. 16
    Access site at https://my-vue-app.pages.dev

💡 Additional Notes & Tips

📚 About This Stack

💚 Vue

Progressive JavaScript framework for building UIs

🟠 Cloudflare

Edge-first platform with zero egress fees

⚙️ GitHub Actions

CI/CD automation directly in GitHub

🏷️ Tags & Keywords

Vue Cloudflare Cloudflare Pages & Workers GitHub Actions CI/CD DevOps Infrastructure as Code Vue Deployment Cloudflare Hosting Production Ready 2026

Advertisement Space - Google AdSense