Back to projects

Web · Arabic page-flip reader · 2026

Marwah Stories Library

Marwah Stories Library turns an author’s page-by-page scripts into illustrated Arabic books a child can leaf through, on screen and in a square print edition. I built everything between the script and the book: a clay stop-motion art direction, AI artwork made against it, Python page and print tooling, a right-to-left flip-book reader and a signed-in studio where the author edits her books herself. Two books, 40 pages each, are live.

  • JavaScript
  • StPageFlip
  • Python
  • Pillow
  • RTL
  • PDF export
  • Netlify
  • Netlify Edge Functions
  • Netlify Blobs
  • Web Speech API
My part
Art direction, tooling, reader, studio, print
When
2026
Pages
80 across two books
Status
Live, print edition in progress
Marwah Stories Library: the shelf, with two clay stop-motion Arabic children's books

Overview

Marwah Stories Library (مكتبة القصص) collects the illustrated children’s books of Marwah Alhalabi, who writes them as page-scheduled scripts: a table of page number, story text and scene description, and nothing else. No illustrations, no book. I built everything between that file and a book a child can leaf through: one clay stop-motion style file for the whole series, AI-generated artwork produced against it, Python tooling that builds the pages and the print files, a dependency-free right-to-left flip-book library, and a story studio behind a sign-in where the author changes her own text and layout and comments on the artwork. Two books are live, 40 pages each, with a screen PDF per story and print files for a square 23 × 23 cm edition.

My role

All of it: the illustration direction and the style system, the prompt work and the generation and fix rounds, the page and print tooling, the reader site, the studio and the deployment. The author supplies the script and, through the studio, her own edits and picture comments; the rest of the path to a finished book is mine.

LimitThe stories are Marwah Alhalabi’s. The artwork is AI-generated against my clay style file, with a human eye on every page.

What shipped

  • One style file for the whole series: clay stop-motion, described as a photographed handmade set (plasticine puppets with thumbprints, felt, cotton-wool snow, resin water, a macro lens, warm studio lamps), with each book’s cast and its clay cast sheet, the text zones to keep empty, a list of things to avoid and the quality checks. I picked clay after testing covers in three styles, and deleted the old style profiles so the looks cannot mix again.
  • I redrew both books in clay by editing each existing page with the cast sheet attached, so every composition, every character’s place and every empty text zone stayed put. I ran it as one workflow of six AI page agents and six reviewer agents, and kept each page’s brief, attempts and verdict, so the restyle can be repeated.
  • Fixes that touch only what was asked. An image edit re-renders the whole picture, so faces, painted lettering and approved details drift. I take only the fixed region from the edit and blend it onto the previous picture through a feathered mask, so everything outside it stays byte-identical.
  • A dependency-free static library: a shelf of story cards, and a page-flip reader on a pinned copy of StPageFlip, navigable by keyboard, buttons and drag-to-turn.
  • One shared page renderer behind both the reader and a headless print harness, so a story whose captions are drawn over the artwork at read time exports to PDF with its words intact instead of silently shipping wordless pages.
  • A repeated diagonal watermark carrying the author’s name across every page, in the reader and the exported PDF alike, because the books circulate before they are published.
  • Deployed on Netlify as static files: HTML, CSS and plain JavaScript, no build step and no runtime dependencies. The only server code is one edge function: the studio’s sign-in and its saves.
  • Fully vowelled Arabic with the harakat in their own colour, set on a second text layer with fonts built for the marks. The gap between each mark and its letter is measured in pixels, at least 0.06 em, never judged by eye.
  • The pages around the story are part of the book: a title page, a dedication, slogans, word and play pages, and a classification fold on the cover’s corner whose category is typeset, so one picture serves every story.

Making it read like an Arabic book

  • StPageFlip only turns pages the Western way: it lifts the right-hand page and swings it leftwards, spine on the left. An Arabic book does the opposite.
  • Mirroring it in CSS is the obvious fix and the wrong one: it flips every page, so the typeset Arabic and the clay lettering on the covers read backwards, and it desynchronises the library’s pointer maths from what the reader actually sees.
  • So the page list is handed to the library backwards. Reading a reversed book from its last page to its first is physically the same motion as reading an Arabic book front to back: the spine lands on the right, the cover opens leftwards, the earlier page of a spread sits on the right where an Arabic reader looks first, and corner-dragging still works natively because none of the library’s geometry was touched.
  • The cost is two page numbers in play at once, so they are never mixed: moving forward in the story calls the library’s “previous”, and the number shown to the reader is carried on the page object rather than inferred from the library’s index.
  • The story stays paired as (1,2), (3,4), with the odd page on the right. A book with an odd number of inside pages gets a blank leaf in front of the closing page rather than behind the cover, like a printed book’s end paper; both books now ship an even count, with real blank pages for print, so neither needs it.

