Skip to content

Projects · Mobile

PixieTales

A story written and illustrated for one child, with credits, a premium continuation and a PDF.

An open picture book on a bed, a forest painted on the page

PixieTales is a bedtime product, not a chat window. A parent describes a child, a theme and a setting. The API writes the pages, attaches an image to each page, stores the story on that account, and will only continue it or turn it into a PDF when the subscription says so.

Solutions

  • A story with a shape

    Generation takes a character name, a theme, an age band and a setting. The result is a titled story of pages, each page with text, an image URL and the prompt that drew the image. It is a book, not a single paragraph.

  • Credits, then premium

    A free account holds story credits. Generating a story spends one and returns how many remain. Continuing a story, and downloading it as a PDF, are behind the premium guard.

  • The library stays with the account

    The parent can list every story, open one with all of its pages, and come back to it. Continuation adds pages to that story instead of starting a second, unrelated one.

Process

  1. 01

    Sign in

    The app authenticates against Supabase. Protected routes expect a JWT bearer token. The profile returns the subscription tier and the remaining credits.

  2. 02

    Describe the child

    The generate call posts the prompt: who the character is, the theme, the age group and the setting, plus whether the image should be the premium one.

  3. 03

    Write, then draw

    The OpenAI service asks GPT-4 for the pages and DALL-E for the pictures. Each page keeps both the prose and the image prompt, so the picture can be explained later.

  4. 04

    Store, continue, or print

    The story is saved with its pages. A premium account can continue it. The download route prepares the PDF. Everyone else can still read what they already generated.

Technology

  • A NestJS API in modules

    Auth, stories, and the core services are separate modules. Auth has a JWT strategy, a JWT guard and a premium guard. Stories has its own controller, service and DTO. Supabase and OpenAI each have a service under core.

  • Supabase for identity and rows

    Users, credits and stories live in Supabase. Row-level security is part of the schema work, so a story is not a public bucket. The profile exposes subscription_tier as free or premium and the story_credits balance.

  • The model is behind the API

    The Flutter app does not call OpenAI itself. It calls POST /api/stories/generate and POST /api/stories/:id/continue. The key, the prompt assembly and the credit check stay on the server.

  • What a story record actually is

    An id, a title, a character name, and pages. A page has a number, the content, an image URL and the image prompt. Listing stories returns the title, the character, the page count and the date, not the whole book.

  • Flutter
  • NestJS
  • TypeScript
  • Supabase
  • GPT-4
  • DALL-E