Brompt is a client-side Single Page Application (SPA) built with Next.js. It focuses on privacy and efficiency, using local storage for data persistence and direct client-to-API communication for AI operations.
- Privacy First: No backend server for data storage. All user data (history, settings, drafts) lives in the browser's
localStorage. - Schema-Driven UI: The form engine dynamically renders components based on JSON schemas generated by the LLM.
- Client-Side Orchestration: The application logic resides entirely in the frontend, orchestrating the flow between the user and the LLM.
- Multi-Provider Support: Supports OpenAI, Anthropic, Gemini, Mistral, and Groq via Vercel AI SDK.
- Framework: Next.js 15 (App Router)
- Language: TypeScript
- Styling: Tailwind CSS
- State Management: React Context + Hooks
- AI Provider: Vercel AI SDK (supporting OpenAI, Anthropic, Gemini, Mistral, Groq)
- Icons: Lucide React
- User Input (Seed): User provides an initial goal (e.g., "I want to write a blog post").
- LLM Processing (Analysis): The app sends this goal to the selected LLM provider.
- Schema Generation: The LLM returns a JSON schema defining the next set of questions (fields).
- Dynamic Rendering:
PromptFormEngineparses the schema and renders appropriate UI components (Text, Select, Slider, etc.). - User Response: User fills out the form.
- Loop: Steps 2-5 repeat for up to 10 rounds or until the user finishes.
- Final Generation: The app sends the entire conversation history to the LLM to generate the final optimized prompt.
src/
├── app/ # Next.js App Router pages
├── components/ # Shared UI components
├── contexts/ # Global state (History, Settings, Toast)
├── features/ # Feature-specific logic
├── lib/ # Utilities & API providers
│ ├── llm/ # Provider Registry & Adapters
│ ├── crypto.ts # Web Crypto helpers (AES‑GCM + PBKDF2)
│ └── storage.ts # LocalStorage wrapper (typed)
├── components/settings/ # Settings subcomponents (ProviderSelect, ApiKeyField, SecuritySection, LanguageSelect)
└── locales/ # i18n JSON files
PromptFormEngine: The heart of the application. Manages the conversation loop, state, and rendering of dynamic fields.SettingsContext+useSettingsController: Global configuration, API keys, provider selection, encryption unlock/reset flows.ProviderRegistry: Defines available LLM providers and models (src/lib/llm/registry.ts).AISDKAdapter: Generic adapter for Vercel AI SDK providers.HistoryContext: Manages persistence of past sessions inlocalStorage.UnlockModal: Blocks UI until the user enters a valid passphrase when encrypted keys are detected.
- API keys are encrypted at rest in
localStorageusing AES‑GCM and PBKDF2 (Web Crypto API). - Passphrase is never persisted; decryption happens in memory at unlock.
- Passphrase changes trigger atomic re‑encryption for all providers to maintain consistency.