How orangecoding/nanosearch works
nanosearch is a local-directory full-text search web app. Users create or update an index, which scans configured directories, detects additions, edits, moves and removals, extracts document text (including OCR where needed), and stores searchable content; they then search and view results in the browser. The graph includes search, indexing, progress, and document viewing capabilities documented by the README. Several route and viewer implementation details were not excerpted, so uncertain connections are omitted or marked unverified.
Main entry points: App.jsx Search application · pipeline.js Indexing pipeline · server.js Fastify server · queries.js Database operations
Components 23
Browser interface
- Search application
lib/frontend/src/App.jsx - Search controls
lib/frontend/src/components/SearchBox.jsx - Query builder
lib/frontend/src/components/QueryBuilder.jsx - Search results
lib/frontend/src/components/ResultList.jsx - Document viewer
lib/frontend/src/components/DocumentViewer.jsx - Index progress UI
lib/frontend/src/components/ProgressOverlay.jsx - Search requests
lib/frontend/src/hooks/useSearch.js - Progress events
lib/frontend/src/hooks/useSSE.js
HTTP API
- Fastify server
lib/backend/src/server.js - Search endpoint
lib/backend/src/routes/search.js - Index endpoint
lib/backend/src/routes/index.js - Progress endpoint
lib/backend/src/routes/progress.js - File endpoint
lib/backend/src/routes/file.js
Indexing pipeline
- Directory scanner
lib/backend/src/indexer/scanner.js - Change detection
lib/backend/src/indexer/diff.js - Text extraction
lib/backend/src/indexer/extractor.js - Format extractors
lib/backend/src/indexer/extractors - OCR backends
lib/backend/src/indexer/ocr - Indexing pipeline
lib/backend/src/indexer/pipeline.js - Rescan scheduler
lib/backend/src/indexer/scheduler.js
Search storage
- SQLite FTS index
lib/backend/src/db/schema.js - Database operations
lib/backend/src/db/queries.js
Other components
- Local user
Connections 27
- Local user → Search application: searches and manages
- Search application → Search controls: renders
lib/frontend/src/App.jsx - Search application → Search results: renders
lib/frontend/src/App.jsx - Search application → Query builder: offers advanced queries
lib/frontend/src/App.jsx - Search application → Index progress UI: shows progress
lib/frontend/src/App.jsx - Search application → Search requests: uses
lib/frontend/src/App.jsx - Search application → Progress events: uses
lib/frontend/src/App.jsx - Search results → Document viewer: opens documents
- Search requests → Search endpoint: requests search
lib/frontend/src/hooks/useSearch.js - Progress events → Progress endpoint: subscribes to events
lib/frontend/src/hooks/useSSE.js - Fastify server → Search endpoint: registers
lib/backend/src/server.js - Fastify server → Index endpoint: registers
lib/backend/src/server.js - Fastify server → Progress endpoint: registers
lib/backend/src/server.js - Fastify server → File endpoint: registers
lib/backend/src/server.js - Fastify server → SQLite FTS index: creates
lib/backend/src/server.js - Search endpoint → Database operations: searches through
lib/backend/src/routes/search.js - Index endpoint → Indexing pipeline: starts indexing
- Progress endpoint → Indexing pipeline: streams indexing updates
- File endpoint → Database operations: reads indexed file data
lib/backend/src/routes/file.js - Indexing pipeline → Database operations: reads and updates metadata
lib/backend/src/indexer/pipeline.js - Indexing pipeline → Directory scanner: scans directories
lib/backend/src/indexer/pipeline.js - Indexing pipeline → Change detection: classifies changes
lib/backend/src/indexer/pipeline.js - Indexing pipeline → Text extraction: extracts changed files
lib/backend/src/indexer/pipeline.js - Text extraction → Format extractors: dispatches by format
lib/backend/src/indexer/extractor.js - Text extraction → OCR backends: uses for scanned files
- Rescan scheduler → Indexing pipeline: triggers rescans
lib/backend/src/indexer/scheduler.js - Database operations → SQLite FTS index: reads and writes
lib/backend/src/db/queries.js