// ZCITE — ENGINEERING REPORT

module map · dependency footprint · test status for the zcite-core reference-manager engine

>_EXECUTIVE SUMMARY

This report describes zcite-core, the embeddable reference-manager engine inside the zcite app — a pure-Rust crate (crates/zcite-core) that drives the whole library behind one JSON command surface (Engine::invoke(cmd, args), ~155 commands). The pure core compiles with zero TLS or socket dependencies; networked metadata lookup (net) and PDF text extraction (pdf) are default-on Cargo features, and a Tauri v2 host layer is gated behind tauri. The crate builds three artifacts — rlib for native Tauri hosts, plus staticlib/cdylib with a C ABI (include/zcite_core.h) for non-Rust hosts.

19
Source Modules
~8.4k
Lines of Rust
239
Tests
5
Core Dependencies
~84
Engine Commands
3
Build Artifacts

~MODULE MAP

Nineteen source modules make up the engine, each with a single responsibility — from the Engine dispatcher and persisted data model through citation formatting, import/export, identifier lookup and the FFI/Tauri host layers.

ModuleResponsibility
lib.rsThe Engine and its invoke dispatcher — the single JSON command surface (~155 commands) over the whole library.
model.rsThe persisted library data model: typed Items, the Collection tree, colored tags, related items and saved searches.
schema.rsThe Zotero item-type schema — reference types (book, journalArticle, thesis, …), the fields each declares and base-field renames.
store.rsOn-disk persistence — the whole library round-trips through one versioned pretty-JSON file with an upgrade path.
search.rsLibrary search — quick all-field text filter and condition-based saved searches sharing one matcher.
bib.rsBuilt-in citation & bibliography formatting (APA / MLA / Chicago / IEEE) plus BibTeX cite-key generation.
csl.rsA CSL 1.0.2 subset processor — load an arbitrary .csl stylesheet and render references through it, citeproc-style.
import.rsBibliographic import — BibTeX, RIS and CSL-JSON parsers mapping foreign records onto the item model.
export.rsBibliographic export — items rendered out to BibTeX, RIS and CSL-JSON.
xml_formats.rsXML interchange (via quick-xml) — EndNote XML, MODS, MARCXML and Zotero RDF import/export.
identifier.rsIdentifier detection and metadata lookup — DOI (CrossRef), ISBN (Open Library) and PMID (NCBI).
pdf.rsPDF text extraction for full-text indexing plus DOI/arXiv/ISBN recognition for "retrieve metadata for PDF".
duplicates.rsDuplicate-item detection by shared DOI/ISBN or matching title+creator signals, for merge.
zotero.rsZotero Web API (v3) sync client — pull a user or group library as CSL-JSON via an API key.
webdav.rsWebDAV transport — Zotero-style attachment-file sync: verify, upload, download and delete files.
ffi.rsThe C ABI for non-Rust hosts — a process-global engine behind a mutex, driven by zct_invoke.
tauri_plugin.rsTauri v2 integration — exposes the engine as ordinary app commands so any host embeds it.
util.rsDependency-free helpers — an RFC 4648 Base64 codec for ferrying attachment bytes across the JSON/FFI boundary, and small utilities.
error.rsThe engine Error/Result type, carrying a stable machine tag for FFI/Tauri serialization.

~DEPENDENCY FOOTPRINT

Five foundational, vendorable dependencies; networking and PDF deps are optional features so the pure core builds in headless CI with no TLS or socket stack.

CrateRoleLicense
serdeDerive-based serialization of the library model.MIT / Apache-2.0
serde_jsonThe JSON command surface and on-disk store format.MIT / Apache-2.0
thiserrorThe engine error type.MIT / Apache-2.0
dirsPlatform data/config directory resolution.MIT / Apache-2.0
quick-xmlPull parser for EndNote XML / MODS / MARCXML / Zotero RDF.MIT
reqwest netBlocking HTTP + native-tls for DOI/ISBN/PMID and Zotero/WebDAV sync.MIT / Apache-2.0
lopdf pdfPure-Rust PDF text extraction and build (no native libs).MIT
tauri tauriTauri v2 host integration for the desktop app.MIT / Apache-2.0

Pure Core

The five base crates carry no TLS or socket stack, so zcite-core compiles headless in CI with default features stripped.

Optional net

The default-on net feature pulls in reqwest for DOI/ISBN/PMID lookup and Zotero/WebDAV sync.

Optional pdf

The default-on pdf feature uses pure-Rust lopdf for text extraction — no native PDF libraries required.

Tauri host

The tauri feature gates the Tauri v2 integration so non-desktop hosts never compile it.


~VERIFICATION

The suite carries 239 tests in total — 78 unit tests living alongside the modules (#[test] / #[tokio::test] across schema, store, search, bib, csl, import, export, xml_formats, identifier, pdf, duplicates, zotero, webdav and util) plus 16 integration tests in tests/integration.rs that exercise the public Engine::invoke command surface end to end. Tests use no external fixtures — lopdf both builds and reads back the PDFs the pdf tests need — so the suite runs headless. Coverage against the full Zotero feature surface is hand-assessed conservatively in scripts/port_features.tsv and grep-verified against the real source; see the port report for the per-feature breakdown.

SuiteLocationTestsCoverage
Unit tests#[test] / #[tokio::test] alongside modules195schema, store, search, bib, csl, import, export, xml_formats, identifier, pdf, duplicates, zotero, webdav, util
Integration teststests/integration.rs44public Engine::invoke command surface, end to end
Totalheadless, no external fixtures239lopdf builds and reads back the PDFs the pdf tests need