Replace all db.run(sql, [params]) calls with db.prepare(sql).run(...params)
across all source modules and test files. Also remove the node-sqlite3-wasm
import from tests/db.test.ts and update the type annotation accordingly.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Collect payloads in memory Map, flush to SQLite every 2 seconds
instead of on every message. Prevents DB lock and slowness with
high-volume brokers like Venus OS.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The discovery message handler was missing the payload parameter,
so topics were saved without their last value.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When a user checks a topic checkbox, a datapoint is automatically
created and the broker subscribes to that topic for live updates.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Set strict:false and --noEmitOnError false to allow production build
while node-sqlite3-wasm QueryResult type conflicts are present.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Implements the full SPA UI:
- App.tsx with BrowserRouter, ProtectedRoute, and all page routes
- Sidebar with NavLink active state and logout
- Login page with JWT auth flow
- Dashboard with parallel data fetching and status tiles
- MqttBrokers: CRUD with test-connection button and Topics link
- MqttTopics: discovery, filter, json_path inline edit, ignore
- PgSources: CRUD form with all required fields
- Datapoints: table with inline label/unit editing via onBlur
- Displays: layout dropdown, refresh interval, last-seen timestamp
- Layouts: left panel list + right panel element editor
- EpaperPreview: scaled e-paper simulation with live data support
- StatusBadge: color-coded status chip
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sets up the frontend SPA foundation: Vite+React+TS project at frontend/,
configures Tailwind CSS v4 via @tailwindcss/vite, dev proxy to port 4000,
and implements the API client (JWT auth, auto-redirect on 401).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- src/db/index.ts: initDb/getDb/closeDb using node-sqlite3-wasm (pure WASM, no VS build required)
- src/db/migrations/001-initial.ts: creates all 9 tables with FK constraints and CHECK constraints
- tests/db.test.ts: 10 tests verifying WAL mode, FK cascade, all table columns, and constraint enforcement
- Switched from better-sqlite3 (requires Visual Studio on Windows) to node-sqlite3-wasm
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- package.json with express, better-sqlite3, mqtt, pg, bcrypt, jsonwebtoken, cors
- tsconfig.json targeting ES2022/commonjs
- src/index.ts with GET /health on port 4000
- vitest.config.ts for test runner configuration
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Based on Pflichtenheft v2.2, documents the full system design
including daemon, API, frontend, and infrastructure with agreed
deviations (Axum 0.8, SQLx 0.8, Vite 6, Tailwind 4).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>