Case studyAutomation · Publishingn8n + Kie.ai

KDP Book Factory:
a title in, a print-ready book out.

A self-publisher was spending days on every low-content book — researching the Amazon shelf, designing pages, laying out the interior, checking it, drawing a cover, writing the listing. We turned the whole routine into one unattended pipeline that takes a list of titles and returns finished files.

n8nKie.ai APIClaudeGPTGPT ImageScraperAPIJavaScript PDF builderAmazon KDP specs
Automation offeverything by handAutomation onthe flow does the work
24h1h
difference23 h back on every title
0nodes in one n8n workflow
0model calls · the rest is code
0IF gates that can stop a book
3–5top competitors studied per title
0operator forms or clicks
0archive out: book, cover, listing
The brief

A planner is easy to draw.
A planner that sells is not.

Low-content books — planners, journals, logbooks — live or die on the Amazon shelf. Every title needed the same long routine: read the competition, decide what the book must do better, lay out a hundred-plus pages, check every one, draw a selling cover, write the listing. Done by hand, that is days per book, and the quality depends on how tired the person is.

By hand
  • Scroll the Amazon results and guess what buyers want
  • Copy a competitor's interior and hope it is different enough
  • Lay out pages one by one in a design tool
  • Check the PDF by eye — and miss the repeated page
  • Work out the spine width, then redo the cover when the page count changes
  • Write the title and description at the end, in a hurry
The factory
  • Reads the live shelf, drops off-topic listings, takes medians from the rest
  • Merges the best of 3–5 competitors and adds something of its own
  • Builds the 6×9" interior in code, with KDP margins, on white paper
  • Machine QA plus a second-model audit — a release gate, not a report
  • Computes the full-wrap cover from the final page count
  • Writes the listing in one fixed shape, with format and page count
What happens to one title

Six stages,
one folder at the end.

The same path for every subject — a food journal, a pilot logbook, a homeschool planner. Nothing in the pipeline is tailored to one book.

01market research

Read the shelf

The live Amazon search page for the title, fetched the way a buyer sees it today. Every listing is parsed — page count, price, rating, reviews — and a model first throws out the books that are about something else. Medians come only from the relevant ones.

Amazon · “food journal for ibs” · 16 listings Low FODMAP food & symptom diary120 pp★ 4.6 IBS tracker journal, 90 days110 pp★ 4.4 Gut-healing cookbookoff-topic Food mood poop journal150 pp★ 4.5 Keto meal planneroff-topic 5 relevant kept · median 120 pages
02brief

Decide how to beat them

A research brief: who buys the book, what the best competitors put on their pages, what reviewers ask for and do not get. The plan takes the best of three or more books into one list, removes duplicates and weak ideas, and adds something of its own — a synthesis, never a copy.

Shelf median120 pp This book142 pp Daily log · 14 fieldsTrigger reviewWeekly summary+ Symptom scale legend+ Doctor visit notes Owner name fieldLined filler pages
03interior

Build the book in code

The design calls lay out the daily page, the front and the back; a JavaScript builder renders the 6×9" PDF with KDP margins, black ink on white paper. Checkboxes and scales are drawn shapes, not typed characters; every page carries real content.

Food Journalfor IBS© 2026 DATE ____ DATE ____ WEEK IN REVIEW 6 × 9 in · white paper · 142 pp
04release gate

Audit, fix, rebuild

Machine QA runs while the PDF renders. Then a second model reads the whole book against the brief and grades every finding — critical, important, not important. Only real defects hold a book back; fixes touch only what a finding names, and the book is rebuilt and audited again.

Audit · round 13 findings criticalTwo pages identical (p. 41, 42) importantWeekly page missing a DATE field not importantCaption 1 pt smaller than body ↺ fix only what is named · rebuild · audit again Audit · round 2passed · gate open
05cover

A selling cover, to the millimetre

Code computes the full wrap from the final page count — trim, bleed, spine, safe zones — and lays down a stencil that differs from book to book. GPT Image draws the cover over it, text included; code only keeps everything inside the margins and nothing on the spine.

Track every meal.FOOD JOURNALfor IBSLow FODMAP · 90 days backspine 0.34"front
06listing & delivery

The listing, in one fixed shape

An SEO title that opens with the search phrase as typed, a selling description with keyword variants and the right disclaimer, seven keywords and two full KDP categories — plus the trim and page count. Book, cover and listing land in one archive.

TITLEFood journal for IBS: Low FODMAP diet tracker, symptom diary · 90 days KEYWORDSibs diaryfodmap loggut healthsymptom tracker+3 FORMAT6 × 9 in (15.24 × 22.86 cm) · 142 pages 📦 food-journal-ibs.zipinterior.pdfcover.pngTitle and description.txt
Every node

33 nodes.
Zero operator forms.

The run path of the workflow, node by node — what each one does and why it exists. Seven model calls, two IF gates, one loop; everything else is code.

Input & config01 / 33
Trigger

Start

Kicks off a run. There are no operator forms anywhere after this point — the workflow is designed to be started and left alone.

Input & config
Set

Books to make

The list of titles for this run, one per line. Every title becomes its own item and travels the whole pipeline independently.

Input & config
Set

Config

Single source of settings: API endpoints behind the Kie.ai proxy, which model handles each step (provider_competition, provider_brief, provider_design, provider_fix), time budget per node, output folder on disk.

Input & config
Code

Parse titles

Normalises the raw list — trims, deduplicates, builds a slug for the output folder — and emits one clean item per title.

Input & config
HTTP

Search Amazon

Fetches the live Amazon search page for the title through ScraperAPI, so the run sees the same shelf a buyer sees today, not a cached guess.

Market research
Code

Parse the shelf

