React single-page app to create custom baskets against the API exposed at POST /baskets. The base URL is supplied via VITE_CUSTOM_BASKET_API_URL and defaults to http://localhost:8000/ (the UI appends /baskets automatically).
The UI polls GET /baskets every second to display live valuations of existing baskets.
- Dynamic form for basket details and position weights
- Metadata cleanup for each position prior to submission
- AG Grid-powered creation flow for new custom baskets
- Clipboard paste support to import tickers and weights directly from spreadsheets
- Live basket valuation grid backed by polling (AWS Lambda compatible)
- Live request payload preview and JSON response viewer
- Ant Design powered layout and controls
- Environment-configured API endpoint via
VITE_CUSTOM_BASKET_API_URL - Unit tests with Vitest and Testing Library
- Docker image to build and serve the production bundle via Nginx
npm install
npm run devVisit http://localhost:5173 and make sure the basket API is reachable at the configured endpoint.
npm testGenerate a coverage report (used by SonarCloud):
npm run test:coveragenpm run buildThe static assets will be generated in dist/.
Build the image (override the basket API base if needed):
docker build \
--build-arg VITE_CUSTOM_BASKET_API_URL=http://localhost:8000/ \
-t custom-basket-ui .Run the container:
docker run -p 8080:80 custom-basket-uiThe app will be available at http://localhost:8080
Spin up the container with Docker Compose (automatically builds the image):
docker compose up --buildOverride the basket API base during build:
docker compose build \
--build-arg VITE_CUSTOM_BASKET_API_URL=http://localhost:8000/
docker compose up- Build and push the container image to a registry your cluster can pull from (update
imageink8s/deployment.yaml). - Apply the manifests:
kubectl apply -f k8s/
- Expose the
Serviceexternally (e.g. via anIngressorLoadBalancerservice) if you need public access.
This project uses AWS Amplify to serve the application via CloudFront CDN, with GitHub Actions handling the build and deployment trigger.
- GitHub Actions builds the app and creates a ZIP file
- ZIP uploaded to S3 bucket
custom-basket-ui/deploy.zip - Amplify deployment triggered automatically via AWS API
- AWS Amplify deploys and serves content via CloudFront CDN
-
Create Amplify app:
- Sign in to the AWS Amplify Console
- Click "New app" → "Deploy without Git provider"
- Select "Amazon S3" as the method
- Set S3 location:
s3://custom-basket-ui/deploy.zip - Important: Make sure to select the ZIP file format option
- Click "Save and deploy"
-
Get the Amplify App ID:
- In the Amplify Console, click on your app
- Copy the App ID from the URL or app settings (format:
d1a2b3c4d5e6f7)
-
Configure custom domain (optional):
- Go to "App settings" → "Domain management"
- Click "Add domain"
- Follow the instructions to configure DNS records
Every push to main triggers:
- GitHub Actions builds the app with
npm run build - Creates a ZIP file from the
dist/folder contents - Uploads
deploy.zipto S3 bucketcustom-basket-ui - Triggers Amplify deployment via AWS API
- Amplify extracts and serves the content via CloudFront CDN
- App is available at your Amplify URL (e.g.,
https://main.xxxxxx.amplifyapp.com)
Set these in your repository (Settings → Secrets and variables → Actions → Environment secrets for prd):
AWS_ROLE_ARN- IAM role ARN for OIDC authentication (e.g.,arn:aws:iam::833715352507:role/github-deploy-static-site)AMPLIFY_APP_ID- Your Amplify app ID from the Amplify Console
This repo ships with the following workflows:
.github/workflows/docker-publish.ymlbuilds the Docker image on each push tomain(and version tags) and publishes it to GitHub Container Registry. The workflow targets theprdGitHub environment.- Optional: set the secret
VITE_CUSTOM_BASKET_API_URLto override the default API endpoint baked into the build. - Update the
REGISTRY/IMAGE_NAMEenv values if you prefer a different registry.
- Optional: set the secret
.github/workflows/sonar.ymlruns SonarCloud quality gate checks on pushes and pull requests. The workflow targets theprdGitHub environment.- Add the repository secret
SONAR_TOKEN(generated from SonarCloud) and repository variablesSONAR_ORGANIZATIONandSONAR_PROJECT_KEYbefore enabling the workflow. - The workflow runs
npm run test:coverage(to emitcoverage/lcov.info) andnpm run buildprior to invoking the Sonar scan.
- Add the repository secret
VITE_CUSTOM_BASKET_API_URL— set during build to bake in the base API URL (defaults tohttp://localhost:8000/).
├── Dockerfile
├── docker
│ └── nginx.conf
├── src
│ ├── App.tsx
│ ├── components/ # component helpers (future expansion)
│ ├── hooks/
│ ├── styles/
│ ├── test/
│ ├── types/
│ └── utils/