How linxiv-dev/linxiv works
1. Overall shape
- linXiv is a local-first research manager built around a shared Python core.
- It is delivered in three main runtime forms: a Tauri desktop app (React frontend + Rust shell + Python sidecars), a standalone HTTP API (FastAPI), and command-line / MCP interfaces that reuse the same backend logic.
2. Primary user-facing frontend
- The src/ tree is the interactive desktop UI: React + TypeScript, built with Vite.
- Pages are organized by domain: papers, projects, tags, notes, search, graph, settings, and previews.
- UI state is split between local stores (src/stores) and server-backed queries through the typed API client in src/api.
3. Backend API boundary
- The api/ package is the HTTP boundary for the app.
- It exposes JSON endpoints and also serves the bundled graph frontend under public/graph, which is used for the paper-author visualization.
- This is the boundary the desktop UI talks to in development, and it is also what the CLI/MCP layers ultimately rely on indirectly through shared service code.
4. Core domain/service layer
- The service/ package is the main application boundary between API/UI and persistence.
- It is split by domain: papers, authors, tags, projects, notes, content, and files.
- These services shape data into typed models (service/models) and implement higher-level behavior such as paper details, project-scoped notes, graph data assembly, and export/import orchestration.
5. Persistence layer
- The storage/ package owns SQLite access, schema management, and query construction.
- It contains the canonical database schema, migrations, versioning, and SQL views/indexes.
- Important stored concepts include papers, paper versions, authors, tags, projects, notes, search history, search state, and full-text search.
- A composable query object (Q) is used for filtering, especially in project queries.
6. File and path management
- Local files are first-class: PDFs, TeX sources, vault notes, and database files are all managed on disk.
- storage/paths.py and service/files.py centralize filesystem layout and file resolution.
- This is part of the local-first design: metadata lives in SQLite, while binary assets and generated notes live in local directories.
7. Metadata acquisition and document ingestion
- The sources/ package handles all external paper discovery and enrichment.
- It talks to arXiv, Crossref, OpenAlex, DOI resolution services, and PDF metadata extraction.
- The ingestion flow is: search or resolve an identifier, fetch metadata, optionally download PDF/TeX, then persist through the service/storage layers.
- sources/fetch_paper_metadata.py is the orchestration point for that pipeline.
8. Graph visualization subsystem
- The graph feature is a dedicated frontend bundle in public/graph using D3/Cytoscape layout helpers.
- It renders a paper-author network, fed from backend graph data queries.
- The repo also documents a postMessage protocol for iframe communication, so the graph viewer is intentionally treated as a separate embedded subsystem rather than a normal page.
9. Optional AI and integrations
- AI_tools.py wraps Gemini-based features for tagging, summarization, and semantic similarity.
- Obsidian integration is supported through markdown/frontmatter templates in formats/.
- These are optional augmentation paths: they consume paper content from abstract/full text/PDF and write results back into local files or tags, rather than becoming a separate service.
10. Desktop packaging and sidecars
- src-tauri/ is the desktop shell that bundles the web frontend and ships Python backend executables as sidecars.
- The Python API, CLI, and MCP server are built from separate PyInstaller specs and staged into Tauri’s binary directory.
- In production, the desktop app depends on these bundled binaries; in development, the UI talks to a locally running API on port 8000.
11. External interfaces
- The repository exposes the same core capability through multiple entry points:
- GUI for interactive management
- HTTP API for programmatic access
- CLI for scripting and automation
- MCP server for Claude integration
- All of them converge on the same underlying service/storage logic, which is the main architectural invariant.
12. Schema evolution and operational concerns
- The database schema is actively evolving, with migrations tracked under storage/migrations and architecture notes in docs/adr.
- The repo treats identifier normalization and storage compatibility as a first-class concern, which is why paper identity, versioning, and search persistence are modeled explicitly in the database.
- CI and tests cover API, DB, sources, export/import, and CLI behavior, reflecting the repo’s emphasis on keeping the backend contract stable across multiple frontends.
Main entry points: service Services · src-tauri Tauri shell · fetch_paper_metadata.py Fetch metadata · api HTTP API
Components 19
Desktop app
Tauri shell and React UI for interactive local-first use
- UI · Desktop user interface and page-level workflows
src - API client · Frontend request layer for server-backed data
src/api - UI state · Local selection, theme, and import job state
src/stores
Backend stack
HTTP API, shared services, and persistence
- HTTP API · JSON endpoints and embedded graph asset hosting
api - Services · Application boundary for papers, authors, tags, projects, notes, and files
service - Models · Shared response and domain shapes used across the service boundary
service/models - Storage · Database access, schema management, and query construction
storage - Schema · Canonical database tables, views, and migration history
storage/config/sql - Queries · Composable filtering and query helpers such as project query objects
storage/config/queries.py - Files · Local filesystem layout for PDFs, notes, and database assets
storage/paths.py
Ingestion
External metadata discovery and document enrichment
- Sources · Discovery, identifier resolution, metadata enrichment, and PDF/TeX retrieval
sources - Fetch metadata · Coordinates search, resolve, download, and persist steps
sources/fetch_paper_metadata.py - Providers · External discovery and metadata services
sources
Delivery
Packaging, sidecars, and external integration surfaces
- Tauri shell · Bundles the web app and launches backend sidecars
src-tauri - Graph view · Dedicated paper-author network bundle served separately under public/graph
public/graph - AI tools · Optional tagging, summarization, and similarity augmentation
AI_tools.py - Formats · Markdown, BibTeX, JSON, CSV, and Obsidian-oriented formatting
formats - CLI · Scriptable interface reusing the shared backend logic
linxiv_cli.py - MCP server · Claude integration surface backed by the shared application core
linxiv_mcp.py
Connections 23
- UI → API client: requests · UI pages call typed endpoints for papers, projects, search, notes, and settings
- UI → UI state: uses · Frontend components coordinate selection, theme, and import state
- API client → HTTP API: calls · Development and desktop flows reach the HTTP boundary through the client
- Tauri shell → UI: hosts · Tauri embeds the built React application
- Tauri shell → HTTP API: bundles · Desktop app launches or ships the Python API sidecar
- HTTP API → Services: delegates · API routes forward application logic to the service layer
- Services → Models: returns · Services shape data into shared typed models
- Services → Storage: reads/writes · Domain operations persist through SQLite storage
- Storage → Schema: uses · Storage code is backed by canonical tables, views, and migrations
- Storage → Queries: filters · Query objects drive composable filtering and search behavior
- Services → Files: resolves · Services centralize local file and path handling
- Sources → Fetch metadata: orchestrates · The ingestion package centers around metadata fetching coordination
- Fetch metadata → Providers: queries · Metadata orchestration contacts arXiv, Crossref, OpenAlex, and DOI resolvers
- Fetch metadata → Services: persists · Fetched metadata is normalized and stored through the shared services
- Fetch metadata → Files: downloads · PDF and TeX assets are written to local paths
- HTTP API → Graph view: serves · API hosts the bundled graph visualization assets
- Graph view → Services: consumes · Graph rendering is fed from backend graph data queries
- AI tools → Services: augments · Optional AI features read content and write tags or summaries back through services
- Formats → Services: exports · Formatting modules serialize domain data for interop and notes
- CLI → Services: uses · CLI commands reuse the shared domain services
- MCP server → Services: uses · MCP requests are mapped onto the same backend logic
- Tauri shell → CLI: ships · Desktop packaging stages the CLI binary as a sidecar
- Tauri shell → MCP server: ships · Desktop packaging stages the MCP server as a sidecar