Before deploying, ensure you’ve completed the installation and configuration steps.
Pre-deployment checklist
Before deploying to production, verify these items:Set production secrets
Set your Better Auth secret for the production environment:You’ll be prompted to enter the secret value securely.
Deployment process
Gitflare uses Alchemy for deployment orchestration, which handles Workers, Durable Objects, and D1 database bindings automatically.Build the application
Build the production bundle:This compiles the TanStack Start application and prepares it for deployment.
Deploy to production
Deploy your application to Cloudflare Workers:Alchemy handles the deployment of:
- Cloudflare Worker with your application code
- Durable Objects for Git repository storage
- D1 database bindings
- Custom domain configuration (if configured)
The first deployment may take a few minutes as Cloudflare provisions resources.
Deployment environments
Gitflare supports multiple deployment environments through Alchemy’s stage management.Local development
Run the development server locally:- Hot module reloading
- Local database bindings
SITE_URLset tohttp://localhost:3000- Debug logging enabled
Preview deployments
For pull requests and testing, deploy preview environments:- Use a unique subdomain
- Comment on GitHub PRs with the preview URL
- Isolate database changes
Production deployment
Deploy to production:- Use your custom domain (if configured)
- Set
LOG_LEVELtowarn - Apply production secrets
- Enable performance optimizations
Managing deployments
View deployment status
Check the status of your deployed Worker:Rollback deployment
If you need to rollback to a previous deployment:View logs
Tail logs from your production Worker:Ctrl+C to stop.
Database management
Run migrations
Apply new migrations to your production database:Query production database
Execute queries against your production D1 database:Continuous deployment
For automated deployments, integrate Gitflare with your CI/CD pipeline.GitHub Actions example
Create.github/workflows/deploy.yml:
deploy.yml
Add
CLOUDFLARE_API_TOKEN and BETTER_AUTH_SECRET to your GitHub repository secrets.Troubleshooting
Deployment fails with authentication error
Deployment fails with authentication error
Ensure you’re logged into Wrangler:Verify your authentication status:
Database migrations fail
Database migrations fail
Check that your Cloudflare credentials are set correctly in
.env:CLOUDFLARE_ACCOUNT_IDCLOUDFLARE_DATABASE_IDCLOUDFLARE_D1_TOKEN
Custom domain not working
Custom domain not working
Verify the domain is configured in Ensure DNS records point to Cloudflare and the domain is active in your Cloudflare dashboard.
alchemy.run.ts:Worker fails to start
Worker fails to start
Check Worker logs for errors:Common issues:
- Missing environment variables
- Database migration not applied
- Durable Objects not properly bound
Monitoring and performance
Cloudflare dashboard
Monitor your deployment from the Cloudflare Workers dashboard:- Navigate to Workers & Pages in your Cloudflare account
- Select your
gitflare-webWorker - View metrics including:
- Request count
- Error rate
- CPU time
- Invocations
Performance optimization
For optimal performance:- Enable caching for static assets
- Use Cloudflare CDN for repository clones
- Monitor Durable Object usage
- Set appropriate
LOG_LEVELin production (warnorerror)
Cleanup and teardown
To remove your Gitflare deployment:Next steps
Development workflow
Learn about local development and testing
API reference
Explore Gitflare’s API documentation