Deployment Guide
This guide explains how to deploy your Shopify Vue app to production environments.
Understanding Deployment Requirements
The Shopify Vue App template is a full-stack application with both frontend and backend components that need to be deployed together:
- Frontend: Vue.js application built with Vite
- Backend: Node.js Express server that handles:
- Authentication with Shopify
- API endpoints
- Webhook processing
- Database operations
Important: Because this is a unified app where the backend serves the frontend, deploying to static-only hosting providers like Vercel or Netlify will not work. You need a platform that can run Node.js server applications.
Recommended Deployment Platforms
1. Heroku
Heroku offers a simple deployment experience and supports both Node.js and database services.
Setup Steps:
Create a
Procfile
in your project root:web: cd web && npm run serve
Set environment variables in Heroku dashboard:
SHOPIFY_API_KEY=your_api_key SHOPIFY_API_SECRET=your_api_secret SCOPES=your_scopes HOST=your_heroku_app_url
Deploy using the Heroku CLI:
bashheroku create your-app-name git push heroku main
Add a database add-on:
bashheroku addons:create heroku-postgresql:hobby-dev
2. Digital Ocean App Platform
Digital Ocean's App Platform provides a managed environment well-suited for Shopify apps.
Setup Steps:
- Connect your GitHub repository to Digital Ocean
- Configure as a Node.js application
- Set environment variables in the app settings
- Add a managed database service
3. AWS Elastic Beanstalk
For more advanced deployments with scaling needs:
Setup Steps:
- Create a
.ebextensions
configuration - Configure RDS for database storage
- Set up environment variables through the AWS console
- Deploy using the EB CLI:bash
eb init eb create production-environment
4. Docker Deployment
The template includes a Dockerfile for containerized deployment:
Setup Steps:
Build the Docker image:
bashdocker build -t shopify-vue-app .
Run with environment variables:
bashdocker run -p 8081:8081 \ -e SHOPIFY_API_KEY=your_key \ -e SHOPIFY_API_SECRET=your_secret \ -e HOST=your_host \ -e SCOPES=your_scopes \ shopify-vue-app
Deploy to container services like:
- Azure Container Instances
- Google Cloud Run
- AWS ECS
Database Configuration for Production
For production, replace the SQLite database with a more robust solution:
MySQL Configuration
// In web/server/src/shopify.js
import { MySQLSessionStorage } from '@shopify/shopify-app-session-storage-mysql'
// Replace the session storage configuration
sessionStorage: MySQLSessionStorage.withCredentials(
process.env.DATABASE_HOST,
process.env.DATABASE_NAME,
process.env.DATABASE_USER,
process.env.DATABASE_PASSWORD,
{ connectionPoolLimit: 100 }
)
PostgreSQL Configuration
// In web/server/src/shopify.js
import { PostgreSQLSessionStorage } from '@shopify/shopify-app-session-storage-postgresql'
// Replace the session storage configuration
sessionStorage: PostgreSQLSessionStorage.withCredentials(
process.env.DATABASE_HOST,
process.env.DATABASE_NAME,
process.env.DATABASE_USER,
process.env.DATABASE_PASSWORD
)
Production Environment Variables
Essential environment variables for production:
# Authentication
SHOPIFY_API_KEY= # Your app's API key
SHOPIFY_API_SECRET= # Your app's API secret
SCOPES= # Required app scopes (comma-separated)
HOST= # Your app's public URL
# Database (if using external database)
DATABASE_HOST= # Database hostname
DATABASE_NAME= # Database name
DATABASE_USER= # Database username
DATABASE_PASSWORD= # Database password
# Optional
PORT=8081 # Port to run the server (default: 8081)
NODE_ENV=production # Set to production
Post-Deployment Steps
After deploying:
Update URLs in Shopify Partner Dashboard
- App URL
- Allowed redirection URLs
- Webhook endpoints
Verify Webhooks
- Test app uninstallation to ensure webhooks are received
- Check GDPR webhooks configuration
Monitor Application
- Set up logging (consider Logtail, Papertrail, etc.)
- Configure error tracking (Sentry, Bugsnag, etc.)
- Set up performance monitoring
Setup Database Backups
- Configure automated backups
- Test restoration procedures
Troubleshooting Deployment Issues
If you encounter issues after deployment:
Check Server Logs
bash# Heroku example heroku logs --tail
Verify Environment Variables Ensure all required variables are set correctly.
Check CORS Configuration If you're seeing CORS errors, verify your domain is properly configured.
Database Connection Issues Test database connectivity and ensure credentials are correct.
For more help, see the Troubleshooting Guide or contact support.