Overview
Fly.io hosts and executes your Shopify extension deployments. Each generation triggers a Fly.io build that compiles your code and deploys it to Shopify.Why Fly.io?
Zero Config
Automatic setup
- Detects build tools
- Configures environment
- Manages dependencies
- Handles secrets
Fast Builds
Quick deployments
- Cached layers
- Parallel builds
- Instant rollback
- Hot reloading
GitHub Integration
Seamless connection
- Auto-detects pushes
- Branch deployments
- PR previews
- Commit tracking
Shopify CLI
Built-in tools
- Shopify CLI installed
- Deploy commands
- Extension bundling
- Version management
Setup Process
1
Create Fly.io Account
Sign up for Fly.io:
- Go to fly.io
- Click “Start a New Project”
- Sign in with GitHub
- Authorize Fly.io app
2
Generate Fly.io Token
Create API token:
- Go to Account Settings → Tokens
- Click “Create New Token”
- Name it “Synapse Deployment”
- Copy the token
3
Add Token to Synapse
Configure in dashboard:
- Go to Settings → Integrations
- Find Fly.io section
- Paste API token
- Click “Connect Fly.io”
4
Project Created
Synapse automatically creates:
- Fly.io project per user
- Service per generation
- Environment variables
- GitHub integration
Fly.io paid planject Structure
Your Fly.io setup:How Fly.io Builds Work
1
GitHub Push
Code pushed to repository triggers Fly.io
2
Build Detection
Fly.io uses buildpacks to detect:
- Language (Node.js, Rust, etc.)
- Package manager (npm, pnpm, yarn)
- Build commands
- Start commands
3
Dependency Install
Installs packages:
4
Extension Build
Compiles extension:
5
Shopify Deploy
Deploys to Shopify:
6
Completion
Extension live in your dev store
Environment Variables
Fly.io automatically configures:| Variable | Description | Source |
|---|---|---|
SHOPIFY_CLIENT_ID | App client ID | Synapse config |
SHOPIFY_CLIENT_SECRET | App client secret | Synapse config |
SHOPIFY_CLI_PARTNERS_TOKEN | Partners API token | Synapse config |
SHOPIFY_DEV_STORE_URL | Development store | User profile |
FLY_REGION | Deployment environment | Fly.io |
FLY_APP_NAME | Service identifier | Fly.io |
FLY_APP_ID | Project identifier | Fly.io |
Adding Custom Variables
Add your own environment variables:- Via Fly.io Dashboard
- Via Fly.io CLI
- Via fly.toml
- Open your Fly.io project
- Select service
- Go to Variables tab
- Click “New Variable”
- Enter name and value
- Click “Add”
- Redeploy service
buildpacks Build Configuration
Fly.io uses buildpacks for builds. Customize infly.toml:
Viewing Logs
Monitor deployments in real-time:- Fly.io Dashboard
- Fly.io CLI
- Open Fly.io project
- Select service
- Click “Deployments” tab
- Click specific deployment
- View build and runtime logs
Managing Services
View All Services
View All Services
See all deployed services:Each generation gets its own service for isolation
Restart Service
Restart Service
Manually restart a service:Useful for applying new environment variables
Delete Service
Delete Service
Remove unused services:Frees up project resources
Service Metrics
Service Metrics
Monitor performance:
- CPU usage
- Memory consumption
- Network traffic
- Build duration
- Deployment frequency
Deployment Strategies
- Instant Deploy (Default)
- Manual Deploy
- PR Previews
Every push triggers immediate deployment:Pros:
- Fast feedback
- Always up-to-date
- No manual steps
- May deploy broken code
- No review process
Cost Management
Fly.io pricing and optimization:Free Tier
- $5 free credit per month
- Pauses after 500 hours
- Shared resources
- Community support
Pro Plan ($20/month)
- $20 credit included
- Usage-based billing
- Dedicated resources
- Priority support
Optimization Tips
Remove Unused Services
Delete old generation services to save resources
Use Sleep Mode
Configure services to sleep when inactive
Optimize Builds
Cache dependencies, minimize build time
Monitor Usage
Track resource consumption in dashboard
Advanced Configuration
Custom Dockerfile
Custom Dockerfile
Use custom Docker build instead of buildpacks:Fly.io automatically detects and uses Dockerfile
Multi-Stage Builds
Multi-Stage Builds
Optimize image size:
Webhooks
Webhooks
Trigger actions on deployment events:
- Service → Settings → Webhooks
- Add webhook URL
- Select events:
- Deployment started
- Deployment succeeded
- Deployment failed
- Receive JSON payload
Troubleshooting
Build Failed
Build Failed
Error: Build fails during npm install or compilationCauses:
- Missing dependencies
- Node version mismatch
- Memory limit exceeded
- Check package.json
- Specify Node version in package.json:
- Review build logs for specific errors
- Upgrade to Pro plan for more resources
Deployment Timeout
Deployment Timeout
Error: Deployment exceeds time limitCauses:
- Large extension bundle
- Slow Shopify API
- Network issues
- Optimize bundle size
- Retry deployment
- Increase timeout in fly.toml:
Environment Variables Missing
Environment Variables Missing
Error: SHOPIFY_CLIENT_ID not foundCauses:
- Variables not configured
- Service not linked to project
- Verify variables in dashboard
- Re-add via Fly.io CLI:
- Redeploy service