mirror of
https://github.com/purrgrammer/grimoire.git
synced 2026-04-16 10:27:11 +02:00
866202ad45f313f5b6d40fba7aabc731f653a897
Replaces inefficient toArray() + reduce patterns with direct Dexie iteration APIs for better memory efficiency and performance.
**Optimizations:**
1. **Supporter Count** - Use `uniqueKeys()` instead of loading all records
- Before: Load all → create Set → get size
- After: `orderBy('senderPubkey').uniqueKeys().length`
- ~90% memory reduction for large datasets
2. **Aggregation Queries** - Use `.each()` iterator pattern
- `getTotalDonationsAsync()` - Stream records, accumulate sum
- `getMonthlyDonationsAsync()` - Indexed query + iteration
- `getCurrentMonthDonations()` - Indexed query + iteration
- `getSupporterInfo()` - Per-pubkey indexed query with iteration
- `getAllSupporters()` - Stream all, group in Map, sort
3. **Cache Refresh** - Optimized `refreshSupporters()`
- uniqueKeys for supporter set
- Direct iteration for total/monthly sums
- Single indexed query for monthly window
**Monthly Goal:**
- Update from 210M sats to 210k sats (0.0021 BTC)
- More achievable target for initial launch
**Benefits:**
- Lower memory usage (no intermediate arrays)
- Faster queries (direct iteration vs map/reduce)
- Better scalability with growing zap history
- Leverages Dexie's indexed cursors for efficiency
…
Grimoire
A Nostr protocol explorer and developer tool with a tiling window manager interface.
Features
- Tiling Windows - Each window is a Nostr "app" (profile viewer, event feed, NIP docs, etc.)
- Command Palette - Unix-style commands via
Cmd+Kto open apps and navigate - Multi-workspace - Virtual desktops with independent layouts
- Real-time - Reactive event subscriptions with automatic updates
Stack
React 19, TypeScript, Vite, TailwindCSS, Jotai, Dexie, Applesauce
Getting Started
npm install
npm run dev
Scripts
| Command | Description |
|---|---|
npm run dev |
Start dev server |
npm run build |
Build for production |
npm test |
Run tests in watch mode |
npm run lint |
Lint code |
npm run format |
Format code |
License
MIT
Languages
TypeScript
98.9%
CSS
0.8%
JavaScript
0.3%