Deployment
Deployment Workflow
When you push code to GitHub, the app will be built using GitHub Actions and automatically deployed to Cloudflare Workers.
Prerequisites
-
Create Resources on Cloudflare
- Create a D1 Database.
- Create a KV Namespace.
-
Update
wrangler.jsonc- Set the following fields with your Cloudflare resource info:
d1_databases.database_named1_databases.database_idkv_namespaces.id
- Also update these variables:
namevars
- Set the following fields with your Cloudflare resource info:
-
Update
constants.ts- Set your site information:
SITE_NAMESITE_DESCRIPTIONSITE_URL
- Set your site information:
GitHub Configuration
GitHub Secrets
Add the following secret in your GitHub repository settings:
CLOUDFLARE_API_TOKEN— Your Cloudflare API token for deployment.
GitHub Variables
Add these variables in your GitHub repository settings:
CLOUDFLARE_ACCOUNT_IDCLOUDFLARE_ZONE_IDNEXT_PUBLIC_STRIPE_PUBLISHABLE_KEYNEXT_PUBLIC_TURNSTILE_SITE_KEY
Cloudflare Environment Variables
After you finish the above configuration, when you push code, it should be deployed to Cloudflare Workers via GitHub Actions without issues.
Next, set these environment variables in your Cloudflare dashboard:
RESEND_API_KEYTURNSTILE_SECRET_KEY
Summary
- Create the required Cloudflare resources and update your configuration files.
- Add the necessary secrets and variables in GitHub.
- Push your code to GitHub — deployment will happen automatically.
- Set environment variables in Cloudflare.