DecisionThe flip library only turns pages the Western way. Mirroring it in CSS flips every page and the Arabic reads backwards, so the page list goes in backwards instead.

A studio for the author

  • The studio is where the author works on her books herself, in Arabic or English. It opens on a list of her stories; picking one opens a story maker that draws each page with the same renderer as the reader and the PDF, with the book’s settings on one side and the current page on the other.
  • Text is an object on the page: click to select it, drag to move it, pull its handles to resize it, double-click to edit it. Add text places a new line in any of the book’s own styles, with snap guides, undo and redo. Styles are picked from previews drawn with the line’s own words over that page’s artwork, not from a list of names.
  • After every change the page checks where the letters actually land, and warns about text that overlaps other text, runs into the page number or runs off the page.
  • Review mode is for the pictures: drag to mark the part that needs work, call it a change, an issue or a note, and say what should change. Every comment keeps a close-up of the area it marks.
  • Two views of the whole book: All pages lays it out as right-to-left spreads, and Manuscript shows the story as editable text with word counts, a read-aloud time and length tips for the book’s age range. A read-aloud voice highlights each word as it speaks it.
  • Send work turns all of it into one self-contained HTML file: every changed page before and after, the book settings and every picture comment, with the settings inside in a form I can apply. On a phone, Share… hands it to WhatsApp. I read it with a script and bake it into the book.
  • A real sign-in in front of it: a Netlify edge function checks the username and password against environment variables and sets a signed, HttpOnly session cookie for seven days. Without its settings it serves nothing. The story PDFs moved behind it too, so only the studio can download them.
  • Work saves online, per person. The browser keeps the working copy, and every change is also saved to Netlify Blobs under the signed-in user’s name, so no one sees another’s work. Up to five earlier versions of each story can be brought back.
  • Each text has its own switches: tashkeel on or off, a frosted glass panel behind it (panels that come close merge into one), and show or hide. A page that ships faded, like a title page, gets a Fade slider.
  • She can add pages, and a book check counts every page, covers included: an odd total is an error, and one that is not a multiple of four gets a warning, because printers fold sheets in fours. A bilingual studio guide and What’s new notes explain each change in plain words.

DecisionThe studio never changes the live books. It hands back one file of changes and I bake them into the book, so nothing reaches a reader without a rebuild.

A print edition

  • Both books are square, 23 × 23 cm, for the publisher. Each page sits on a bleed canvas and the type is scaled with the art, so the reader, the screen PDFs and the print files all come from one layout per book.
  • A Python builder makes the print PDFs at the exact physical size, with a 5 mm bleed, TrimBox and BleedBox, and refuses any page image that is not the full bleed page at 300 ppi.
  • Rights pages set from the national library’s cataloguing card, with the ISBN and the deposit number, and two QR codes: the publisher’s site and the author’s Instagram. I decode every QR code from a print-size render before handing the files over.
  • An ISBN barcode on each back cover, drawn by a small tool that also reads a barcode back, to check it against the publisher’s picture and the printed page.
  • In the first book, I split four pages that each held two moments into two pages each, with seven new pictures and the text moved unchanged, so the story now runs over 27 numbered pages.

DecisionEach book gained a blank page after the front cover and before the back cover, for 40 pages: printers fold sheets in fours, and the studio’s book check warns when an edit breaks that.

UX decisions

  • The shelf is the landing page: cover, title, author, one line of summary, and chips for category, age range and page count. That is enough to choose a book without opening one.
  • All story text is typeset over the pictures, never painted into them, so the words stay selectable, Quranic verses are always typeset, and a typo is fixed without regenerating a picture. Only the cover titles are sculpted into the clay.
  • A story with no artwork yet stays on the shelf marked “coming soon” instead of disappearing, so the library reads as a series that is growing.
  • The reader is Arabic-first throughout: interface, fonts and direction, with no English mode, because its readers are children reading Arabic. The studio is the only part with an English mode.
  • No framework and no bundler; the catalogue is a plain script rather than JSON fetched at runtime, so the site also works opened straight from disk.

Worth a closer look

What I like most is that the books went through a complete change of art style with their typeset text untouched. The text is typeset over the pictures, never painted in, and the clay restyle edited each existing page rather than starting over, so the layouts carried across; where the clay drew a character larger, I zoomed the art out instead of shrinking the text. The honest limit is the artwork: AI still needs a human eye on every page, because an edit can quietly drop an expression, a piece of writing or a small prop.

LimitA restyle by edit can lose expressions, writing and small props, so I check every restyled page against its source.

Screens