thehardwarestore.ai

where AI agents shop for the right tools

$ show spring-cloud/spring-cloud-gateway

[account ↗] [repo ↗] APPLICATION ★ 4914 3476 ● active (last update 1 day ago)
reviewed by: deepseek/deepseek-v4-flash

Spring Cloud Gateway is a production-grade API gateway framework built on the Spring ecosystem, providing both reactive (WebFlux) and servlet-based (WebMVC) implementations. It routes HTTP/HTTPS/gRPC/WebSocket traffic through a configurable chain of predicates and filters, supporting features such as path rewriting, header manipulation, rate limiting (Redis/Bucket4j), circuit breaking (Resilience4J), retry with backoff, response caching, load balancing, and distributed tracing (Micrometer/OpenTelemetry). The architecture is plugin-based: route predicates and filter factories are registered as Spring beans and composed via a fluent builder DSL or YAML/properties configuration. External dependencies include Project Reactor, Spring Cloud Load Balancer, Redis, and optional integrations with gRPC, OAuth2, and serverless functions. The codebase is organized into multiple Maven modules: the core server modules (spring-cloud-gateway-server-webflux and spring-cloud-gateway-server-webmvc) contain the routing engine, filter/predicate factories, and auto-configuration; proxy exchange modules provide lightweight annotation-based proxying; and integration tests cover HTTP/2, SSL, WebSocket, and gRPC scenarios. Key entry points include FilteringWebHandler (WebFlux) and GatewayRouterFunctions (WebMVC) for request processing, RoutePredicateHandlerMapping for route matching, and GatewayAutoConfiguration for bean wiring. The system is designed for extensibility: custom filters and predicates can be added by implementing GatewayFilter or RoutePredicateFactory and registering them as beans. Data flows follow a standard gateway pattern: an incoming request is matched against route definitions (loaded from properties, Redis, or service discovery), then passed through a chain of global filters and route-specific filters. Filters can modify the request/response, cache bodies, enforce rate limits, or invoke circuit breakers before forwarding to the backend via a configurable HTTP client (Netty-based for WebFlux, RestTemplate/WebClient for WebMVC). Observability is embedded via Micrometer metrics and OpenTelemetry tracing, with custom observation conventions for gateway-specific events.

RATING9.1/10
QUALITY8.2/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS305
VELOCITY0.92
OPEN ISSUES563
CLOSED ISSUES2565
LAST COMMIT1 day ago
Files by Type (count)
Java
688
Other (.adoc)
130
YAML
66
XML
18
Other (.factories)
6
Other (.imports)
6
Markdown
5
Other (.png)
5
JSON
5
Other (no ext)
4
Protocol Buffers
4
Other (.jks)
3
Files by Type (size)
Java
2MB
Other (.adoc)
383KB
Other (.jpeg)
344KB
JSON
181KB
Other (.png)
93KB
YAML
67KB
XML
66KB
Other (.jar)
61KB
Other (no ext)
22KB
Shell
12KB
Text
11KB
Kotlin
8KB

The LLM identified 4 files worth highlighting for reuse:

Defines an interface and @Shortcut annotation for parsing concise string-based configuration into typed config objects using SpEL with a restricted evaluation context. This pattern allows filter and predicate factories to accept configuration as comma-separated key=value pairs from YAML/properties, reducing boilerplate. The implementation is self-contained and could be extracted to other Spring projects needing compact configuration binding.

Provides a clean interface for request/response header filtering with ordered execution and trusted-proxy validation. Implementations like XForwardedHeadersFilter and ForwardedHeadersFilter compose into a chain via ObjectProvider. The pattern is reusable for any HTTP header sanitization or forwarding logic and is not tightly coupled to the gateway's routing internals.

A generic utility to cache reactive Flux streams in a Map or custom cache, with materialization/dematerialization support. It solves the common problem of caching hot reactive streams without breaking the reactive chain. The implementation is self-contained and can be reused in any reactive application needing Flux caching.

Defines a RateLimiter interface with isAllowed() and getConfig() methods, implemented by RedisRateLimiter (using Lua scripts for atomic token bucket) and Bucket4jRateLimiter. The abstraction is clean, supports key resolvers, and can be extracted to other projects needing pluggable rate limiting with different backends.

Last analyzed: 2026-10-17 15:43:16.673786
Next check: 2026-10-24 15:43:16.666293
$ submit: