Skip to content

Request: Add cross-service rate limiting example #231

@vozi-tech

Description

@vozi-tech

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

  1. API Gateway Rate Limiting: Enforcing global rate limits at the gateway level before requests reach individual services
  2. Per-User Rate Limiting Across Services: Tracking and enforcing rate limits for specific users across multiple microservices
  3. Service-to-Service Rate Limiting: Protecting internal service APIs from being overwhelmed by other services
  4. 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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions