Skip to main content

Deployment

Deployment Workflow

When you push code to GitHub, the app will be built using GitHub Actions and automatically deployed to Cloudflare Workers.

Prerequisites

  1. Create Resources on Cloudflare

    • Create a D1 Database.
    • Create a KV Namespace.
  2. Update wrangler.jsonc

    • Set the following fields with your Cloudflare resource info:
      • d1_databases.database_name
      • d1_databases.database_id
      • kv_namespaces.id
    • Also update these variables:
      • name
      • vars
  3. Update constants.ts

    • Set your site information:
      • SITE_NAME
      • SITE_DESCRIPTION
      • SITE_URL

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_ID
  • CLOUDFLARE_ZONE_ID
  • NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY
  • NEXT_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_KEY
  • TURNSTILE_SECRET_KEY

Summary

  1. Create the required Cloudflare resources and update your configuration files.
  2. Add the necessary secrets and variables in GitHub.
  3. Push your code to GitHub — deployment will happen automatically.
  4. Set environment variables in Cloudflare.