A tiny Node + Express web app that proxies the OpenRouter chat completions API to turn natural language prompts into installable WordPress plugins. Keep everything local, drop in any OpenRouter model, and grab the generated PHP instantly.
- Single endpoint –
/api/generateaccepts an API key, OpenRouter model name, and plugin description. - Static UI – vanilla HTML + CSS + JS (no build step) with copy + download helpers.
- Prompt template – edit
templates/prompt-template.txtto tweak the system instructions. - Preset library – curated beginner-to-expert prompt presets surfaced directly in the UI.
- Minimal dependencies – just Express and node-fetch.
- Node.js 18+ (for native
fetch, AbortController, and modern JS features) - An OpenRouter API key: https://openrouter.ai/keys
The UI lets you paste a key per request, but the server also checks OPENROUTER_API_KEY if you prefer to keep the key on the backend:
set OPENROUTER_API_KEY=sk-or-v1-your-key(Use export on macOS/Linux shells.)
You can optionally change the default model by editing public/index.html (the input pre-fills openrouter/auto).
npm install
npm startNavigate to http://localhost:3000 and open the UI.
- Paste your OpenRouter API key (or leave blank if the server already has
OPENROUTER_API_KEY). - Choose any model ID available to your account.
- Optionally pick a preset scenario from the dropdown to auto-fill the description with a vetted, elegant brief.
- Describe (or refine) the WordPress plugin you want in plain English.
- Hit Generate. The result pane will show the PHP code; you can copy or download it.
- Place the downloaded file inside
wp-content/plugins/<your-plugin>and activate it from the WP admin dashboard.
- Definitions live in
public/data/prompt-presets.json. Each entry includes an ID, title, level, summary, and thoughtfully worded prompt. - Add or edit entries to tailor the generator toward your team’s workflows—just keep the JSON array sorted and the prose actionable.
- The bundled set now spans beginner helpers through suite-wide expert briefs (licensing hubs, conflict radar, observability buses, etc.) and is grouped into labeled optgroups inside the dropdown for quick scanning.
- The frontend fetches this file at runtime; no rebuild required. If you remove the file, the UI falls back to manual descriptions.
- Requests >512 KB are rejected by Express.
- Each OpenRouter call times out after 60 seconds to avoid hanging connections.
- Errors from OpenRouter are surfaced directly so you can adjust your prompt or quota.