A Rust-backed EPUB reader core with TypeScript package bindings.
Rito is an EPUB-focused reader engine. It opens EPUB archives, resolves a book-oriented CSS subset, creates layout revisions, builds paint-ready frames, and renders pages or spreads through the browser package facade.
The repository also includes:
@ritojs/core— the Rust-backed core reader package@ritojs/kit— a framework-agnostic controller layer with transitions and overlays@ritojs/react— React hooks and components on top of the core packages
pnpm add @ritojs/coreimport { createReader } from '@ritojs/core';
const response = await fetch('book.epub');
const canvas = document.querySelector('canvas')!;
// The engine shapes text with pinned font bytes (no system font is
// reachable inside the WASM runtime) — a pinnedFontPolicy is required.
// See docs/getting-started.md for a complete loader.
const reader = await createReader(await response.arrayBuffer(), canvas, {
width: 800,
height: 600,
margin: 40,
spread: 'double',
pinnedFontPolicy: await loadPinnedFontPolicy(),
});
reader.renderSpread(0);
console.log(`${reader.totalSpreads} spreads, ${reader.toc.length} TOC entries`);
reader.dispose();- Documentation Index
- Getting Started
- Reader API
- Reference Primitives
- Advanced Entry
- Specialized Subpaths
- Capabilities
- Limitations
- Using
@ritojs/kit - Using
@ritojs/react - Development Docs
Rito is optimized for EPUB book layout, not browser-equivalent web layout.
- EPUB-first rendering model
- small, stable reader API on the main
@ritojs/coreentry - source-only TypeScript reference implementation for golden and parity work
- optional higher-level integration packages for controllers and React
- deliberate CSS/layout subset focused on book pagination
See the detailed scope in Capabilities and Limitations.
pnpm install
pnpm run check