v1.0.0 ยท MIT License ยท Spring Boot 3.2+

Stop the crashes.
Bridge everything.

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.

React / Vue / Angular
JS Frontend
โ€บ
Spring Boot
Your Backend
โ€บ
โšก FastBridger
This Library
โ€บ
FastAPI (Python)
AI / ML Service
The Problem

Two pain points.
One dependency.

Every Spring Boot + JS stack eventually hits the same two walls. FastBridger tears them down.

Without FastBridger

  • CORS errors block your JS frontend before a single real request lands
  • Spring Security or MVC config silently drops CORS headers on some paths
  • Credentials + wildcard origin combination crashes the app at runtime
  • Calling FastAPI means writing boilerplate WebClient, retry, and error handling from scratch
  • RestTemplate blocks threads waiting for Python responses

With FastBridger

  • Dual-layer CORS โ€” filter + MVC โ€” so no request path slips through
  • Credentials + wildcard handled automatically with allowedOriginPatterns
  • All JS dev server ports pre-configured out of the box
  • Inject FastApiClient and call .get(), .post() โ€” done
  • Non-blocking WebClient โ€” threads never idle waiting for FastAPI
Features

Everything you need.
Nothing you don't.

Designed as a true Spring Boot starter โ€” drop it in, set two lines, and move on.

๐Ÿ›ก๏ธ

Dual-Layer CORS

Registers both a CorsFilter at servlet level and a WebMvcConfigurer at handler level. Neither alone is enough โ€” FastBridger uses both.

Spring MVC
โšก

Typed FastAPI Client

Inject FastApiClient and call typed GET, POST, PUT, PATCH, DELETE โ€” both blocking and reactive Mono/Flux variants included.

WebClient
๐Ÿ”

Automatic Retry

Exponential backoff on transient connection failures. Smart enough to skip 4xx/5xx โ€” only retries real network blips.

Resilience
๐Ÿ”‘

Auth Built-in

Configure a Bearer token or API key in application.yml and every FastAPI request is authenticated automatically.

Security
โค๏ธ

Health Indicator

Adds /actuator/health/fastapi automatically when Actuator is on the classpath. Know instantly if your Python service is down.

Actuator
โš™๏ธ

Zero Boilerplate

Pure Spring Boot auto-configuration. Add the dependency, set your allowed origins and FastAPI URL. No @Bean methods required.

Auto-Config

Two steps to done.

pom.xml
<dependency>
    <groupId>io.fastbridger</groupId>
    <artifactId>fastbridger-spring-boot-starter</artifactId>
    <version>1.0.0</version>
</dependency>
build.gradle.kts
implementation("io.fastbridger:fastbridger-spring-boot-starter:1.0.0")
src/main/resources/application.yml
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
Usage

Inject. Call. Ship.

One bean. All HTTP methods. Blocking and reactive.

UserService.java
@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);
    }
}
Performance

Faster, not slower.

A common concern โ€” here's the honest reality. FastBridger adds near-zero overhead, and the reactive client actually improves throughput over RestTemplate.

Component
Overhead
Why
CORS Filter
~0.01ms
per request
Just reads and writes HTTP headers. No I/O, no blocking.
Auto-Configuration
Startup only
Runs once at boot. Zero cost per request after that.
FastApiClient vs RestTemplate
+Faster
Non-blocking WebClient. Threads freed while waiting for Python. Higher throughput under load.
Health Indicator
On-demand
Only fires when Actuator is polled. Invisible to normal traffic.
FAQ

Common questions.

No. The CORS filter adds ~0.01ms per request (header reads/writes). Auto-configuration runs only once at startup. The FastApiClient uses a non-blocking WebClient which actually improves throughput over the old blocking RestTemplate because threads are freed while waiting for FastAPI responses.
Yes. FastBridger registers a 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.
Absolutely. Set 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.
Set 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.
FastBridger targets Spring Boot 3.2+ and Java 17+. It uses the new @AutoConfiguration annotation and the Sonatype Central Portal publisher which are Boot 3.x features. A Boot 2.x backport is not planned.
FastBridger uses @ConditionalOnMissingBean on all its beans. If you already define an ObjectMapper, FastBridger's won't be registered. Your existing beans always take precedence.
RC

Ramdev G. Calope

Full-stack developer ยท Spring Boot ยท AI/LLM ยท FastAPI

linkedin.com/in/ramdevcalope ramdev2025