Storyfab

From a rough idea to a published book, with an AI that asks before it writes

Storyfab is a writing and publishing platform for authors. Instead of generating text straight away, the AI interviews the author one question at a time until every open decision about a chapter is settled, then drafts the chapter from those answers. Every draft is kept as a version, and published chapters appear immediately in a built-in e-book reader, optionally with audiobook narration.

Storyfab — revising a chapter with AI next to the Markdown editor
Storyfab — revising a chapter with AI next to the Markdown editor
Storyfab — the chapter interview: one question per round, the author's answers shape the draft
Storyfab — the chapter interview: one question per round, the author's answers shape the draft
Python 3.11Flask 3.1Vanilla JavaScriptVite 8OpenRouterElevenLabsAPSchedulerReportLabpython-docxGunicornnginxDockerGitLab CI/CDpytestVitestPlaywright

Storyfab is a web platform for writing books with AI and publishing them. It covers the whole path of a chapter: a few bullet points about the plot, an interview that sharpens them, a first draft, as many revision rounds as needed, and publication in a public e-book reader, optionally with an audiobook.

Most AI writing tools start producing text right away and leave the author to fix whatever came out. Storyfab turns that around. The AI asks first, the author decides, and only then is the chapter written. The story grows out of the author's own choices instead of the model's defaults.

The Interview

The interview sets Storyfab apart. The AI treats the chapter as a decision tree. Who knows what, and when? What does the reader suspect before the twist? Which details point the way without giving it away? Each round it asks exactly one question, or one sensibly combined question, and the author answers in free text, typed or dictated. The session ends when the AI considers the tree empty, when the author stops, or when a configurable question limit is reached.

All answers are stored with the chapter and can be reviewed and edited later. Together with the plot notes, the book's metadata and the story bible, they form the context for the first draft.

Writing and Revising

The draft opens in a Markdown editor with a live preview. From there the author can:

  • Edit by hand and save at any time
  • Revise with AI using a free-form instruction ("more tension in the second half") and an optional style, either written freely or picked from a template
  • Keep the content as it is. If the instruction field is empty, the AI is told explicitly not to change the content
  • Include the story bible or the whole book as context for a revision, both switchable per request
  • Make the text sound more natural with a two-pass rewrite that strips typical AI phrasing without touching plot, characters or style

The editor state is saved automatically before every AI call, and an AI error never changes a saved text.

Versions and Publishing

Every save, draft and revision becomes its own immutable version. A version history shows the current state, and any earlier version can be restored with one click without losing the later ones.

Publishing a chapter marks the chosen version as the published one and makes it visible in the reader immediately. In the same step, a separate AI call reads the existing story bible and the new chapter and updates characters, plot threads and open questions, so the next chapter starts from an up-to-date picture of the book. Books can be published as a whole or chapter by chapter, and chapter numbers stay stable even when some chapters are still drafts.

The Reader

Published books appear in a public reader that works without an account, on desktop and on phones:

  • Real pages that are recalculated for the window size, font size and typeface
  • Turning pages by click, keyboard or swipe, or switching to a continuous scroll view
  • Light and dark mode, adjustable font size, several typefaces and fullscreen
  • Bookmarks and reading position remembered across visits, with no login and no server-side tracking
  • Audiobook player for chapters with current narration, with playback speed remembered per book and position per chapter

Every book carries its own color, like a publisher's series. The color runs through the reader and the authoring interface alike.

Audiobook and Export

Each published chapter can be narrated via ElevenLabs. The author picks a voice per book, sees the character count before confirming, and the MP3 is generated as a background job. Long chapters are split at paragraph boundaries and joined into a single file. Chapter files can be merged into one book-length MP3 without new speech synthesis.

Any chapter version can be downloaded as Word or PDF. The whole book exports as Word, PDF or EPUB with a title page, blurb and a clickable table of contents, in the PDF with page numbers. A Kindle (AZW3) export is available where Calibre is installed. Book exports also run as background jobs, so the interface stays responsive.

Architecture

  • No database. Each book is a self-contained folder of Markdown, JSON and image files that can be backed up as a ZIP and imported again. All writes are atomic, and versions are never overwritten.
  • Stable chapter identity. Chapters are referenced by UUID, so reordering by drag and drop changes nothing in the version history.
  • One isolated AI client. All model calls go through a single OpenRouter module with a model whitelist, timeouts and clear error messages. The prompt is assembled by a pure function in a fixed context order.
  • Two separate applications. A Flask backend for authoring and a framework-free JavaScript reader that only talks to a read-only public API, which never exposes drafts or internal data.
  • Tested against its specification. Each acceptance criterion is backed by an automated test in pytest, Vitest or Playwright. AI calls are always mocked in tests.

Tech Stack

Component Technology
Backend Python 3.11, Flask 3.1, Gunicorn
Reader Vanilla JavaScript (ES modules), Vite 8
AI OpenRouter (model selectable from a whitelist)
Voice ElevenLabs (narration, dictation)
Background jobs APScheduler (in-process)
Export python-docx, ReportLab, EPUB 3, optional Calibre
Storage File system (Markdown, JSON, images)
Tests pytest, Vitest, Playwright
Deployment Docker, nginx, GitLab CI/CD

Deployment

Storyfab runs at storyfab.iodesign.de. Backend and reader are built as two containers. Every merge to main runs the test suites, builds both images and deploys them to the server. After each deploy a health check runs against the backend and the reader; if it fails within 60 seconds, the previous version is restored automatically.