Extracts every listing from the results HTML: title, ASIN, page count, price, rating, review count. Sixteen cards in a typical run.

Market research
HTTP

Competitor details

Opens the top listings' own pages to read what the search results don't show: the look-inside page structure, the description, the cover.

Market research
Model call

Competitor analysis

A model reads the shelf and first drops the off-topic listings — the top for a query often contains books about something else. From the relevant ones it derives medians for page count and the features buyers expect.

Market research
Code

Parse competition

Turns the streamed model answer into structured JSON and degrades gracefully if the stream arrived truncated — the run continues with what it has instead of dying.

Market research
Model call

Research brief

Writes the plan for this book: who buys it, what the 3–5 best competitors do, and what this one must do better — more useful pages, more of them, the fields readers ask for in reviews.

Brief & design
Code

Parse brief

Validates the brief against a schema: page target, required sections, required fields on the daily page. Missing pieces are filled with defaults, not silently ignored.

Brief & design
Model call

Design the daily page

Designs the repeating worksheet — every field, its size and order. Split out into its own call so it fits the API gateway's two-minute window.

Brief & design
Code

Parse daily page

Checks the page design: a DATE field must exist, no owner or personal-data fields may exist, columns must add up to the page width.

Brief & design
Model call

Design the front

Front matter: title page, copyright page (© and year, never an author), how-to-use page, any reference pages the brief demands.

Brief & design
Code

Parse the front

Schema check for the front matter and the copyright line; rejects placeholder text and empty pages.

Brief & design
Model call

Design the back

Back matter: review pages, summaries, notes — sized to reach the page target without padding the book with duplicates.

Brief & design
Code

Assemble the spec

Merges the three designs into one BookSpec: the ordered page list with repeat counts, plus the trim size, margins and paper (always white).

Brief & design
Code

Build interior

The largest node — a JavaScript PDF builder that renders the 6×9" interior with KDP margins. While rendering it runs machine QA: duplicate pages, missing date fields, forbidden owner fields, dead vertical space, column widths, table cell text, copyright presence.

Build & audit gate
Model call

Audit

A second model reads the finished book against the brief and lists findings by severity. The machine QA report is passed in so the auditor adds to it instead of repeating it.

Build & audit gate
Code

Score findings

Counts what blocks a release: critical and important findings plus the builder's own blockers. This number — not a feeling — decides whether the book may ship.

Build & audit gate
IF

Rounds left?

IF node. Blocking findings and rounds remaining → go fix. Nothing blocking → move on. Out of rounds and still blocking → the book fails with the report attached.

Build & audit gate
Model call

Apply fixes

Claude rewrites the BookSpec to resolve every finding — the audit is the diagnosis, this is the treatment. Runs up to three times per book.

Build & audit gate
Code

Parse fixed spec

Validates the corrected spec and sends it back to Build interior for a full rebuild, so fixes are verified on real pages, not assumed.

Build & audit gate
IF

Audited already?

IF node. Guarantees the final rebuild is audited before the cover is drawn — a fixed book is never trusted on its word.

Build & audit gate
Code

Cover geometry

Computes the full-wrap cover from the final page count: trim, bleed, spine width, safe zones — exactly as KDP's cover calculator would.

Cover
Code

Print cost

Estimates KDP printing cost from page count and trim, so the listing price on the back cover and in the metadata is realistic.

Cover
HTTP

Cover art

Sends the cover brief to GPT Image through Kie.ai — create task, poll until ready — and requests three variants that follow the shelf's selling formula: big title with an accent word, subtitle band, icon row, promise on the back.

Cover
Code

Compose cover

Measures each variant: text inside the safe margins, nothing on the spine fold, no reserved barcode box. Saves the three covers as PNG.

Cover
Code

Finish book

Writes the interior PDF and the run's metadata into the title's folder on the server's disk.

Delivery
Model call

Listing metadata

Writes the SEO title — search phrase first, keyword subtitle after — and a selling description with keyword variants, plus the right disclaimer (medical for health topics, general otherwise).

Delivery
Code

Run report

Collects every step's result — timings, counts, findings, files — into one text report saved next to the book.

Delivery
Loop

Loop over titles

Loop node. Returns to the next title in the list until the run is exhausted; each title gets a fresh budget of time and fix rounds.

Delivery
Code

Final report

Summary for the whole run: which books shipped, which failed the gate and why.

Delivery
Rules in the engine

Every book, every subject,
the same rules.

The rules are written once, for any subject, and checked by code before and after each build — so a mistake made in one book cannot quietly appear in the next.

01Nothing personal on the page

No owner name, contact or reader-ID fields — not on the sheets, not on a quick-start page, nowhere.

02Copyright once, author never

A © line with the year on exactly one page, centred at its foot. No author, publisher, ISBN or “printed in” line the pipeline cannot know.

03Disclaimer is the last page

Medical for health subjects, general for the rest — always present, always last, never dropped because another page mentions it.

04No padded pages

Every page carries real content. No half-empty sheets, no white voids, no two headings in a row, no rating rows stacked one under another.

05Drawn, not typed

Checkboxes, scales and icon circles are drawn shapes, compact and centred; a cell that exists only for numbering is square.

06Fixes fix, they do not redesign

A fix round touches only what a finding names — no new book each round, no new pages unless asked, and the engine checks the spec before every rebuild.

Results

One title in.
One archive out.

Research, design, layout, audit, cover and listing run unattended. Quality is enforced by a gate that counts defects, not by a checklist someone has to remember at the end of a long day.

0
nodes in one workflow, seven of them model calls
0
archive per title — interior, cover and listing
0
operator forms or clicks per title
Available for new projects

Have a production line
that still runs by hand?

Describe it in two sentences — we reply within a day with a pipeline sketch.

hello@wireclad.com →