Email worker inside of a pages repo?

Hey folks, I'm trying to develop something that uses both pages for deployment of a frontend / backend website, but also an email worker. I want to try to keep the code in the same repo, but I realize that it will need to be separate deployments on CloudFlare, since pages doesn't support email routing. Are there existing patterns to keep both my pages and my email worker's code in the same repo while still being able to deploy everything?
2 Replies
xeon06
xeon06OP13mo ago
It seems like I can add a wrangler.toml to the same repo and deploy a worker through that, but my pages and my worker deployment will be separate If anyone has a better pattern let me know!
Erisa
Erisa13mo ago
The deployments have to be separate as you discovered. You can either use separate directories in a monorepo or as you mentioned add a wrangler.toml to define the Worker side of things and use that. But you will have to deploy them both separately. I recommend using some kind of CI/CD to deploy both at the same time
Want results from more Discord servers?
Add your server