-
Notifications
You must be signed in to change notification settings - Fork 102
Open
Description
Description
It would be valuable to have a dedicated example demonstrating how to implement rate limiting that can be shared across multiple services in an Encore application.
Background
While the repository includes a ts/middleware example that covers rate limiting and authorization middleware, a more comprehensive example focused specifically on cross-service rate limiting would be beneficial for developers building microservices architectures.
Proposed Implementation Approaches
The example could demonstrate:
- Redis-based rate limiting: Using Redis as a shared state store to track rate limits across multiple service instances
- Distributed rate limiting patterns: Implementing token bucket, leaky bucket, or sliding window algorithms
- Centralized rate limiting service: Creating a dedicated rate limiting service that other services can call
Use Cases to Cover
- API Gateway Rate Limiting: Enforcing global rate limits at the gateway level before requests reach individual services
- Per-User Rate Limiting Across Services: Tracking and enforcing rate limits for specific users across multiple microservices
- Service-to-Service Rate Limiting: Protecting internal service APIs from being overwhelmed by other services
- Tiered Rate Limiting: Implementing different rate limits based on user subscription levels or API keys
Language Support
Implementations in both TypeScript and Go would be helpful to serve the full Encore community.
Benefits
This example would help developers:
- Implement proper rate limiting in microservices architectures
- Prevent service abuse and ensure fair resource usage
- Protect backend services from being overwhelmed
- Learn best practices for distributed rate limiting
Thank you for considering this request!
Metadata
Metadata
Assignees
Labels
No labels