Deploying
With your application built and your database migrated, you’re ready to deploy your Cloesce application to Cloudflare Workers. Deployment is done through the Wrangler CLI.
-
Modify
cloesce.config.tsEnsure your
cloesce.config.tsfile is correctly configured for production, including the production Worker URL. -
Configure Wrangler bindings
Open your
wrangler.jsoncand set all required binding IDs (e.g.,kv_namespaces,d1_databases,r2_buckets) to their production values.{ "r2_buckets": [ { "binding": "bucket", "bucket_name": "xxxxxxxx" } ], } -
Build your application
Run the compile command to generate the necessary files for deployment:
npx cloesce compile -
Deploy using Wrangler
Publish your application to Cloudflare Workers:
npx wrangler deploy -
Deploy your frontend
If you have a frontend application (e.g., built with Vite), build and deploy it to your preferred hosting service. For example, with Cloudflare Pages:
npx wrangler pages deploy ./dist