BookForge AI is a Node.js, Express, SQLite, Bootstrap 5 application for generating long-form fiction and non-fiction books from uploaded text, Markdown, and image source files, a guidance prompt, and an optional cover image. Uploaded PNG, JPEG, WebP, and GIF images are analyzed by the AI and their visual context is incorporated into planning and chapter generation.
Node.js 22 or newer is required because the app uses Node's built-in SQLite module.
cd bookforge-ai
npm install
cp .env.example .envEdit .env and set OPENAI_API_KEY. Web-enabled generation uses gpt-5.5 by default; set OPENAI_WEB_SEARCH_MODEL to another web-search-capable model if needed.
npm run devOpen http://localhost:3000.
- Uploaded files are stored in
uploads/. - Exported PDFs are stored in
exports/. - SQLite data is stored at
src/db/bookforge.sqliteby default. - The app validates file types and upload size.
- Source uploads allow up to 2,000 files per request by default. Set
MAX_SOURCE_FILESto change the limit. - Book generation is incremental: file summaries, plan, chapter outlines, chapters, summaries, and continuity notes are saved as generation progresses.
- Large source collections are summarized concurrently, consolidated in context-safe batches, and reduced before book planning. Plan generation runs in the background with progress logs, duplicate-job protection, request timeouts, and retries.
- AI generation requires a valid OpenAI API key. Project CRUD, chapter editing, preview, and PDF export remain local.
- Upload source files.
- Generate a book plan. Unsummarized sources are summarized first.
- Generate the concept, outline, book bible, characters, locations, and style guide.
- Generate chapters sequentially. Each chapter updates its summary, continuity notes, and book bible.
- Review, edit, regenerate, or approve chapters.
- Open the HTML preview and export the generated or approved chapters to PDF.
- Upload and analyze source files.
- Generate a central thesis, target reader, table of contents, chapter outlines, source summary, key terms, claims, research gaps, and fact-checking notes.
- Generate chapters sequentially from the thesis, source summaries, research notes, prior chapter summary, and known uncertainties.
- Audit every chapter for claims, references needed, open questions, and factual uncertainty.
- Run a manuscript-level consistency and fact-checking review after sequential generation completes.
- Review or edit chapters, then preview or export the book. Non-fiction exports add a references-needed section and a research/factual-uncertainty appendix when data is available.
Non-fiction prompts do not request fictional continuity, characters, plot arcs, or world-building. The AI is instructed not to invent facts or citations; unsupported claims are marked as needing verification.
- Project CRUD
- Multiple text, Markdown, and image source uploads
- Vision analysis of PNG, JPEG, WebP, and GIF source images
- Optional web research during book planning and chapter generation
- Optional cover upload
- Separate OpenAI planning and chapter-generation paths for fiction and non-fiction
- Sequential chapter generation and regeneration
- Chapter editing and approval
- HTML preview
- PDF export with title page, table of contents, chapters, and page numbers