I built a book generator that runs entirely in your browser — no server, no account, no backend
A few months ago I posted here about EbookForge — a JSON-to-PDF engine I built because formatting ebooks was driving me insane. That post got zero comments. Fair enough. The product was rough, the pitch was confusing, and honestly — asking people to write books as JSON was a hard sell. But the forma
EbookForge
A few months ago I posted here about EbookForge — a JSON-to-PDF engine I built because formatting ebooks was driving me insane.
That post got zero comments. Fair enough. The product was rough, the pitch was confusing, and honestly — asking people to write books as JSON was a hard sell.
But the formatting problem was real. So I kept building. And the project got completely out of hand.
What started as a formatter became something else
The original pain: I had structured content and no clean way to turn it into a typeset PDF with a cover page, justified text, embedded fonts, and a table of contents with actual page numbers. Everything I tried required a server, looked terrible, or both.
So I built a client-side PDF engine. That worked. But then I realized: the formatting was the easy part. The hard part was making the input worth formatting.
So I kept going.
EbookForge today
EbookForge now generates complete books from scratch — entirely in your browser.
You describe your taste:
- Pick up to 3 genres
- Place a dot on a 2D emotional axis (comforted ↔ disturbed, devastated ↔ euphoric)
- Describe your protagonist in one sentence
- Drop in a "wildcard seed" — a sensory image, a memory, a vibe
The AI then architects a full book blueprint (title, plot, chapter arcs, themes, trigger warnings), generates a painterly cover illustration, and writes the first chapter. You read it, then forge the next chapters one by one.
The twist: between chapters, you can inject "Director's Notes" — creative instructions like "a sudden betrayal" or "the rain stops and the silence becomes deafening." The system rewrites the remaining chapter plan to stay coherent with your intervention.
Then you download the whole thing as a typeset PDF with embedded fonts, cover art, synopsis page, and numbered table of contents.
No server. No account. No database. Your Gemini API key lives in sessionStorage and dies when you close the tab. There's a full demo book you can browse without any key.
The stack
Zero backend. Zero dependencies beyond the browser and a Gemini key.
Getting AI to generate images without text.
I needed painterly cover illustrations with zero typography. Image models desperately want to put words on images. The prompt has to be adversarial — "ABSOLUTELY NO TEXT, NO LETTERS, NO WORDS" — and it still fails maybe 20% of the time. This single problem took more iterations than the rest of the app combined.
Multi-chapter coherence with human interventions. When you inject a Director's Note that contradicts the planned story arc, every downstream chapter summary needs to adapt. The system sends the generated chapter text + the user's note back to the AI and asks it to rewrite the remaining chapter metadata. It works surprisingly well. When it doesn't, the prose still adapts through context because each chapter prompt includes the tail end of the previous chapter.
Two-pass PDF rendering. The table of contents needs page numbers, but you don't know the page numbers until you've rendered all the chapters. So: first pass renders everything and tracks where each chapter lands, second pass goes back to the TOC page and fills in the numbers. Justified text is done via manual word-spacing calculation — split each line into words, measure the leftover space, distribute it evenly.
Persistence without a backend. Cover images are multi-megabyte base64 strings that blow up localStorage. Solution: metadata goes to localStorage, covers go to IndexedDB, and the library view stitches them back together on load. Delete a book and both stores get cleaned up.
What it's NOT
It's not a publishing pipeline. It's not meant to flood Amazon with AI novels. It's a creative toy — closer to AI Dungeon for long-form fiction than a KDP tool.
The question I was chasing: can a human and an AI co-direct a narrative across multiple chapters, with the human's choices propagating forward coherently?
The answer is "sometimes, and it's genuinely fascinating when it works."
Try it ebookforge.app
You can browse the full demo book (English or French) without entering any API key. Bring your own Gemini key to forge one from scratch.
Bilingual EN/FR.
The whole thing is a solo side project that started as a formatting script and turned into whatever this is. If you've ever fought with PDF generation in the browser, or tried to make AI-generated text stay coherent across 10+ chapters — I'd love to hear how you approached it.
Found this useful? Share it!
Read the Full Story
Continue reading on Dev.to
Related Stories
Majority Element
about 2 hours ago
Building a SQL Tokenizer and Formatter From Scratch — Supporting 6 Dialects
about 2 hours ago
Markdown Knowledge Graph for Humans and Agents
about 2 hours ago

Moving Beyond Disk: How Redis Supercharges Your App Performance
about 2 hours ago