This repository contains:
- UI:
index.html(deployed on GitHub Pages) - API:
api/worker.js(Cloudflare Worker, deployed via GitHub Actions)
The API uses the World Bank Indicators API v2 to fetch:
- Country list (
/country) - Topics list (
/topic) - FX rate (
PA.NUS.FCRF) - PPP conversion factor for private consumption (
PA.NUS.PRVT.PP) - GDP per capita (current US$) (
NY.GDP.PCAP.CD)
These are combined into indicative benchmark estimates.
- Create a Cloudflare account and go to Workers & Pages.
- Create an API token with Workers Scripts: Edit permission.
- Copy your Account ID from Cloudflare.
- In GitHub repo → Settings → Secrets and variables → Actions, add:
CF_API_TOKEN= your Cloudflare API tokenCF_ACCOUNT_ID= your Cloudflare account id
- Push to
main. GitHub Action will deploy the Worker. - Copy the Worker URL (e.g.,
https://companalyser-api.<subdomain>.workers.dev).
Open index.html and set:
const API_BASE = "https://companalyser-api.<subdomain>.workers.dev";Commit and push.
- GitHub repo → Settings → Pages
- Source: Deploy from a branch
- Branch:
main| Folder:/ (root) - Save and wait 30–60 seconds.
Your UI will be live at:
https://<username>.github.io/<repo>/
- GitHub Pages is static; the Worker provides the dynamic API.
- Benchmarks are indicative and should be validated with surveys.