Daily European Central Bank web‑scraper that extracts FX rates, computes cross rates, and stores them in Firestore. Exposed as an HTTP Cloud Function (main).
- Node.js 22 (see
.nvmrc). If your shell selects a different version, runnvm use. - PNPM as the package manager (recommend
corepack enable && corepack install).
pnpm install- Build:
pnpm compile(TypeScript →index.js). - Lint/format:
pnpm lint,pnpm format(usepnpm lint --fixto auto‑fix). - Start locally:
GCP_PROJECT_ID=forex-api-daily pnpm start(Functions Framework onhttp://localhost:8081/main). - Test:
pnpm test(runs Vitest; may use Firestore emulator if configured). If you hit PNPM migration issues with lifecycle scripts, run build/lint directly and let us know to update scripts. - Start Firestore emulator:
pnpm start-db(runs onhttp://localhost:8080).
- Fetch: Scrapes ECB RSS endpoints to gather daily EUR base rates.
- Process: Combines latest day’s rates and derives cross rates for other bases.
- Store: Writes documents to the
exchange_ratescollection; periodically removes stale dates.
- GitHub Actions (
.github/workflows/ci.yml) runs tests on push. Deploys frommainto Cloud Functions using repo secrets for GCP.
- Do not commit credentials. Files like
.envandservice-account.jsonare ignored by Git. - The compiled
index.jsis generated; avoid committing build artifacts.