A Cloudflare Worker that fetches, processes, and caches consumer price data from the Bureau of Labor Statistics (BLS) API.
POG-Cache automatically pulls price information for various consumer goods across different US regions on a daily schedule. The data is stored in Cloudflare R2 storage for fast retrieval and visualization.
- Fetches price data for multiple categories (meats, dairy, produce, energy)
- Processes data for all US regions (national, northeast, midwest, south, west)
- Runs on a daily schedule via Cloudflare Workers
- Supports manual updates via authenticated API endpoint
- Stores processed data in Cloudflare R2 buckets
- Node.js (LTS version recommended)
- Yarn package manager
- Cloudflare account with Workers and R2 access
- BLS API key (register at https://www.bls.gov/developers/)
- Clone the repository
- Install dependencies:
yarn install - Configure environment variables in your Cloudflare dashboard:
BLS_API_KEY- Your BLS API keyUPDATE_TOKEN- Secret token for triggering manual updates
- Start local development server:
npm run dev - Run tests:
yarn test - Deploy to Cloudflare:
npm deploy
The worker processes goods defined in src/goods.json, organized by category (meats, dairy, produce, energy). Each item includes:
- Name and display information
- Units of measurement
- BLS series IDs for each region
- Visual styling properties
POST /update- Trigger a manual data update (requires Authorization header with bearer token)