Introduction
Open source TypeScript clients for public statistical APIs.
The @varve SDK collection provides isomorphic, Zod-validated TypeScript clients for government statistical data APIs that are complex to work with directly. Each package wraps the underlying REST API into a clean, typed interface that works the same way in Node.js, modern browsers, and Cloudflare Workers.
Packages
@varve/statcan-wds
Statistics Canada Web Data Service — time series data, table metadata, and release monitoring.
@varve/statcan-rdaas
Statistics Canada Reference Data as a Service — classifications, concordances, and index lookups.
@varve/ons-api
UK Office for National Statistics API — timeseries, datasets, observations, and filtered exports.
@varve/eurostat-api
Eurostat APIs — dataflows, JSON-stat data, SDMX CSV, and graph-friendly metadata.
@varve/worldbank-api
World Bank Indicators API — countries, indicators, sources, topics, and observations.
@varve/cmhc-api
CMHC Housing Market Information Portal — table exports, rental market data, and housing supply metrics.
Why these packages exist
The underlying APIs are well-documented in places but inconsistent in practice. Response shapes differ from the official specs, some fields are undocumented, and error codes are reused for unrelated conditions. These packages encode that real-world behaviour into their Zod schemas so you don't have to discover it yourself.
Key properties shared across the clients:
- Runtime validation — every response is parsed by a Zod schema. If the API changes its shape, you find out immediately with a clear parse error rather than a silent
undefineddeep in your application. - Automatic retry — network errors and transient server errors (409, 429, 500) are retried with exponential backoff. StatCan's WDS API routinely returns 409 when a table is being updated; this is handled transparently.
- Zero runtime dependencies beyond Zod — no fetch polyfills, no Node.js-specific modules. Zod is a required peer dependency so you can share schemas with your own application code.
Installation
Each package is independent — install only what you need:
Install multiple packages together:
A note on the APIs
These SDKs are built against production endpoints and reflect observed API behaviour rather than documentation. The READMEs for each package document known discrepancies between the official specs and what the APIs actually return.