Article Image

MOCNovel: Decentralized and Sovereign Publishing for Authors

June 1, 2026

Re-Imagining Digital Literature

The traditional publishing ecosystem is broken. Distribution platforms take massive cuts, enforce draconian digital rights management (DRM), and dictate content policies. Authors are left dependent, and readers lose actual ownership of the books they buy.

MOCNovel restores digital sovereignty. Built on local-first principles, it acts as a private bookshelf and a robust self-publishing portal.

Digital literature should be just as permanent and private as a physical book on a shelf. We don't believe in expiring licenses or platform lock-in.
RebelRoot Publishing Working Group

Technical Architecture: Local-First Parsing Engine

EPUB files are essentially zipped archives containing HTML files, CSS sheets, and XML metadata files. Most reading applications rely on remote cloud renderers or server-side parser daemons to display book chapters. This architecture centralizes reading history and metadata.

MOCNovel is built to decompress and parse books entirely on the client-side. We utilize browser-native ZIP decompression (via WebAssembly-backed compression libraries) and native DOMParsers to extract XML paths dynamically.

Decrypting and Parsing EPUB Packages

When a user imports an ebook into MOCNovel, the engine performs the following processing pipeline in the browser:

  1. Locate the Package Entry Document: Read META-INF/container.xml to find the path to the .opf package file.
  2. Extract Metadata & Manifest: Parse the .opf file to discover book details (title, author, rights) and index the locations of all HTML chapters.
  3. Resolve Spine Order: Sequence the HTML pages according to the spine declaration so the reader can scroll sequentially.

Here is how the parsing engine resolves the package path without sending the file to any server:

// Client-side extraction of EPUB manifest OPF path using native DOMParser
async function getOPFFilePath(zipArchive) {
// Read container.xml from the zipped package
const containerFile = await zipArchive.file("META-INF/container.xml").async("string");
const parser = new DOMParser();
const xmlDoc = parser.parseFromString(containerFile, "text/xml");
// Find the rootfile element containing the full-path attribute
const rootfile = xmlDoc.getElementsByTagName("rootfile")[0];
if (!rootfile) {
throw new Error("Malformed EPUB container: OPF file path not found");
}
const opfPath = rootfile.getAttribute("full-path");
return opfPath; // Returns e.g. 'OEBPS/content.opf'
}

Offline Annotation & Progress Synchronization

MOCNovel uses an offline-first database (using IndexedDB wrappers or native SQLite bindings) to cache reading positions, bookmark offsets, and custom page highlights.

The database structure maps annotations using standard EPUB canonical fragment identifiers (EpubCFI) rather than character offsets. This ensures annotations remain perfectly aligned even if the user resizes text dimensions or changes page styling:

CREATE TABLE annotations (
  id TEXT PRIMARY KEY,
  book_hash TEXT NOT NULL,
  cfi_range TEXT NOT NULL,
  highlight_color TEXT,
  note_content TEXT,
  created_at INTEGER NOT NULL,
  FOREIGN KEY(book_hash) REFERENCES books(hash)
);

By storing bookmarks local-first, readers retain absolute custody over their reading notes and habits, with optional peer-to-peer sync options using end-to-end encrypted tunnels.

Join the RebelRoot Community. Let's Build Better Software Together.