What Architecture on workers?

Does anyone have any good articles on architecture guides for someone trying to use only cloudflare services for a saas. Like I’m building a MVP and love keeping it simple for my backend using only workers with durable objects and hono. My backend basically is either saving things to do storage or it’s calling 3rd party api for iot device to perform action which can take 2seconds. I can very quickly reach the execution time limits doing multiple of those so now I realize I hit a bottleneck and after some thought realize that queues were the solution to that bottleneck where I break up each event into separate calls. But now I have a problem because any backend architecture I find online i struggle to relate it to cloudflare. My ultimate question is: is there any material to learn what type of architecture or setup does cloudflare recommend for someone like me a one man team building a saas that is gaining interest at really early stages
4 Replies
Phisn
Phisn9mo ago
You could maybe use some ddd related architecture to handle your events. One approach I have read about is to have your usual domain layer with entities. When you interact with these entities they generate events (saved in their internal state) which are later published when the entity is saved back into your storage. Now you could publish these events into a queue and have triggers to consume these and so forth.
MetalGear
MetalGear9mo ago
That’s interesting. Any examples or good reads for newbie like myself. I can sort of understand what you are saying but really wish cloudflare made some blog posts on architecture and design of backends using their services. Kind of feel left out in the dark
Phisn
Phisn9mo ago
The only public project that comes to my head is https://learn.microsoft.com/en-us/dotnet/architecture/microservices/microservice-ddd-cqrs-patterns/. Its neither serverless nor nodejs but explains some nice architectural concepts. (github: https://github.com/dotnet-architecture/eShopOnContainers/wiki/Architecture)
Tin Cap
Tin Cap9mo ago
I would say this type of architecture question isn't particular to Cloudflare. I would broaden your search criteria to general serverless architectures. Obviously other cloud providers have broader service offerings, but you'll see serverless functions, queues, and databases as a standard thing across platforms. Durable Objects are uniquely Cloudflare though.