Deploying
Alpha Note: Deployment is not yet enhanced by Cloesce and has room for improvement.
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.jsonEnsure your
cloesce.config.jsonfile is correctly configured for production, including the production Workers URL.NOTE: Workers URLs must have some path component (e.g.,
https://my-app.workers.dev/apihas/api). -
Configure Wrangler bindings
Open your
wrangler.tomland set all required binding IDs (e.g.,kv_namespaces,d1_databases,r2_buckets) to their production values.Example:
[[kv_namespaces]] binding = "kv" id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" -
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