A Cloudflare Worker that fetches and displays the DBMF (Dynamic Beta-Managed Futures Strategy Fund) holdings data from an Excel file as a beautiful, responsive HTML table.
- 📥 Automatically fetches the latest DBMF holdings Excel file
- 📊 Converts Excel data to a clean, responsive HTML table
- 🎨 Modern, gradient-styled UI with mobile support
- ⚡ Fast edge-side rendering via Cloudflare Workers
- 💾 5-minute cache for optimal performance
- Node.js (v16 or later)
- npm or yarn
- A Cloudflare account
- Wrangler CLI
-
Clone this repository and navigate to the project directory:
cd dbmfview -
Install dependencies:
npm install
-
Authenticate with Cloudflare (if you haven't already):
npx wrangler login
To run the worker locally for development:
npm run devThis will start a local server (usually at http://localhost:8787) where you can test the worker.
Deploy the worker to Cloudflare:
npm run deployAfter deployment, Wrangler will provide you with a URL where your worker is accessible (e.g., https://dbmfview.your-subdomain.workers.dev).
If you want to use a custom domain or route, edit wrangler.toml:
routes = [
{ pattern = "example.com/dbmf", zone_name = "example.com" }
]If the source URL changes, update the EXCEL_URL constant in src/index.js:
const EXCEL_URL = 'https://imgpfunds.com/wp-content/uploads/pdfs/holdings/DBMF-Holdings.xlsx';To change how long the data is cached, modify the Cache-Control header in src/index.js:
'Cache-Control': 'public, max-age=300', // 300 seconds = 5 minutesdbmfview/
├── src/
│ └── index.js # Main worker script
├── package.json # Dependencies and scripts
├── wrangler.toml # Cloudflare Worker configuration
└── README.md # This file
- The worker receives an HTTP request
- It fetches the Excel file from the specified URL
- The
xlsxlibrary parses the Excel data - The data is converted to an HTML table
- A styled HTML page is generated and returned to the browser
- The response is cached for 5 minutes to reduce load on the source server
- xlsx (^0.18.5): Library for parsing and writing Excel files
- wrangler (^3.0.0): Cloudflare Workers CLI tool (dev dependency)
- Verify the URL is accessible:
curl -I https://imgpfunds.com/wp-content/uploads/pdfs/holdings/DBMF-Holdings.xlsx - Check if the source server is blocking Cloudflare Workers
- Review worker logs:
npx wrangler tail
- Ensure the file format is valid (.xlsx)
- Check if the file structure has changed
- Look for error messages in the browser or worker logs
- Make sure you're authenticated:
npx wrangler whoami - Check your Cloudflare account has Workers enabled
- Verify your
wrangler.tomlconfiguration is correct
MIT
Data is sourced from: DBMF Holdings Excel File