ShelfReady: a private Amazon KDP listing studio running Gemma 3 4B on a CPU
- Hardware
- An ordinary 8-core CPU with no GPU
- Models & engines
- Gemma 3 4B (about 2.5 GB quantised) running in Ollama
Model swappable with one environment variable, e.g. SHELFREADY_MODEL=gemma3:12b - Key gotcha
- On a CPU-only machine a listing takes around 40 seconds instead of a few; the author accepts that for a once-per-book task
What they built
Cody Topp is a designer and independent publisher who sells colouring books on Amazon KDP. The slowest part of each launch isn't the artwork but the listing: a title, subtitle, description and seven keyword boxes, each with its own limits and rules.
General AI tools speed that up but often produce phrases like 'Bestselling' or 'Free Bonus Pages' that break KDP's metadata guidelines and can get a listing flagged or suppressed. ShelfReady takes the book's facts (theme, audience, style, number of designs, trim size, marketplace) and in about 40 seconds returns a title and subtitle with a live 199-character meter, seven keyword phrases checked against the 50-character box, an HTML description using only KDP-supported tags, and a readiness score with every issue explained.
The design rule is that the model writes and the code decides. Gemma drafts the copy; a deterministic rules engine enforces the limits and banned language, and the app binds to localhost so unreleased books never leave the machine.
Setup
- Gemma 3 4B (about 2.5 GB quantised) running in Ollama
- An ordinary 8-core CPU with no GPU
- Pure Python standard library plus vanilla HTML, CSS and JS, MIT-licensed, no pip install or build step
- Model swappable with one environment variable, e.g. SHELFREADY_MODEL=gemma3:12b
How it works
- It calls Ollama's /api/chat with structured outputs: a JSON schema that forces exactly four fields and exactly seven keywords, so the model can't return prose instead of JSON.
- kdp_rules.py is a deterministic rules engine mapped to KDP's public help pages: title length, promotional and time-sensitive language, Amazon program names, a trademark tripwire, keyword duplicates, the 4,000-character description limit and allowed HTML tags. It has 27 unit tests.
- Mechanical fixes (unclosed tags, bare paragraphs, 'colouring' vs 'coloring' for Amazon.com) are applied automatically and disclosed; judgement calls are flagged for the user instead.
- If blocking errors remain, the exact error messages go back to Gemma for one targeted repair pass rather than a full regeneration.
- Progress streams as NDJSON so the UI shows a real progress bar, and Cancel stops the model on the server.
Results & numbers
- A full listing in about 40 seconds on a CPU-only machine
- Typing 'Bestselling Edition' into the title drops the readiness score from 100 to 80 and flags it as prohibited sales-rank language
- Marginal cost per listing is zero, which the author says lets a one-time licence in the $19 to $29 range stay viable
Gotchas
- On a CPU-only machine a listing takes around 40 seconds instead of a few; the author accepts that for a once-per-book task
- Don't trust the model to enforce character limits or banned terms; that's why the rules live in code
- The author discloses that an AI coding agent wrote the code and drafted the write-up to his brief
“For a task you do once per book, I'll take private, free and permanent over instant.”— Cody Topp
Do it yourself
- Install Ollama and pull Gemma 3 4B with ollama pull gemma3:4b.
- Clone the ShelfReady repository from GitHub (ctopp11/shelfready).
- Start it with python3 -m shelfready and open http://127.0.0.1:8787.
- Enter your book's theme, audience, style, number of designs, trim size and marketplace, then generate.
- Fix anything the readiness checks flag, then copy each field into KDP or export the listing as a text file.
ollama pull gemma3:4b
python3 -m shelfready # http://127.0.0.1:8787Similar setups
Constraint Kitchen: a Gemma 3 1B DIY idea generator that refuses rather than lies
Shashwat Sinha built a local app that turns household junk into DIY project ideas and build guides with gemma3:1b on an 8 GB M3 Mac, and checks every answer in Python so it refuses when the model breaks your constraints.
Ghost in the Machine: a fake 1998 terminal where a local Gemma 3 whispers back at every command
A Hacktoberfest entry in a single HTML file: you type into a simulated old shell and a presence called the tenant answers each command with one eerie line, streamed from Gemma 3 4B on Ollama.
Haunted Haiku: a local Gemma 3 poet that also designs the card
E. Smith built a small Dash app where a local Gemma 3 in Ollama writes an eerie haiku and picks its colours and emoji in one JSON reply, so the poem and its picture work with Wi-Fi off.
Ofrenda Keeper: local Gemma 3 makes a Día de los Muertos card from only what you said
hongpengtan0-max built Ofrenda Keeper, a local app where Gemma 3 4B in Ollama turns what you tell it about someone you miss into an altar card, and plain code removes any detail you didn't actually say.