Files
gh-jamshu-jamshi-marketplac…/commands/deploy-vercel.md
2025-11-29 18:50:06 +08:00

3.8 KiB

Deploy your Odoo PWA to Vercel with proper environment variable configuration.

What this command does:

  • Prepares the project for Vercel deployment
  • Guides through Vercel CLI setup or web deployment
  • Configures environment variables securely
  • Sets up continuous deployment from Git
  • Provides post-deployment verification steps

Prerequisites:

Before deploying, verify:

  1. Project builds successfully locally (npm run build)
  2. All tests pass
  3. .env file is configured and working
  4. Git repository is initialized and pushed to GitHub/GitLab/Bitbucket
  5. Vercel account exists (or guide user to create one)

Deployment Options:

npm install -g vercel
vercel login
vercel
  1. Go to https://vercel.com/new
  2. Import your Git repository
  3. Configure project settings
  4. Add environment variables
  5. Deploy

Environment Variables to Set in Vercel:

Required for production:

VITE_ODOO_URL=https://yourcompany.odoo.com
VITE_ODOO_DB=yourcompany-main
ODOO_API_KEY=your_production_api_key
ODOO_USERNAME=your.email@company.com
VITE_MODEL_NAME=x_expense
VITE_MODEL_DISPLAY_NAME=Expense

Steps:

  1. Verify project builds successfully
  2. Check if Vercel is already configured (look for vercel.json)
  3. Ask user which deployment option they prefer
  4. Guide through the chosen deployment method
  5. Help set up environment variables in Vercel dashboard
  6. Initiate deployment
  7. Wait for build to complete
  8. Test the deployed application
  9. Set up custom domain (if requested)

Framework-Specific Configuration:

SvelteKit

Verify vercel.json contains:

{
  "buildCommand": "npm run build",
  "outputDirectory": "build",
  "framework": "sveltekit"
}

React

Verify build settings:

{
  "buildCommand": "npm run build",
  "outputDirectory": "dist",
  "framework": "vite"
}

Vue

Verify build settings:

{
  "buildCommand": "npm run build",
  "outputDirectory": "dist",
  "framework": "vite"
}

Post-Deployment Checks:

After deployment, verify:

  1. Application loads correctly
  2. Odoo connection works (check browser console)
  3. Data syncs from Odoo
  4. CRUD operations work
  5. Offline functionality works
  6. PWA can be installed
  7. Service worker is active

Example prompts to use this command:

  • /deploy-vercel - Interactive deployment wizard
  • User: "Deploy my PWA to Vercel"
  • User: "Help me set up Vercel deployment"

Continuous Deployment:

Once Git integration is set up:

  • Every push to main branch triggers automatic deployment
  • Preview deployments for pull requests
  • Automatic rollback on build failures
  • Environment variables persist across deployments

Custom Domain Setup:

If user wants a custom domain:

  1. Go to Vercel Dashboard → Project → Settings → Domains
  2. Add custom domain
  3. Configure DNS records as shown
  4. Wait for SSL certificate provisioning (automatic)
  5. Test HTTPS access

Troubleshooting:

Build Fails

  • Check build logs in Vercel dashboard
  • Verify all dependencies are in package.json
  • Ensure Node version is compatible
  • Check for environment-specific code

Environment Variables Not Working

  • Verify variables are set in Vercel dashboard
  • Check variable names match exactly (case-sensitive)
  • Ensure variables starting with VITE_ for client-side access
  • Redeploy after adding new variables

API Routes Not Working

  • Verify serverless functions are in correct directory
  • Check function size limits (< 50MB)
  • Review function logs in Vercel dashboard
  • Ensure API routes use correct paths

After Deployment:

Provide the user with:

  1. Deployed URL
  2. Vercel dashboard link
  3. Instructions for adding custom domain
  4. Tips for monitoring performance
  5. Reminder to update API keys for production