Skip to content

Conversation

@tschaffter
Copy link
Member

@tschaffter tschaffter commented Oct 24, 2025

Description

Configure the BixArena API Gateway to forward requests to downstream services and make routing/security behavior driven by route configuration generated from OpenAPI specs. This centralizes route metadata, enables deterministic generation of routes.yml, and allows per-route anonymous/public endpoints to be declared and enforced by the gateway's security configuration.

Architecture

bixarena-architecture

Related Issue

Resolves SMR-553

Changelog

  • Add route configuration generation tooling and Gradle task to derive routes.yml from OpenAPI files.
  • Introduce runtime route registry and configuration binding to drive gateway behavior.
  • Make gateway security and route forwarding behavior depend on route metadata (audience, scopes, anonymous access).
  • Update gateway configuration and OpenAPI annotations to support the above.

Notes

Warning

This PR modified the .env file of bixarena-app to route requests to the API and auth services via the API gateway. For now, the app continues to route auth-related requests to the authorization server as rerouting the requests with a session cookie requires extra works. See .env.example.

Important

The traffic to the auth service is now redirected via the API gateway.

Testing

Build the Docker images:

bixarena-build-images

Update the .env file of bixarena-app.

Start the stack with Docker Compose:

nx serve-detach bixarena-apex

Access the app on http://127.0.0.1:8100 and check that the leaderboard page includes two models. You can also check the logs of the bixarena-app container to ensure that the leaderboard data and model data are properly loaded.

docker logs -f bixarena-app

Preview

Features

The API Gateway now provides:

  • A one-step route generation flow (Gradle task) to produce canonical routes.yml from OpenAPI files.
  • A route registry loaded at startup that the gateway uses to determine which paths are public and how to forward requests.
  • Security configuration that permits routes marked as anonymous while requiring authentication for other endpoints.
  • Easier maintenance of route-level audience and scope data, derived from service OpenAPI definitions.

@tschaffter tschaffter self-assigned this Oct 24, 2025
@tschaffter tschaffter changed the title feat(bixarena): configure the API gateway to forward requests to downstream services feat(bixarena): configure the API gateway to forward requests to the API service Oct 24, 2025
@tschaffter tschaffter marked this pull request as ready for review October 24, 2025 22:59
@tschaffter tschaffter requested a review from rrchai as a code owner October 24, 2025 22:59
@tschaffter tschaffter changed the title feat(bixarena): configure the API gateway to forward requests to the API service feat(bixarena): configure the API gateway to forward requests to the API service (SMR-553) Oct 24, 2025
@tschaffter tschaffter changed the title feat(bixarena): configure the API gateway to forward requests to the API service (SMR-553) feat(bixarena): configure the API gateway to forward requests to downstream services (SMR-553) Oct 25, 2025
@tschaffter
Copy link
Member Author

The .env.example of bixarena-app is now referencing the API gateway exclusively for the auth and API base URLs.

API_BASE_URL=http://bixarena-api-gateway:8113/api/v1
APP_PORT=8100
ENVIRONMENT=development
AUTH_BASE_URL_SSR=http://bixarena-api-gateway:8113
AUTH_BASE_URL_CSR=http://127.0.0.1:8113

Copy link
Contributor

@rrchai rrchai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@tschaffter tschaffter enabled auto-merge October 27, 2025 15:19
@tschaffter tschaffter added this pull request to the merge queue Oct 27, 2025
Merged via the queue into Sage-Bionetworks:main with commit dfea349 Oct 27, 2025
15 checks passed
@tschaffter tschaffter deleted the feat/bixarena/gateway branch October 27, 2025 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants