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
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 & config
01Trigger

Start

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

02Set

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.

03Set

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.

04Code

Parse titles

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

Market research
05HTTP

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.

06Code

Parse the shelf

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

07HTTP

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.

08Model 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.

09Code

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.

Brief & design
10Model 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.

11Code

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.

12Model 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.

13Code

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.

14Model 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.

15Code

Parse the front

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

16Model call

Design the back

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

17Code

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).

Build & audit gate
18Code

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.

19Model 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.

20Code

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.

21IF

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.

22Model 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.

23Code

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.

24IF

Audited already?

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

Cover
25Code

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.

26Code

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.

27HTTP

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.

28Code

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.

Delivery
29Code

Finish book

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

30Model 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).

31Code

Run report

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

32Loop

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.

33Code

Final report

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

Results

One title in.
One folder out.

Research, design, layout, audit, cover and listing — the whole production line runs unattended, and quality is enforced by a gate, not by a checklist someone has to remember.

0+
nodes in one workflow
0
audit rounds before a book can fail
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