Multiple Worker API Gateway Architecture

I am seeking guidance on best practices and a sample repository that can help me understand how to properly set up a project with multiple workers responding to a single API gateway, like api.example.com. Specifically, I want to use different workers for different endpoints, directing /files to worker_1 and /jobs to worker_2. Additionally, I need to implement rate limiting and authentication for these services. How can I effectively organize and configure this project using Wrangler to include these features?
1 Reply
Radoš
Radoš5mo ago
- Create a npm workspace - Create each worker - Create a router worker with service binding to other workers - Use Hono or itty-router - In the same router worker you can do rate limiting or create a single worker just for that (that will go before router with bindings to it)