How to deploy Vue app to Vercel
Deploying Vue apps to Vercel provides automatic builds, instant deployments, and global CDN distribution with zero configuration. As the creator of CoreUI with 12 years of Vue.js development experience, I’ve deployed hundreds of Vue applications to Vercel, serving millions of users worldwide with fast load times and automatic SSL.
The fastest approach uses Vercel’s Git integration for automatic deployments on every push.
Install Vercel CLI
npm install -g vercel
Deploy from Command Line
# Navigate to your Vue project
cd my-vue-app
# Deploy to Vercel
vercel
# Follow prompts:
# ? Set up and deploy "~/my-vue-app"? [Y/n] Y
# ? Which scope do you want to deploy to? Your Name
# ? Link to existing project? [y/N] N
# ? What's your project's name? my-vue-app
# ? In which directory is your code located? ./
# Production deployment
vercel --prod
Deploy with Git Integration
- Push your project to GitHub/GitLab/Bitbucket
- Go to vercel.com
- Click “New Project”
- Import your repository
- Vercel auto-detects Vue and configures build settings
- Click “Deploy”
Configure Build Settings
Create vercel.json:
{
"buildCommand": "npm run build",
"outputDirectory": "dist",
"framework": "vue",
"installCommand": "npm install"
}
Environment Variables
Add in Vercel Dashboard or via CLI:
# Add environment variable
vercel env add VITE_API_URL
# Add for production
vercel env add VITE_API_KEY production
Access in Vue:
// .env.production
VITE_API_URL=https://api.example.com
VITE_API_KEY=your-production-key
// Use in Vue
const apiUrl = import.meta.env.VITE_API_URL
Configure Routing for SPA
Create vercel.json for Vue Router:
{
"routes": [
{
"src": "/[^.]+",
"dest": "/",
"status": 200
}
]
}
Or create public/_redirects:
/* /index.html 200
Deploy with Custom Domain
# Add custom domain
vercel domains add yourdomain.com
# Vercel provides DNS configuration:
# Add these records to your DNS:
# A @ 76.76.21.21
# CNAME www cname.vercel-dns.com
In Dashboard:
- Go to Project Settings → Domains
- Add your domain
- Configure DNS records as shown
Optimize Build Performance
Update vite.config.js:
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
export default defineConfig({
plugins: [vue()],
build: {
rollupOptions: {
output: {
manualChunks: {
vendor: ['vue', 'vue-router', 'pinia']
}
}
},
chunkSizeWarningLimit: 1000
}
})
Preview Deployments
Every branch and PR gets automatic preview deployment:
# Push feature branch
git checkout -b feature/new-ui
git push origin feature/new-ui
# Vercel automatically creates preview URL:
# https://my-vue-app-git-feature-new-ui-username.vercel.app
Deploy Specific Branch to Production
# Set production branch (default: main)
vercel --prod
# Or configure in vercel.json
{
"github": {
"silent": false,
"autoAlias": true
},
"git": {
"deploymentEnabled": {
"main": true,
"staging": false
}
}
}
Serverless Functions with Vue
Create API routes in api/ directory:
// api/users.js
export default function handler(req, res) {
res.status(200).json([
{ id: 1, name: 'John' },
{ id: 2, name: 'Jane' }
])
}
Call from Vue:
<script setup>
import { ref, onMounted } from 'vue'
const users = ref([])
onMounted(async () => {
const response = await fetch('/api/users')
users.value = await response.json()
})
</script>
<template>
<ul>
<li v-for="user in users" :key="user.id">
{{ user.name }}
</li>
</ul>
</template>
Rollback Deployment
# List deployments
vercel ls
# Promote specific deployment to production
vercel promote <deployment-url>
# Or via Dashboard:
# 1. Go to Deployments
# 2. Find previous deployment
# 3. Click "Promote to Production"
Monitor Deployments
# View deployment logs
vercel logs <deployment-url>
# Real-time logs
vercel logs --follow
# View project logs in Dashboard:
# Project → Deployments → Click deployment → Logs
Best Practice Note
This is how we deploy CoreUI Vue templates to Vercel for fast, global distribution. Vercel’s Git integration provides automatic deployments with preview URLs for every pull request, making it perfect for modern Vue development workflows. Always configure proper SPA routing, use environment variables for API keys, and leverage serverless functions for backend logic when needed.
For production applications, consider using CoreUI’s Vue Admin Template which includes deployment configurations for Vercel.
Related Articles
For other deployment options, check out how to deploy Vue app to Netlify and how to deploy Vue app to Firebase.



