Should two related workers be developed in a single codebase, with separate wrangler.toml to bind?
Trying to understand how codebases related to CloudFlare workers. AI and docs appear to suggest different things.
If building WorkerA, WorkerB, and DurableObjectC. And WorkerA will receive API requests from the web, call APIs on WorkerB and DurableObjectC. Should they be developed and tested in a single repository, or split out into separate repositories, one per worker?
4 Replies
It's mostly a matter of preference. Everything should work whether in the same repo or not, but for typing, it might be easier to have them all in one repo
Thank you! How does that work with the github repo integration in the CloudFlare dashboard?
What I mean is: if you have a
src/worker_a
and a src/worker_b
in the same repo, how does one configure CloudFlare?I haven't tried this but recently was investigating the same, this is an example for many workers monorepo:
https://github.com/ardislu/cloudflare-workers
GitHub
GitHub - ardislu/cloudflare-workers: Monorepo for my personal Cloud...
Monorepo for my personal Cloudflare Workers. Contribute to ardislu/cloudflare-workers development by creating an account on GitHub.
And seems here's some guidance on configuration with github:
https://developers.cloudflare.com/workers/ci-cd/builds/advanced-setups/
Cloudflare Docs
Advanced Setups | Cloudflare Workers docs
Learn how to use Workers Builds with more advanced setups