A Spring Boot starter that kills CORS errors for JavaScript frontends and gives you a typed, non-blocking FastAPI client โ in two lines of config.
Every Spring Boot + JS stack eventually hits the same two walls. FastBridger tears them down.
Designed as a true Spring Boot starter โ drop it in, set two lines, and move on.
Registers both a CorsFilter at servlet level and a WebMvcConfigurer at handler level. Neither alone is enough โ FastBridger uses both.
Spring MVCInject FastApiClient and call typed GET, POST, PUT, PATCH, DELETE โ both blocking and reactive Mono/Flux variants included.
WebClientExponential backoff on transient connection failures. Smart enough to skip 4xx/5xx โ only retries real network blips.
ResilienceConfigure a Bearer token or API key in application.yml and every FastAPI request is authenticated automatically.
SecurityAdds /actuator/health/fastapi automatically when Actuator is on the classpath. Know instantly if your Python service is down.
ActuatorPure Spring Boot auto-configuration. Add the dependency, set your allowed origins and FastAPI URL. No @Bean methods required.
Auto-Config<dependency> <groupId>io.fastbridger</groupId> <artifactId>fastbridger-spring-boot-starter</artifactId> <version>1.0.0</version> </dependency>
implementation("io.fastbridger:fastbridger-spring-boot-starter:1.0.0")
fastbridger: # โโ JS Frontend CORS โโโโโโโโโโโโโโโโโโโโโโโโโโ cors: allowed-origins: - "http://localhost:3000" # React - "http://localhost:5173" # Vite - "https://myapp.com" # Production # โโ FastAPI Backend โโโโโโโโโโโโโโโโโโโโโโโโโโโโ fastapi: base-url: "http://localhost:8000" timeout: 10s max-retries: 3
One bean. All HTTP methods. Blocking and reactive.
@Service public class UserService { private final FastApiClient fastApi; public UserService(FastApiClient fastApi) { this.fastApi = fastApi; } // โโ Blocking API (sync) โโโโโโโโโโโโโโโโโโโโโโโโโ public UserDto getUser(Long id) { return fastApi.get("/users/{id}", UserDto.class, id); } public List<UserDto> getAllUsers() { return fastApi.getList("/users", UserDto.class); } public UserDto createUser(CreateUserRequest req) { return fastApi.post("/users", req, UserDto.class); } public void deleteUser(Long id) { fastApi.delete("/users/{id}", id); } // โโ Reactive API (async) โโโโโโโโโโโโโโโโโโโโโโโโ public Mono<UserDto> getUserAsync(Long id) { return fastApi.getAsync("/users/{id}", UserDto.class, id); } }
A common concern โ here's the honest reality. FastBridger adds near-zero overhead, and the reactive client actually improves throughput over RestTemplate.
FastApiClient uses a non-blocking WebClient which actually improves throughput over the old blocking RestTemplate because threads are freed while waiting for FastAPI responses.CorsConfigurationSource bean you can wire directly into your security config: http.cors(c -> c.configurationSource(corsConfigurationSource)). This ensures CORS headers are applied before Security's filter chain runs.fastbridger.cors.enabled: false to manage CORS yourself, or fastbridger.fastapi.enabled: false if you only need the CORS features. Both are independent and conditional.fastbridger.fastapi.bearer-token in your config and every request will include Authorization: Bearer ... automatically. For per-request tokens, use fastApiClient.rawClient() to add headers manually.@AutoConfiguration annotation and the Sonatype Central Portal publisher which are Boot 3.x features. A Boot 2.x backport is not planned.@ConditionalOnMissingBean on all its beans. If you already define an ObjectMapper, FastBridger's won't be registered. Your existing beans always take precedence.