April 13, 20263-4 weeks

Promptura — Iterative Prompt Optimization System for Multimodal AI

Promptura is an iterative prompt optimization system for multimodal generation models. Instead of making users manually guess the right prompt, it generates candidate prompts from a task goal, runs them against selected models, and uses user feedback to refine the next iteration.

Role
Designed and built the system end-to-end, including product logic, backend architecture, provider abstraction, and AI workflow orchestration.
Stack
Next.js · TypeScript · Prisma · PostgreSQL · NextAuth · Gemini API · fal.ai · EachLabs

Problem

Working with generative models requires repeated trial-and-error, where the same intent produces inconsistent outputs across different models and providers. Users must manually rewrite prompts, deal with provider-specific quirks, and evaluate results without a structured feedback loop, making prompt quality the primary bottleneck.

Solution

Built an iteration-based system that converts prompt engineering into a structured optimization loop. Users define a task goal, the system generates multiple candidate prompts, executes them across selected models, and refines future iterations based on actual outputs. Prompt generation is centralized using Gemini, while execution is handled through provider-agnostic integrations.

Decisions

  • Replaced prompt textbox with iteration-first workflow to reduce user complexity
  • Centralized prompt generation using Gemini instead of provider-side prompting
  • Introduced ModelSpec abstraction to decouple system from provider schemas
  • Chose polling over streaming to reduce system complexity and avoid real-time state synchronization issues
  • Intentionally hid model-specific parameters to prevent provider complexity from leaking into the user experience

Architecture highlights

  • Iteration-based prompt optimization loop replacing manual prompt workflows
  • Provider-agnostic execution layer supporting multiple model providers
  • Schema-driven ModelSpec generation for modality and asset inference
  • Separation of prompt generation (Gemini) and execution (external providers)
  • Persistent iteration and run tracking with observable execution lifecycle
  • Polling-based execution flow for status tracking and reliability

Outcomes

  • Built a working system executing prompts across multiple providers
  • Reduced manual prompt trial-and-error into a structured iteration loop
  • Enabled consistent prompt generation independent of execution provider
  • Established a scalable architecture for adding new models and modalities

Overview

Promptura is built around a simple idea: prompt engineering should not rely on manual guessing.

Instead of asking users to write better prompts, the system focuses on improving outputs through iteration, execution, and feedback.

The product abstracts provider-specific complexity and focuses on outcome-driven iteration.

The Problem

Working with generative models is inherently trial-and-error. The same intent produces different outputs depending on the model, provider, and prompt phrasing.

In practice, this leads to:

  • repeated manual experimentation
  • prompt quality becoming the bottleneck
  • provider-specific behavior leaking into the user experience

Most tools expose a prompt box. That pushes complexity onto the user instead of managing it.

The Solution

Promptura replaces manual prompt writing with an iteration system:

  1. user defines a task goal
  2. system generates multiple candidate prompts
  3. prompts are executed on the selected model
  4. user selects strong outputs and refines

This shifts the interaction from “write the perfect prompt” to “improve results through iteration.”

Prompt generation and refinement are handled centrally using Gemini, while execution is delegated to external providers. This keeps the system consistent while remaining provider-agnostic.

System Flow

Model onboarding

Each model is validated and analyzed before use. A normalized ModelSpec is generated, describing:

  • modality
  • required assets
  • prompt constraints
  • execution behavior

This removes direct dependency on raw provider schemas.

Iteration

A user provides:

  • task goal
  • selected model
  • required assets

The system validates inputs, creates an iteration, generates prompt candidates, and executes them.

Execution tracking

Each prompt is executed as a separate run. The system tracks:

  • queued / running / completed states
  • outputs and errors

This makes execution observable instead of opaque.

Refinement

Users select successful outputs and provide feedback. The system uses this signal to generate improved prompts for the next iteration.

This creates a feedback-driven loop instead of random exploration.

Architecture

Promptura is built as a full-stack system with clear separation between:

  • model research
  • prompt generation
  • execution providers
  • product logic

Execution Providers

The system integrates with multiple execution providers (such as fal.ai and EachLabs) through a unified abstraction layer. This allows the same iteration workflow to run across different model ecosystems without changing the product logic.

Core stack

  • Next.js (App Router)
  • TypeScript
  • Prisma + PostgreSQL
  • NextAuth (Google OAuth)
  • Gemini (prompt generation & research)

Core entities

  • ModelEndpoint
  • ModelSpec
  • ResearchJob
  • Iteration
  • Run
  • UserProviderKey
  • RateLimitBucket

These entities represent the full lifecycle of model onboarding, execution, and iteration.

Key Decisions

Iteration-first design

The system does not expose a traditional prompt input as the primary interaction. Prompting is treated as an optimization process.

Provider abstraction

Execution is handled through a unified interface across providers. This prevents provider-specific logic from leaking into the core system.

Schema-driven model understanding

Model capabilities and requirements are inferred from schemas and normalized into a consistent structure.

Centralized prompt generation

Prompt authoring is handled by a single system (Gemini), ensuring consistency across models and workflows.

Scope

The system supports multimodal workflows, primarily:

  • text-to-image
  • image-to-image
  • text-to-video

The architecture is designed to extend to additional modalities without changing the core iteration model.

Outcome

Promptura turns prompt engineering into a structured, repeatable system. Instead of manually searching for the right prompt, users iterate toward better outputs through controlled feedback loops.

The result is a system that combines product design, backend architecture, and AI workflow orchestration into a single operational platform.

Related projects