A React + D3 single page app that streams yield curves over SSE and renders the live fit.
- Install dependencies:
npm install - Start the dev server:
npm run dev - The Vite proxy forwards
/curvesrequests tohttp://localhost:8000.
Build a local image:
docker build -t curve-fitter-ui:latest .
docker run --rm -p 8080:80 \
-e STREAM_URL="http://localhost:8000/curves/stream" \
-e APP_ENV="prd" \
curve-fitter-ui:latestSTREAM_URLcontrols the SSE endpoint the UI connects to. Override it when starting the container, e.g.-e STREAM_URL="http://backend:8000/curves/stream".APP_ENVlabels the environment (prdby default). The UI reads both values fromconfig.js, which is generated fromconfig.template.jsduring container start-up.
- Run
./run.sh lambda(ornpm run build:lambda) to build the SPA and stage the Lambda bundle underlambda/build. - The Lambda bundle is archived as
lambda/curve-fitter-ui-lambda.zip; upload it when creating the function. - Configure the function with runtime Node.js 18.x (or newer) and handler
lambda/handler.handler. - Provide
STREAM_URLandAPP_ENVenvironment variables to override the defaults used byconfig.js. Without overrides the Lambda bundle points tohttp://localhost:8080/curves/stream. - Attach an HTTP API (or Function URL) to serve the UI; the handler responds to
GET/HEADand serves the prebuilt assets. - Client-side routes fall back to
index.html, so deep links keep working.
The GitHub Actions workflow at .github/workflows/docker-publish.yml now runs quality gates, publishes container images, and updates AWS ECS.
- Runs when
SONAR_TOKEN,SONAR_PROJECT_KEY, and (for SonarCloud)SONAR_ORGANIZATIONsecrets are present. - Installs dependencies, builds the app, and executes the Sonar analysis via
sonarsource/sonarcloud-github-action. - Skips automatically when the secrets are missing (for example on forks).
- Always builds a multi-architecture image (
linux/amd64,linux/arm64). - Pushes image tags to GHCR on pushes to
mainand version tags (v*); pull requests build only. - When AWS credentials are supplied, the same image is tagged and pushed to Amazon ECR (
${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com/<repository>). Override the repository name via theECR_REPOSITORYrepository variable if you do not want the defaultcurve-fitter-ui.
- On pushes to
main, if an ECR image is available, the workflow registers a new task definition revision with the fresh image and updates the target ECS service. - Requires secrets for the cluster, service, task definition family, and container name. The job waits for the service to stabilise before finishing.
SONAR_TOKEN,SONAR_PROJECT_KEY,SONAR_ORGANIZATION, and (optional)SONAR_HOST_URLfor the Sonar job.AWS_ROLE_TO_ASSUME,AWS_ACCOUNT_ID,AWS_REGION,AWS_ECS_CLUSTER,AWS_ECS_SERVICE,AWS_ECS_TASK_DEFINITION,AWS_ECS_CONTAINER_NAMEfor the registry push and ECS deployment.- (Optional) repository variable
ECR_REPOSITORYto override the default ECR repository name.
Ensure Settings → Actions → General → Workflow permissions grants the default GITHUB_TOKEN Read and write access to packages so GHCR pushes succeed.
Olivier Bonnemaison · https://github.com/bonnemai/curvefitter_ui
