Space-Banane f16dbdd8d1 Warn against public exposure (no auth)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-26 15:46:37 +02:00
2026-06-26 15:40:08 +02:00
2026-06-26 15:40:08 +02:00
2026-06-26 15:40:08 +02:00

prompt-gen

A local web app for building and reusing prompt templates. Write a prompt once with {{variable}} placeholders, save it as a preset, then fill in the fields to generate new prompts on demand.

prompt-gen screenshot

Warning

Do not expose this app to the public internet. There is no authentication — anyone who can reach the server can read, modify, and delete your presets, and access your stored OpenAI API key. Run it on localhost or behind a private network/VPN only.

Features

  • Presets — save any number of named templates with descriptions
  • Live variable filling — input fields are generated automatically from {{variable_name}} placeholders in your template
  • AI rewrite — send the filled prompt to GPT for improvement with one click
  • Persistent storage — everything saved to a local settings.json, no database

Quick start (Docker)

docker compose up --build

Open http://localhost:8000.

Data persists in a Docker named volume. To back it up:

docker compose cp app:/app/data/settings.json ./settings.json

Quick start (local dev)

Requirements: Python 3.11+, Node 18+

# Install dependencies
pip install -r requirements.txt
cd frontend && npm install && npm run build && cd ..

# Run
uvicorn backend.main:app --host 127.0.0.1 --port 8001

Open http://localhost:8001.

Hot-reload dev mode

# Terminal 1 — backend
uvicorn backend.main:app --port 8001 --reload

# Terminal 2 — frontend
cd frontend && npm run dev

Frontend dev server runs on http://localhost:5173 and proxies /api to port 8001.

AI rewrite

Click the ⚙ icon and enter your OpenAI API key. The key is stored in settings.json and never sent to the frontend. Once set, the ✦ Rewrite with AI button becomes active in the prompt runner.

The model defaults to gpt-4.1. Override it with the OPENAI_MODEL environment variable:

OPENAI_MODEL=gpt-4o uvicorn backend.main:app --port 8001
# or in docker-compose.yml under environment:

Template syntax

Use {{variable_name}} anywhere in your template. Variable names must start with a letter or underscore and contain only letters, numbers, and underscores.

Resolve {{issue_id}} in {{repo}}. Create the PR as {{author}}.

Duplicate variable names collapse to a single input field. Variables appear in the order they first appear in the template.

Configuration

All settings are stored in settings.json at the project root (or at $SETTINGS_PATH when set).

{
  "openai_api_key": "sk-...",
  "presets": [
    {
      "id": "a1b2c3d4",
      "name": "My template",
      "description": "optional",
      "template": "Resolve {{issue_id}} in {{repo}}.",
      "variables": ["issue_id", "repo"],
      "created_at": "2026-06-26T10:00:00Z",
      "updated_at": "2026-06-26T10:00:00Z"
    }
  ]
}

API

The FastAPI backend exposes a simple REST API at /api.

Method Path Description
GET /api/presets List all presets
POST /api/presets Create a preset
PUT /api/presets/{id} Update a preset
DELETE /api/presets/{id} Delete a preset
GET /api/settings Check if OpenAI key is set
POST /api/settings Save OpenAI API key
POST /api/rewrite Rewrite a prompt with AI

Interactive docs available at http://localhost:8001/docs when running locally.

Stack

  • Frontend — React 18, Tailwind CSS v3, Vite
  • Backend — FastAPI, uvicorn
  • Storagesettings.json (flat file, no database)
S
Description
No description provided
Readme 69 KiB
Languages
JavaScript 72.4%
Python 24.4%
Dockerfile 1.9%
HTML 1.1%
CSS 0.2%