Getting Started
Run the BFF and call the dashboard endpoint.
Use either IntelliJ plus mock downstream services, or Docker Compose for the complete local stack.
Running From IntelliJ
- Import the repository as a Maven project.
- Use JDK 21 for the project SDK.
- Create a Spring Boot run configuration for
com.dani.bff.ReactBffGatewayApplication. - Set the active profile to
local. - Start the mock downstream services.
docker compose up user-service product-service
Run the Spring Boot application from IntelliJ, then confirm the health endpoint is available:
Invoke-WebRequest http://localhost:8080/actuator/health
Running With Docker Compose
Start the complete local stack:
docker compose up --build
| Service | URL | Purpose |
|---|---|---|
| BFF | http://localhost:8080 |
React-facing Spring Boot gateway. |
| User service | http://localhost:8081 |
WireMock downstream for profile data. |
| Product service | http://localhost:8082 |
WireMock downstream for recommendations. |
Stop the stack when finished:
docker compose down
Local JWT Generation
The helper script creates an HS256 token suitable for local development:
$token = powershell -ExecutionPolicy Bypass -File .\scripts\create-local-jwt.ps1
Default claims:
sub:user-123iss:react-bff-gateway-localaud:react-dashboardscope:dashboard:read- TTL: 60 minutes
Override common values when needed:
$token = powershell -ExecutionPolicy Bypass -File .\scripts\create-local-jwt.ps1 -Subject user-456 -TtlMinutes 30
Development-only token flow
Local HS256 validation is intended for development. Production-style deployments should configure BFF_JWT_JWK_SET_URI or BFF_JWT_ISSUER_URI.
Calling /api/dashboard
Call the dashboard endpoint with the generated Bearer token:
Invoke-WebRequest `
-Headers @{ Authorization = "Bearer $token" } `
http://localhost:8080/api/dashboard
Example response:
{
"user": {
"id": "user-123",
"displayName": "Demo User",
"email": "demo@example.com"
},
"recommendedProducts": [
{
"id": "prd-001",
"name": "Premium Account",
"price": 9.99
}
]
}