AI eBook Creator Architecture: 2-Phase Outline & Chapter Synthesis, Rich Visual Widgets & PDF Export Engine
Writing, structuring, formatting, and publishing a commercial non-fiction eBook traditionally takes weeks of manual drafting, layout formatting, and graphic design. The AI eBook Generator (the flagship generator in Digital Products Maker) automates the entire end-to-end publishing pipelineβfrom initial topic ideation and chapter outlining to structured content synthesis, rich visual component embedding, and print-ready PDF export.
This technical guide explores the 2-phase generation architecture, visual style presets, interactive widget engines, and multi-font PDF compilation mechanisms that make this tool the most powerful non-fiction publishing suite available.
1. The Two-Phase Generation Architecture
To ensure high narrative coherence and prevent context drifting or token truncation, the generator splits book creation into two distinct architectural phases:
graph TD
A[User Inputs: Topic, Tone, Genre, Chapter Count] --> B[Phase 1: Outline Generation /ebook-outline]
B --> C[Structured Chapter Array: Number, Title, Subtitle, Focus]
C --> D[Visual Tabbed Editor: Reorder, Add, or Refine Outlines]
D --> E[Phase 2: Chapter Synthesis /ebook-chapter]
E --> F[Inject: Previous Context + Rich Widgets + Image Prompts]
F --> G[WYSIWYG Rich Content Visual Editor]
G --> H[Multi-Font PDF Export Engine with 7 ToC Styles]
Phase 1: Chapter Outline Synthesis (ebook-outline)
- Inputs:
bookType(Genre),purpose,tone,chapterCount, andlanguage. - Output: Returns a structured JSON schema containing an array of chapter blueprints:
{ "chapterNumber": 1, "title": "The Foundations of Digital Wealth", "subtitle": "Understanding Modern Creator Monetization Models", "focus": "Demystifying digital assets vs physical inventory" } - Server Guardrail: Validates user license and enforces
ebook_monthly_limitandebook_max_chaptersfrom the active subscription plan.
Phase 2: Deep Chapter Generation (ebook-chapter)
Each chapter is synthesized with dedicated narrative continuity:
- Context Injection: Injects the preceding chapter's summary as
previousContextto prevent repetition. - Length Calibration:
- Short: 2β3 in-depth paragraphs (concise guides).
- Medium: 4β6 structured paragraphs (standard non-fiction).
- Long: 7β9 comprehensive paragraphs (comprehensive authority books).
- Structured JSON Schema Output:
openingHook: High-impact introductory statement.sections: Detailed subsections with headings, body text, and bullet points.keyTakeaways: 3β5 bulleted summary conclusions.chapterSummary: 2-sentence transitional synthesis.imagePrompt: Tailored generative art prompt for chapter header illustration.
2. Rich Content Visual Widgets (WYSIWYG Editor)
Unlike generic text generators that output flat markdown walls of text, the Rich Content Visual Editor (RichContentVisualEditor.tsx) enables authors to inject high-converting visual components into any chapter:
graph LR
A[Chapter Body] --> B[π Statistics Cards]
A --> C[π‘ Callout Highlight Boxes]
A --> D[π Action Checklists]
A --> E[βοΈ Comparison Tables]
A --> F[π Data Tables & Charts]
A --> G[π Real-World Case Studies]
| Widget Component | Visual Styling in Exported PDF | Practical Non-Fiction Application |
|---|---|---|
| Callout Highlight Boxes | Rounded background box with left accent border and warning/tip icons | Pro-tips, author notes, key warnings, and definitions |
| Statistical Key Metric Cards | Large bold numerical metric ($100M+, 84%) with subtext label | Highlighting research data, growth rates, and benchmark metrics |
| Comparison Tables | Side-by-side Pro vs. Con or "Before vs. After" feature matrix | Tool comparisons, method evaluations, and decision frameworks |
| Interactive Checklists | Formatted checkbox items with bold action prompts | Action steps, implementation checklists, and audit routines |
| Case Study Modules | Distinct framed block: Challenge $\rightarrow$ Solution $\rightarrow$ Results | Demonstrating practical real-world transformations |
3. Professional PDF Design Styles & 7 Table of Contents (ToC) Templates
The built-in PDF rendering engine (features/ebook-gen/export.ts) compiles your manuscript into a polished interior layout with 4 curated color palettes:
A. Curated Design Style Palettes
- Minimalist Modern: Crisp Slate-800 typography (
#1e293b), pure white backdrop (#ffffff), and electric blue accents (#3b82f6). - Classic Editorial: Warm Dark Brown headings (
#1a120b), cream paper stock (#fdfbf7), and rust amber highlights (#9a3412). - Tech & Science: Deep Slate-900 typography (
#0f172a), cool off-white pages (#f8fafc), and vivid purple accents (#8b5cf6). - Bold Deco: Deep Purple headings (
#4c1d95), delicate lavender-tinted pages (#faf5ff), and magenta highlights (#db2777).
B. Seven Table of Contents (ToC) Layouts
- Dotted Leaders (
dotted): Traditional publishing format with trailing dot lines linking titles to page numbers. - Magazine Style (
magazine): Large 28pt accent numbers with bold chapter headlines. - Modern Left-Block (
modern-left): Clean vertical accent indicator bars with two-digit chapter prefixes (01,02). - Boxed Cards (
boxed): Rounded card containers with soft background fills for each chapter listing. - Elegant Centered (
elegant): Centered classic layout with subtle geometric divider lines. - Minimalist Clean (
simple): Pure horizontal spacing for contemporary guides. - Two-Column Grid (
two-column): Compact side-by-side grid ideal for comprehensive books with 12+ chapters.
4. Built-In Clickable Affiliate & Resource Directory
Every exported eBook can automatically append a monetized Recommended Resources Directory featuring active, clickable PDF hyperlinks:
- Publisher Rocket (Amazon KDP Keyword & Category Research).
- Canva Pro (Graphic Design & Cover Templates).
- Creative Fabrica (Commercial Fonts & Interior Vector Art).
5. Full Bilingual Arabic & English RTL Architecture
When generating Arabic eBooks, the engine automatically:
- Embeds the Cairo Arabic Font Family (Regular & Bold) with full Unicode glyph support.
- Flips the document flow to Right-to-Left (RTL) text alignment.
- Applies a 6x Canvas font measurement scaling factor to guarantee zero text clipping on Arabic ligatures.
- Mirrors Table of Contents dotted leaders and chapter number badges.



