halcyonstats
Download statistics and device leaderboard for Halcyon
- Astro
- TailwindCSS
- TypeScript
- Year
- 2026
- Category
- Web Applications
- License
- MIT
- Live Site
- halcyonstats.pages.dev ↗
- Repository
- github.com/neroices/hlcynstats ↗
README.md
Download statistics dashboard and API for the Halcyon Project. Built with Astro SSR, Tailwind CSS v4, and hosted on Cloudflare Pages.
Features
- Search & Filtering: Real-time client-side search across both device marketing names and codenames.
- Dynamic Theming: Material You expressive tonal palette with interactive hue slider and dark/light mode toggle.
- Resilient Caching: Multi-tier caching with Cloudflare KV, in-memory cache, live API fallback, and static snapshot fallback.
How it works
- Scheduled Worker (
worker/): Runs daily on a cron trigger (0 0 * * *). It pulls downloads and build stats fromget.hlcyn.org, caches the payload in Cloudflare KV, and commitssrc/data/downloads.jsonto the repo via the GitHub API. - SSR Website (
src/): Renders on Cloudflare Pages. On each request, it serves fresh data from the live API (with a 5-minute in-memory isolate cache to prevent rate-limiting). If the live API is unreachable or times out, it automatically falls back to Cloudflare KV, Edge Cache, and the bundleddownloads.jsonsnapshot.
Development
# install dependencies
pnpm install
# run dev server
pnpm dev
# build for production (outputs to out/)
pnpm build
# preview the pages build locally
pnpm preview
Deployment
Website (Cloudflare Pages)
pnpm run deploy
This runs pnpm build, ensures the Cloudflare Pages project exists, and deploys out/.
Backup Worker (Cloudflare Worker)
The worker in worker/ handles the automated daily sync and backup.
Create the KV namespace:
pnpm exec wrangler kv namespace create DOWNLOADS_BACKUPPut the returned ID in
worker/wrangler.json.Bind KV to Pages: In Cloudflare Dashboard under your Pages project: Settings > Functions > KV namespace bindings, add
DOWNLOADS_BACKUP.Set GitHub Token (optional, for auto-commit):
pnpm exec wrangler secret put GITHUB_TOKEN --config worker/wrangler.jsonDeploy worker:
pnpm run deploy:worker
You can trigger a manual sync anytime by pinging https://<worker-subdomain>.workers.dev/sync.
APIs
GET /api/stats.json— Summary stats (grand total, builds count, device count, top device).GET /api/downloads.json— Full breakdown of all devices, download counts, and official build counts.