How o-k1ng0/promptalloy works
Purpose and Runtime
PromptAlloy is a local Flask application that turns a free-form project idea into an LLM-ready implementation blueprint. It runs via app.py, serves browser pages from templates/, and uses vanilla browser JavaScript under static/js/. Python dependencies and environment-driven provider settings are defined in requirements.txt and .env.example.
HTTP Application and UI Entry Points
app.py is the backend entry point and central orchestration boundary: it serves the wizard, session detail, and history views; validates requests; calls LLM providers; and persists generated output. The primary UI routes are represented by:
• templates/index.html — three-stage idea, clarification, and blueprint workflow.
• templates/session.html — generated blueprint/session view and export actions.
• templates/history.html — persisted-session listing.
Blueprint Generation Pipeline
The principal control flow is: user description → local validation → LLM-generated clarification questions → optional per-question AI answers → final blueprint generation → session persistence and display. Backend prompt construction and provider invocation reside in app.py; browser workflow state and API calls are coordinated by static/js/script.js. The application intentionally produces textual implementation instructions rather than generated source code.
LLM Provider Boundary
The backend is provider-agnostic at the OpenAI-compatible chat/completions boundary. It reads API key, endpoint URL, model, and provider identity from environment configuration, allowing OpenRouter, OpenAI, Groq, NVIDIA NIM, Together AI, or local Ollama endpoints. app.py also supports Gemini as a fallback path when the primary provider fails. .env.example is the deploy-time configuration contract; no provider credentials belong in application state.
Client-Side Workflow and Export
The main wizard behavior—including idea submission, clarification rendering, answer generation, and final generation—is implemented in static/js/script.js. Generated sessions support browser-side copy and downloads in Markdown, text, and JSON through static/js/session.js. Presentation is server-rendered HTML with a shared static visual layer in static/css/style.css; there is no separate frontend build runtime.
Persistence and History
Generated blueprint sessions are stored as file-based JSON rather than in a database. data/history.json is the durable local history artifact, managed by backend logic in app.py. History retrieval, display, and clearing interactions are handled in templates/history.html and static/js/history.js. This makes persistence single-instance/local-filesystem scoped and is the main operational boundary for concurrent or multi-host deployment considerations.
Material Architecture Constraints
The application requires Python 3.10+, Flask, outbound access to the selected LLM endpoint (unless using local Ollama), and writable access to data/. It is a server-rendered local web app with browser-to-Flask requests and Flask-to-LLM-provider requests; the browser does not directly hold provider credentials.
Main entry points: app.py Flask application · session.html Session detail · index.html Blueprint wizard · history.html History page
Components 16
Browser UI
Server-rendered pages and vanilla JavaScript workflows.
- Blueprint wizard · Three-stage idea, clarification, and blueprint workflow.
templates/index.html - Session detail · Displays a generated blueprint and export controls.
templates/session.html - History page · Lists persisted sessions and supports clearing history.
templates/history.html - Wizard workflow · Coordinates submissions, clarifications, AI answers, and final generation.
static/js/script.js - Session export · Copies and downloads Markdown, text, and JSON.
static/js/session.js - History interactions · Retrieves and clears persisted session history.
static/js/history.js - Shared visual layer
static/css/style.css
Flask Backend
Local orchestration and provider boundary.
- Flask application · Serves views, APIs, generation, and persistence.
app.py - Request validation · Validates idea and clarification inputs before generation.
app.py - Prompt & blueprint generation · Builds prompts for clarifications, answers, and final blueprint text.
app.py - LLM provider client · Uses OpenAI-compatible chat completions with Gemini fallback.
app.py - Session persistence · Reads, writes, lists, and clears generated sessions.
app.py
External Services & Storage
Environment-configured LLM access and local persistence.
- Provider environment config · Defines provider identity, endpoint, model, and API key settings.
.env.example - Configured LLM endpoint · Remote provider or local Ollama endpoint.
- Local session history · Single-instance durable blueprint-session store.
data/history.json - Python dependencies · Defines Flask and required Python packages.
requirements.txt
Connections 20
- Blueprint wizard → Wizard workflow: loads
- Session detail → Session export: loads
- History page → History interactions: loads
- Blueprint wizard → Shared visual layer: styled by
- Session detail → Shared visual layer: styled by
- History page → Shared visual layer: styled by
- Wizard workflow → Flask application: wizard requests
- Session export → Session detail: exports displayed session
- History interactions → Flask application: history requests
- Flask application → Blueprint wizard: renders
- Flask application → Session detail: renders
- Flask application → History page: renders
- Flask application → Request validation: validates through
- Request validation → Prompt & blueprint generation: accepted input
- Prompt & blueprint generation → LLM provider client: invokes
- LLM provider client → Configured LLM endpoint: chat completions
- Provider environment config → LLM provider client: configures
- Prompt & blueprint generation → Session persistence: stores final blueprint
- Session persistence → Local session history: reads and writes
- Python dependencies → Flask application: provides runtime