feat: Add shadcn worker UI

This commit is contained in:
Janez T
2026-04-03 19:46:51 +02:00
parent 724f4b38e8
commit 7c1bc3b84f
21 changed files with 3709 additions and 2 deletions

28
worker/README.md Normal file
View File

@@ -0,0 +1,28 @@
# MeshCore SAR RX Stats Worker
This worker follows the same split as `/Users/dz0ny/site-vendorvigilance`:
- Astro builds the dashboard UI into `dist`
- a small Cloudflare Worker handles `/api/*` before assets are served
## Layout
- `src/pages/index.astro` - dashboard shell
- `worker/index.ts` - Cloudflare Worker entrypoint
- `worker/stats.ts` - D1 queries, payload validation, and aggregation helpers
- `schema.sql` - D1 schema
## Setup
1. Install dependencies with `bun install`.
2. Create a D1 database with `bunx wrangler d1 create meshcore_sar_rx_stats`.
3. Apply the schema with `bunx wrangler d1 execute meshcore_sar_rx_stats --remote --file=./schema.sql`.
4. Add the real D1 binding id to `wrangler.toml` when deploying.
5. Build the dashboard with `bun run build`.
6. Run checks with `bun run check`, `bun run test`, and `bun run typecheck`.
## Routes
- `GET /` - static Astro dashboard
- `GET /api/dashboard?window=24h|7d|30d` - aggregated dashboard JSON
- `POST /api/ingest` - anonymous RX stats ingest