How om280/prompthub works
PromptHub is a web app that turns an idea into a prompt tailored to a selected AI model: users choose a model and complexity, answer relevant clarification questions, generate and refine a prompt, then copy or export it. The graph follows the documented frontend-to-API workflow and the evidenced backend dispatch to the prompt engine and provider abstraction. Some UI handlers and engine internals are unsampled, so those relationships rely on README documentation; provider-specific integrations are represented as optional where appropriate.
Main entry points: App.tsx App workflow · promptEngine/index.js Stage orchestrator · providers/index.js Provider selection · api.js API endpoints
Components 31
Web experience
- App workflow
src/App.tsx - Idea and model
src/components/HomeView.tsx - Clarification
src/components/QuestionsView.tsx - Question controls
src/components/QuestionField.tsx - Prompt workspace
src/components/Workspace.tsx - Quality analysis
src/components/QualityPanel.tsx - History and templates
src/components/Sidebar.tsx - Prompt templates
src/data/templates.ts - Provider settings
src/components/SettingsDrawer.tsx
API boundary
- API client
src/lib/api.ts - HTTP server
server/src/index.js - API endpoints
server/src/routes/api.js - Request validation
server/src/middleware/validate.js - Rate limiting
server/src/middleware/rateLimit.js
Prompt engine
- Stage orchestrator
server/src/promptEngine/index.js - Intent and questions
server/src/promptEngine/analyzer.js - Domain taxonomy
server/src/promptEngine/taxonomy.js - Prompt composition
server/src/promptEngine/composer.js - AI request prompts
server/src/promptEngine/prompts.js - Model guidance
server/src/modelProfiles.js - Improvement analysis
server/src/promptEngine/improver.js - Prompt quality
server/src/promptEngine/quality.js
AI providers
- Provider selection
server/src/providers/index.js - OpenAI adapter
server/src/providers/openai.js - Anthropic adapter
server/src/providers/anthropic.js - Gemini adapter
server/src/providers/gemini.js - Groq adapter
server/src/providers/groq.js - Local engine
server/src/providers/local.js
Client state
- Browser history
src/lib/storage.ts
Other components
- Prompt creator
- AI provider services
Connections 36
- Prompt creator → Idea and model: enters idea
- Idea and model → App workflow: sets choices
src/components/HomeView.tsx - App workflow → API client: requests stages
src/App.tsx - API client → API endpoints: calls API
- App workflow → Clarification: shows questions
src/App.tsx - Clarification → Question controls: renders controls
src/components/QuestionsView.tsx - App workflow → Prompt workspace: shows result
src/App.tsx - Prompt workspace → Quality analysis: renders analysis
src/components/Workspace.tsx - App workflow → History and templates: opens history
src/App.tsx - History and templates → Prompt templates: lists templates
src/components/Sidebar.tsx - App workflow → Browser history: loads history
src/App.tsx - App workflow → Browser history: saves history
src/App.tsx - App workflow → Provider settings: opens settings
src/App.tsx - HTTP server → API endpoints: mounts API
server/src/index.js - API endpoints → Request validation: validates requests
server/src/routes/api.js - API endpoints → Rate limiting: limits requests
server/src/routes/api.js - API endpoints → Stage orchestrator: dispatches stages
server/src/routes/api.js - Stage orchestrator → Intent and questions: analyzes intent
server/src/promptEngine/index.js - Intent and questions → Domain taxonomy: checks domain slots
server/src/promptEngine/analyzer.js - Stage orchestrator → Prompt composition: composes prompt
server/src/promptEngine/index.js - Stage orchestrator → Improvement analysis: analyzes improvements
server/src/promptEngine/index.js - Stage orchestrator → Prompt quality: estimates quality
server/src/promptEngine/index.js - Stage orchestrator → AI request prompts: builds AI requests
server/src/promptEngine/index.js - AI request prompts → Model guidance: uses guidance
server/src/promptEngine/prompts.js - Prompt composition → Model guidance: formats for model
server/src/promptEngine/composer.js - Stage orchestrator → Provider selection: requests completion
server/src/promptEngine/index.js - Provider selection → OpenAI adapter: selects adapter
server/src/providers/index.js - Provider selection → Anthropic adapter: selects adapter
server/src/providers/index.js - Provider selection → Gemini adapter: selects adapter
server/src/providers/index.js - Provider selection → Groq adapter: selects adapter
server/src/providers/index.js - Provider selection → Local engine: falls back
server/src/providers/index.js - OpenAI adapter → AI provider services: sends completion
- Anthropic adapter → AI provider services: sends completion
- Gemini adapter → AI provider services: sends completion
- Groq adapter → AI provider services: sends completion
- Provider settings → API client: loads model details
src/components/SettingsDrawer.tsx