Files
claudemesh/.context/turbostarter-framework-context/sections/ai/docs/image.md
Alejandro Gutiérrez d3163a5bff feat(db): mesh data model — meshes, members, invites, audit log
- pgSchema "mesh" with 4 tables isolating the peer mesh domain
- Enums: visibility, transport, tier, role
- audit_log is metadata-only (E2E encryption enforced at broker/client)
- Cascade on mesh delete, soft-delete via archivedAt/revokedAt

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 21:19:32 +01:00

5.3 KiB

title, description, url
title description url
Image Generation Learn how to generate images using AI models within the TurboStarter AI demo application. /ai/docs/image

Image Generation

The Image Generation demo application allows users to create unique visuals from textual descriptions using various AI models. It provides a simple interface to input prompts, select models, and view generated images.

Features

Explore the capabilities of the AI-powered image generation tool:

Create images simply by describing what you want to see in text. Choose from different AI image generation models offered by various providers. Select the desired aspect ratio for your generated images (e.g. square, landscape, portrait). Create multiple design variations from a single prompt simultaneously, accelerating your creative workflow. Access and reference your complete generation history, including all prompts and resulting images for continued iteration.

Setup

To implement image generation in your application, you'll need to configure the necessary backend services.

You'll also need API keys for your preferred AI models. Follow the detailed setup instructions in the provider documentation linked below.

AI models

The Image Generation app leverages the AI SDK to support various models capable of creating images from text. Configure the providers for the models you wish to use:

} />

<Card href="/ai/docs/replicate" title="Replicate" description="Access a diverse ecosystem of open-source models including Stable Diffusion variants." icon={} />

For detailed implementation guidance, refer to the AI SDK documentation covering the generateImage function and supported providers.

Data persistence

Details about image generation requests and the resulting images are stored to maintain user history.

Data is organized within a dedicated PostgreSQL schema named image:

  • generations: captures detailed information about each generation request, including the prompt, selected model, aspectRatio, requested image count, userId, and precise timestamps.
  • images: stores complete metadata for each generated image, linked to its parent generation record via generationId and maintaining the url reference to the stored image file.

The generated image files are securely stored in cloud storage (S3-compatible). Each image's location is tracked via the url field in the images table for reliable retrieval.

Structure

The Image Generation feature is architected across the monorepo for optimal code organization and reusability.

Core

The @turbostarter/ai package (packages/ai) contains the essential logic under modules/image:

  • Comprehensive types, validation schemas (for prompts, aspect ratios, etc.), and constants
  • Core API logic for processing image generation requests and interfacing with AI models
  • Database operations for recording generation details and image metadata
  • Utilities for uploading generated images to cloud storage

API

The packages/api package defines the backend API endpoints using Hono:

  • src/modules/ai/image/image.router.ts: implements Hono RPC routes for image generation, handles input validation, applies necessary middleware (authentication, credit management), and invokes the core logic from @turbostarter/ai.

Web

The Next.js application (apps/web) delivers an intuitive user interface:

  • src/app/[locale]/(apps)/image/**: contains the Next.js App Router pages and layouts for the image generation experience
  • src/components/image/**: houses reusable React components tailored to the image generation UI (prompt input, model selector, image gallery, etc.)

Mobile

The Expo/React Native application (apps/mobile) provides a native mobile experience:

  • src/app/image/**: defines the screens for the mobile image generation interface
  • src/components/image/**: contains React Native components optimized for mobile interaction
  • API integration: utilizes the same Hono RPC client (packages/api) as the web app for consistent backend communication

This architecture ensures perfect consistency across platforms while enabling tailored UI implementations optimized for each environment.