ae9e806e6188a51eae39580120e18846c16cc958
Monitors all registered folders using OS-native events (ReadDirectoryChangesW on Windows) so new, modified, and deleted files are reflected in the gallery automatically without manual reindexing. Key design points: - Adaptive blocking: recv() when no events pending (zero CPU), switches to recv_timeout(earliest_deadline) only when debounce timers are running — wakes exactly when the soonest event is ready, no busy-polling - 500 ms per-path debounce coalesces rapid OS event bursts into one action - Change detection preserved: build_record skips upsert if file_size + mtime unchanged, preventing spurious thumbnail/embedding re-queues and avoiding clobbering of existing metadata like thumbnail_path - Access events (reads) filtered out; only Create/Modify/Remove trigger work - Deletion path: emits watcher-deleted event with image IDs; frontend removes those images from state and clears selectedImage if it was deleted WatcherHandle stored in app state; add_folder / remove_folder / update_folder_path commands keep the watched path set in sync with the DB.
Phokus
A local-first desktop media library for browsing, filtering, and curating image and video folders.
Features
- Add and remove media folders; background indexing with live progress
- Browse all media or filter by folder, type (image/video), favorites, or star rating
- Filename search, semantic search (
/s query), and tag search (/t tag) - Similar image search — find visually similar media by image or selected region
- AI tagging via WD tagger (ONNX, CPU/DirectML) with confidence threshold control
- Explore view — visual cluster map and tag cloud for browsing by theme
- Duplicate finder — scan for exact duplicates by file hash with bulk delete
- Lightbox preview with keyboard navigation, inline tag editing, and rating controls
- Sort by date, name, size, rating, or duration
- Grid density controls (compact / comfortable / detail)
Supported formats
| Images | Videos |
|---|---|
| jpg, jpeg, png, gif, bmp | mp4, mov, m4v |
| tiff, tif, webp, avif, heic, heif | webm |
Stack
- Tauri 2 + Rust backend
- React 19 + TypeScript + Zustand
- SQLite +
sqlite-vec(vector search) - ONNX Runtime (
ort) for AI tagging - Candle (Rust ML) for visual embeddings
- FFmpeg sidecar for video thumbnails and metadata
- Vite + Tailwind CSS v4
Development
Prerequisites: Node.js 20+, pnpm, Rust toolchain, Tauri system prerequisites for Windows.
pnpm install
# Run with hot-reload (frontend + Rust)
pnpm dev:app
# Frontend only
pnpm dev:vite
# Production build
pnpm build:app
How it works
- Add a folder from the sidebar — the Rust indexer walks it recursively.
- Supported files are written to SQLite with metadata (path, dimensions, media type, etc.).
- Background workers generate thumbnails, compute visual embeddings, and run AI tagging.
- Progress events stream back to the UI while the gallery updates incrementally.
- Embeddings power semantic search and the similar images feature via an HNSW index.
Languages
TypeScript
60.4%
Rust
37.5%
CSS
1.3%
Shell
0.4%
JavaScript
0.2%
Other
0.2%