notedeck

One damus client to rule them all
git clone git://jb55.com/notedeck
Log | Files | Refs | README | LICENSE

README.md (2561B)


      1 # Notedeck Dashboard
      2 
      3 A minimal, real-time dashboard for **Notedeck**, built with **egui** and backed by **nostrdb**.
      4 
      5 This app renders live statistics from a Nostr database without blocking the UI, using a single long-lived worker thread and progressive snapshots. No loading screens, no spinners—data fades in as it’s computed.
      6 
      7 ## What it does (today)
      8 
      9 * Counts **total notes** in the database
     10 * Shows **top N event kinds** as a horizontal bar chart
     11 * Refreshes automatically on a fixed interval
     12 * Streams intermediate results to the UI while scanning
     13 * Keeps previous values visible during refreshes
     14 
     15 ## Architecture overview
     16 
     17 ### UI thread
     18 
     19 * Pure egui rendering
     20 * Never blocks on database work
     21 * Reacts to snapshots pushed from the worker
     22 * Requests repaints only when new data arrives
     23 
     24 ### Worker thread
     25 
     26 * Single persistent thread
     27 * Runs one scan per refresh
     28 * Emits periodic snapshots (~30ms cadence)
     29 * Uses a single `nostrdb::Transaction` per run
     30 * Communicates via `crossbeam_channel`
     31 
     32 ### Data flow
     33 
     34 ```
     35 UI ── Refresh cmd ──▶ Worker
     36 UI ◀─ Snapshot msgs ◀─ Worker
     37 UI ◀─ Finished msg  ◀─ Worker
     38 ```
     39 
     40 ## Code layout
     41 
     42 ```
     43 src/
     44 ├── lib.rs      # App entry, worker orchestration, refresh logic
     45 ├── ui.rs       # egui cards, charts, and status UI
     46 └── chart.rs    # Reusable horizontal bar chart widget
     47 ```
     48 
     49 ### `chart.rs`
     50 
     51 * Custom horizontal bar chart
     52 * Value labels, hover tooltips, and color palette
     53 * Designed to be generic and reusable
     54 
     55 ### `lib.rs`
     56 
     57 * Implements `notedeck::App`
     58 * Owns worker lifecycle and refresh policy
     59 * Handles snapshot merging and UI state
     60 
     61 ### `ui.rs`
     62 
     63 * Card-based layout
     64 * Totals view + kinds bar chart
     65 * Footer status showing freshness and timing
     66 
     67 ## Design goals
     68 
     69 * **Zero UI stalls**
     70   Database scans never block rendering.
     71 
     72 * **Progressive feedback**
     73   Partial results are better than spinners.
     74 
     75 * **Simple concurrency**
     76   One worker, one job at a time, explicit messaging.
     77 
     78 * **Low ceremony**
     79   No async runtime, no task pools, no state machines.
     80 
     81 ## Non-goals (for now)
     82 
     83 * Multiple workers
     84 * Historical comparisons
     85 * Persistence of dashboard state
     86 * Configuration UI
     87 * Fancy animations
     88 
     89 ## Requirements
     90 
     91 * Rust (stable)
     92 * `egui`
     93 * `notedeck`
     94 * `nostrdb`
     95 * `crossbeam-channel`
     96 
     97 This crate is intended to be built and run as part of a Notedeck environment.
     98 
     99 ## Status
    100 
    101 Early but functional.
    102 The core threading, snapshotting, and rendering model is in place and intentionally conservative. Future changes should preserve the “always responsive” property above all else.