Docs2Kindle
Combine Google Docs into a single Kindle-ready EPUB
Description
A Next.js web app that lets writers select multiple Google Docs via the Picker API, reorder them as chapters, and download a single Kindle-ready EPUB. The EPUB is assembled server-side with a hand-rolled ZIP builder (manual binary headers, CRC-32 checksums, uncompressed mimetype per EPUB 3.0 spec) running entirely in Vercel serverless function memory with zero file storage.
Visual Demo
Key Technical Decisions
HTML export over plain text
Documents are exported from Google Drive as HTML, not plain text. This preserves structural markup (headings, bold, paragraphs) that gets embedded directly into the EPUB chapter XHTML.
Hand-rolled ZIP/EPUB over npm library
epub-gen and similar packages had compatibility issues with Vercel's serverless environment. The hand-rolled approach constructs ZIP binary format manually — local file headers, CRC-32 checksums, central directory — with the mimetype file stored uncompressed per EPUB 3.0 spec.
Google OAuth Testing mode as beta gate
While the OAuth app is in Testing mode, only whitelisted emails can sign in. A Resend-powered email form sends access requests tagged [Gmail] vs [Non-Gmail] for quick triage. No custom auth system needed.
Architecture
Next.js app → Google Drive API (OAuth + Picker) → Server-side EPUB assembly → Resend (beta access emails)
Tech Stack
By the Numbers
Hand-rolled EPUB 3.0 assembler with pure-JS CRC-32
Zero file storage — entire pipeline runs in serverless function memory