Technical Documentation
Zineroo
A browser print shop for folded zines, booklets, brochures, accordions, and maps. One canvas renderer drives the editor, the imposed sheet, and the printable file on desktop, iPad, and phone, with end-to-end encrypted cloud projects and a classroom edition schools license for their students
Live at zineroo.com · Since June 2026: about 1,200 commits · 300+ merged pull requests · 95 database migrations · a test suite nearly as large as the application code
The Idea
Zineroo turns a handful of images into a printable folded object. Pick one of seven physical formats, fill the pages, add text, shapes, and icons, check the imposed sheet, and print. Editing is local-first: work autosaves to IndexedDB in the browser, and cloud storage is opt-in. Free covers the core loop. Plus adds encrypted cloud projects, premium formats and paper sizes, landscape pages, the archive Library, design elements, and editor skins. Pro adds the print-shop PDF. Schools license Classrooms, a separate workspace for students and staff.
Make the folded sheet the source of truth.
Features
Formats and sheets
- Seven formats: 8-page Foldy Zine and its square variant, two-sided 16-page Foldy, 14-page Accordion, Saddle Stitch Booklet (4 to 100 pages), Trifold Brochure, and Unigrid folded map
- Page Preview flips through the finished zine page by page and spread by spread, the way a reader holds it
- Full Sheet shows the exact imposed sheet, cell map, artwork rotation, and side order before anything prints
- Portrait or landscape pages change face geometry and imposition without changing the physical paper
- Paper presets from US Letter and A5 up to Tabloid, A3, and 30" × 42" Unigrid sheets
- Re-Order moves or swaps single pages and spreads, keeping paired pages together
- Auto-Distribute fills every page from the image tray in one step
Editing
- Layers: photos, text, shapes, and icons share one stacking order per page, reordered by drag
- Rich text with per-selection color, bold, italic, and underline, curved text, fixed or auto boxes, and justified wrapping with hyphenation
- Shapes and icons: nine shapes, including speech and thought bubbles, plus search across 300,000+ open-source Iconify icons
- Photo placement by fill, fit, or manual pan, zoom, and rotate, with rotation-aware crop limits and snap guides
- Copy and paste layers across pages; marquee and range selection move a mixed group as one undo step
- Layout grids guide alignment in the editor and never print
- Skins: PRINT SHOP plus Washi, Riso, and New Wave (two variations each) repaint the editor, never the zine
- Phone and iPad: a dedicated touch editor on phones and a landscape tablet layout, both running the desktop editing logic
Images
- Add Images takes JPEG, PNG, and WebP by picker, drag-and-drop, camera, or paste
- Library searches Openverse, the Library of Congress, and the Internet Archive, including page-by-page archive documents with region clipping
- Provenance: creator, license, source, and crop travel with each imported image inside the project
- Preview blobs keep editing fast while every export renders from the original upload
Export
- One Export dialog for Quick Print, PDF, PNG, ZIP bundles, and editable project files
- Print shop PDF (Pro) at 300 PPI with bleed, crop marks, and local CMYK conversion from the printer's ICC profile
- Watermark-free output on Plus and Pro; Free output carries a small per-face watermark
- Print guidance per format, such as short-edge duplex for the 16-page Foldy, with a folding guide
Cloud, accounts, and profiles
- Autosave to IndexedDB with visible save status, restored on reload
- Encrypted cloud projects (Plus): content is encrypted in the browser before upload, so Zineroo and its storage providers cannot read it
- Recovery key and optional trusted-device unlock open projects on a new device with no server-held content key
- Resumable sync with progress, capped retry, offline resume, and explicit conflict handling
- Projects library with search, favorites, manual versions, restore, and a 30-day Trash
- Profiles: display name, city, tags, and a sticker avatar; each shareable field stays private until its owner makes it public
- Plans through Stripe Checkout and the billing portal; access codes, gifts, and printed promo cards unlock them too
Classrooms
- Room QR on the classroom screen fills in the room key; students still sign in as themselves
- Scan my card: each student gets one printed sign-in card for all their classes, read by the device camera
- Roster import from CSV, with printable sign-in cards for the whole class
- Access Setup per room for assigned, shared, or mixed devices sets session length and whether a browser may be remembered
- Teacher reader flips through each student's zine spread by spread, with a full-sheet view
- Staff controls replace a lost card, reset a password, or remove a student, each ending that student's sessions at once
- School data is encrypted per school with keys held in AWS KMS; student work is never public
Tech Stack
| Framework | React 18, React Router, Vite, and TypeScript |
| Rendering | One Canvas renderer plus shared DOM geometry for the editor, previews, imposition sheets, print, and export |
| Persistence | IndexedDB autosave and sync queue; Supabase Postgres and Storage for encrypted cloud objects |
| Encryption | Web Crypto key hierarchy in the browser for personal projects; AES-GCM envelopes with AWS KMS keys, reached through Vercel OIDC, for school data |
| Export | jsPDF, Canvas PNG, local CMYK with ICC output intents, and a small in-app ZIP writer |
| Hosting | Vercel static build with serverless API routes |
| Auth and billing | Supabase Auth, Stripe Checkout and webhooks, captcha, and server-side entitlements |
| Testing | About 400 Vitest files and an 83-story Playwright suite against a Docker-backed local Supabase stack |
| Observability | Sentry, Vercel Analytics, and Speed Insights |
Architecture
Source structure
api/ Vercel routes: accounts, billing, admin, classrooms server/ billing, classrooms, auth, archive adapters, security src/ main.tsx router: public pages, editor, classrooms, admin App.tsx editor state, history, intake, export canvas/ the one renderer for previews, sheets, print, export components/ editor panes, mobile editor, Library, classroom UI context/ auth, private cloud vault, cloud sync bridge crypto/ key hierarchy, recovery keys, cloud objects domain/ project model, format maps, text, shapes, skins services/ IndexedDB, sync, entitlements, PDF, ICC, ZIP styles/ app shell, editor, skins, site, classrooms
A document that survives rollbacks
type ZineProject = {
version?: number; // PROJECT_VERSION when saved
format?: LayoutFormat; // 'zine' | 'foldy-16' | 'trifold' | …
title: string;
assets: ZineAsset[]; // original, preview, provenance
pages: PageSlot[];
settings: DesignSettings; // paper, orientation, margins, grid
};
type PageSlot = {
id: number;
photoLayers?: PhotoLayer[];
textOverlays?: TextOverlay[]; // text + styleRanges (UTF-16)
shapeOverlays?: ShapeOverlay[]; // shapes, embedded Iconify icons
// Bottom-to-top stacking order of element ids across every kind.
// Reconciled by normalizeLayerOrder whenever it may be stale.
layerOrder?: string[];
spreadId?: string;
// …
};
// Bump whenever a release changes what a saved project contains.
// Older builds refuse to open or overwrite newer projects, so an
// app rollback cannot silently normalize newer work away.
export const PROJECT_VERSION = 11;
export function assertSupportedProjectVersion(project: unknown) {
if (isProjectTooNew(project)) {
const { version } = project as { version: number };
throw new ProjectTooNewError(version);
}
}
A project is one portable document: assets, page slots, and settings. Runtime object URLs are stripped before saving and rebuilt on load, so the same document moves between IndexedDB, an exported file, and the encrypted cloud. Each slot keeps a single layer order across photos, text, shapes, and icons; the renderer, hit-testing, the Layers panel, and export all read that one list. The version guard runs at every entry point (local restore, the sync queue, and the cloud manifest), which makes rolling back a release safe: an older build stops with a reload prompt instead of quietly dropping fields it doesn't know.
The preview is the export
// 8-page Foldy: the top row prints upside down so the sheet folds.
export const IMPOSITION_PAGES = [7, 6, 5, 4, 8, 1, 2, 3];
export const TRIFOLD_OUTSIDE_PAGES = [2, 6, 1];
export const TRIFOLD_INSIDE_PAGES = [3, 4, 5];
async function renderPdfBlob(
options = STANDARD_PDF_EXPORT_OPTIONS,
sides = sheetSidesForProject(project),
) {
const { default: JsPDF } = await import('jspdf');
const paper = sheetSizeForProject(project);
const { width, height } = pdfPageSizeForExport(paper, options);
const orientation = width > height ? 'landscape' : 'portrait';
const format = [width, height];
const pdf = new JsPDF({ orientation, unit: 'pt', format });
for (const [index, side] of sides.entries()) {
if (index > 0) pdf.addPage(format, orientation);
// Full Sheet preview calls this same renderer with preview images.
const px = pdfTrimCanvasWidthForExport(paper.width, options);
const sheet = await renderImpositionCanvas(project, px, {
imageSource: 'original',
sideId: side.id,
watermark: exportWatermark,
});
const prepared = preparePrintCanvas(sheet, options); // bleed, CMYK
const jpeg = prepared.toDataURL('image/jpeg', 0.95);
pdf.addImage(jpeg, 'JPEG', 0, 0, width, height);
}
return pdf.output('blob');
}
Every view, from the editor and Grid to Page Preview and Full Sheet, and every output, from print and PDF to PNG, goes through the same format definitions and the same canvas renderer. Text layout keeps source-string offsets while wrapping and hyphenating, so a color applied to a selection lands on the same characters in the live textarea, the canvas, and the PDF. A written rendering contract backs this up: switching views must never change an image's geometry, crop, or aspect ratio, and canvas resolution never feeds back into layout. Two-sided formats come from a per-format side list, so a format cannot silently lose a side at export.
End-to-end encrypted cloud projects
// All in the browser. The server stores wrapped keys and ciphertext.
const KW = { name: 'AES-KW', length: 256 };
const USES: KeyUsage[] = ['wrapKey', 'unwrapKey'];
export async function createVaultMasterKey(recoverySecret) {
const vaultKey = await crypto.subtle.generateKey(KW, true, USES);
// HKDF-derived from the user's recovery key
const recoveryKey = await recoveryWrappingKey(recoverySecret);
const wrappedVaultKey = await crypto.subtle.wrapKey(
'raw', vaultKey, recoveryKey, 'AES-KW');
return { vaultKey, wrappedVaultKey };
}
export async function createTrustedDeviceEnvelope(vaultKey) {
// Non-extractable: unwraps the vault, but can't leave the device.
const deviceKey = await crypto.subtle.generateKey(KW, false, USES);
const wrappedVaultKey = await crypto.subtle.wrapKey(
'raw', vaultKey, deviceKey, 'AES-KW');
return { deviceKey, wrappedVaultKey };
}
type CloudSyncJob = {
projectId: string;
project: ZineProject;
expectedGeneration: number; // mismatch = conflict, not overwrite
revision: number;
state: 'pending' | 'syncing' | 'error' | 'conflict';
retryCount: number;
retryAt: number;
// …
};
Each project gets its own key, wrapped by a vault key, which is in turn wrapped by the recovery key and, optionally, by a per-device key. The manifest, originals, previews, thumbnails, and titles are encrypted before upload. Saving goes through a queue rather than a one-shot request: a meaningful edit is written to IndexedDB with the cloud generation it expects, then uploaded with byte-level progress, capped exponential retry, and resume when the browser comes back online. If another device saved first, the generation check turns that into a visible conflict, and the user can open the newer version or keep their local work as a copy.
Printed sign-in cards with nothing stored
// Card QR text: ZR1:<student id>:<card code>. Plain text, never a
// URL, so nothing lands in a shared iPad's browser history.
function codeBytes(key: Buffer, s: CardSubject) {
const message = ['student-card', s.organizationId, s.studentId,
s.cardVersion].join('\u0000');
return createHmac('sha256', key).update(message, 'utf8')
.digest().subarray(0, CARD_CODE_BYTES); // 128 bits
}
export function checkStudentCardCode(candidate: unknown,
subject: CardSubject): StudentCardCheck {
// HKDF of the student pepper under its own label
const key = cardKey(studentCredentialPepper());
const expected = codeBytes(key, subject);
// ...canonical base64url check...
if (timingSafeEqual(given, expected) && wellFormed) return 'matched';
// Older versions are checked only so the log can say "replaced".
const oldest = Math.max(1, subject.cardVersion - 50);
for (let v = subject.cardVersion - 1; v >= oldest; v -= 1) {
const old = codeBytes(key, { ...subject, cardVersion: v });
if (timingSafeEqual(given, old)) return 'replaced';
}
return 'mismatch';
}
Classrooms run on shared iPads and Chromebooks, so sign-in has to work for young students without creating a new secret to store. A card's code is derived, not saved: an HMAC over the school, the student, and a card version. Staff can reprint a card at any time, and "Replace card" raises the version, which cancels the old card and signs the student out everywhere. The scanner decodes only a centered square of the camera frame and needs the same code held steady for one second, so a neighbor's card isn't read by accident. Frames never leave the device, and the camera is allowed only on the student sign-in routes through a Permissions-Policy header. Rejected cards are logged as security events.
Skins change paint, never layout
/* Editor CSS reads role tokens; a skin overrides only those. */
html[data-skin="riso-a"] {
--fg: #24533f;
--fill: #24533f;
--on-fill: #fffaf5;
--surface: #fffaf5;
--edge: #24533f;
--cast: transparent;
}
/* Each skin font is tuned to the line metrics of the default font it
replaces, so every row keeps its height and no control moves. */
@font-face {
font-family: "Skin Riso A Body";
src: url("/fonts/skins/figtree-latin-variable.woff2");
size-adjust: 104%;
ascent-override: 75.096%;
descent-override: 32.885%;
line-gap-override: 0%;
}
Skins may change color, type, case, corners, shadows, and texture, but never size, spacing, or order, and never the zine itself: the canvas paints only the user's pages. A geometry test confirms every control stays where the default PRINT SHOP skin puts it. The choice is saved to the account through a single-column database function, so it follows the user to other devices, and it is applied before React renders so the editor never flashes the wrong skin. If a subscription lapses, the editor falls back to PRINT SHOP and keeps the saved choice for when it returns.
Development and release
Feature work runs in a Docker-backed Test Studio that owns its own local Supabase stack, migrations, and switchable Free, Plus, Pro, gift, campaign, and classroom personas, with no path to production data. Releases are staged and promoted: a hosted browser suite runs against the exact commit, the build deploys to production unpromoted, and a typed confirmation promotes it, with a one-command rollback. Public-page copy and CSS can ship through a separate, validated presentation lane that never rebuilds the app, so wording fixes don't carry product-code risk.
Design Notes
The interface uses a print-shop vocabulary: heavy rules, square controls, hard shadows, paper tones, and a narrow red accent. Panels follow the workflow: image tray on the left, the working sheet in the center, design controls on the right. The app favors visible mechanics over hidden menus, because the user is making a physical object and needs to see the consequence of each change immediately.
Page Preview shows the zine the way a reader will hold it, page by page and spread by spread in reading order. That is the view that tells you whether the zine works. The Full Sheet sits one click away as a print check, so imposition problems show up before anything prints. On a phone the editor becomes five destinations with focused, horizontally scrolling sheets rather than a shrunken desktop. Tablets keep the touch layout only when both side panes fit beside the page, and smaller windows get a clear prompt to resize instead of a cramped canvas.