story-generator / README.md

AI Story Generator

Story generator: an app that creates a personalized story with AI

Last updated: 4/16/2026GitHub

AI Story Generator

This project is a full-stack AI-driven application that generates customized stories in video format. Users provide story prompts, character details, genre, image style, and narrator voice, and the application generates the content, images, voiceovers, and subtitles for each scene, compiles them, and outputs a complete video.

Figma Design

You can view the Figma design for the project here.

Features

  • Customized Story Generation: User inputs control the story content, genre, style, and narration.
  • Automated Content Creation: AI generates story text, images, audio narration, and subtitles for each scene.
  • Video Compilation: Compiles the generated components into a video and adds the Rihal logo.
  • Admin Monitoring: Includes a Streamlit-based admin panel for real-time monitoring of logs, stories, and auditing.
  • High Concurrency: Celery tasks and RabbitMQ are used to handle high volumes of requests, and to manage and respect the rate limits of the APIs.

image image

Project Structure

.
├── data                          # Story data, logs, and media files while generating the story
├── docker-compose.yml            # Docker Compose file for production
├── docker-compose.stage.yaml     # Docker Compose file for staging
├── portainer-stack.dev.yaml      # Docker Compose configuration for Portainer
├── server                        # Backend code for API and task processing
│   ├── admin_control             # Streamlit admin interface
│   ├── ai_suggestion             # AI suggestion module
│   ├── audio_consumers           # Audio processing with RabbitMQ and Eleven Labs API
│   ├── gallery_display           # Module for gallery content display
│   ├── get_story                 # Module to fetch story details
│   ├── main.py                   # Main FastAPI application entry point
│   ├── story_generation          # Story content generation modules
│   └── video_compiling           # Video processing and compilation
└── web                           # Frontend code with TypeScript, Vite, and React
    ├── nginx                     # NGINX configuration
    ├── public                    # Public assets
    └── src                       # Source code for React frontend

Technology Stack

Frontend

  • Framework: TypeScript with Vite for fast development and build processes.
  • API Communication: Axios for REST API requests.
  • Structure: All frontend code is located in the web folder.

Backend

  • Framework: Python with FastAPI for creating APIs and handling requests.
  • Task Management: Celery with RabbitMQ for queuing story generation and media processing tasks.
  • Media Processing: MoviePy, OpenCV, and FFmpeg for compiling video and audio components.
  • Structure: All backend code is located in the server folder.
  • Package Management: Poetry is used for managing dependencies.

Databases

  • PostgreSQL: Stores story data, configurations, and user options.
  • MinIO: Used as object storage for media files, including story videos and images.

Caching & Queuing

  • Redis: Used as a built-in feature of FastAPI for caching and IP rate-limiting purposes. NGINX is also used to limit requests from IPs.
  • RabbitMQ: Manages queues for audio and video tasks, supporting high concurrency and managing request limits.

Architecture and Workflow

  1. User Input: The user provides prompts, genre, voice, and other customization options.
  2. Content Generation:
    • Story Text: Generates the main content of the story.
    • Character Description: Provides details about characters based on user input.
    • Scene Prompts: Generates text prompts for each scene.
  3. Audio Generation: Uses Eleven Labs with rate limits to generate audio files for narration.
  4. Image Generation: Creates images for each scene based on the selected model (DALL-E or Imagen3 or Flux for failed generations).
  5. Video Compilation: Assembles scenes, narration, and subtitles into a final video file.
  6. Storage & Retrieval:
    • Media Files: Stored in MinIO for retrieval.
    • Story Metadata: Stored in PostgreSQL.
  7. Admin Control Panel: Accessible via Streamlit for monitoring and managing story generation logs and data.

Here is an illustration of the core structure of the story generation process image

Setup

  1. Clone the Repository:
    git clone git@github.com:rihal-om/story-generator.git
    cd story-generator
    
  2. For development:
    docker compose up -d --build
    
  3. For staging:
    docker compose up -d --build -f docker-compose.stage.yaml