A visual tool for creating structured XML prompts for AI language models. Build complex, well-formatted prompts with an intuitive tree-based interface and keyboard shortcuts.
- Interactive Tree Editor - Visual XML structure builder with hierarchical tag management
- Keyboard Shortcuts - Efficient navigation and editing with hotkeys
- Live Preview - Real-time formatted XML output with syntax highlighting
- One-Click Export - Copy to clipboard or send directly to AI platforms (ChatGPT, Claude, Gemini, etc.)
- Smart Indentation - Context-aware node movement and nesting
- Error Prevention - Built-in validation to prevent invalid XML structures
- Framework: Next.js 15.5.5 (Pages Router) with Turbopack
- UI Library: React 19.1.0 with TypeScript
- Styling: Tailwind CSS v4 + shadcn/ui components
- XML Formatting: xml-formatter
- Keyboard Handling: hotkeys-js
- Component Library: Radix UI primitives
src/
βββ components/
β βββ Editor.tsx # Tree-based XML structure editor
β βββ Preview.tsx # Formatted XML preview with copy/export
β βββ TagInputDialog.tsx # Tag name input modal
β βββ TagContentDialog.tsx # Tag content input modal
β βββ EditDialog.tsx # Node editing modal
β βββ HelpDialog.tsx # Keyboard shortcuts help
β βββ ui/ # shadcn/ui components
βββ hooks/
β βββ useShortcuts.ts # Keyboard shortcut manager
βββ utils/
β βββ xmlFormatter.ts # XML formatting logic
βββ pages/
βββ index.tsx # Main application page
interface XmlNode {
id: string;
type: "tag" | "content";
tagName?: string;
content?: string;
children?: XmlNode[];
}- Node.js 20+
- npm, yarn, pnpm, or bun
# Clone the repository
git clone https://github.com/cyrizon/prompt-builder.git
cd prompt-builder
# Install dependencies
npm install
# Run development server
npm run devOpen http://localhost:3000 to use the app.
npm run buildThis project uses Docker with a standalone Node.js server (no Nginx required in the container).
# Build and start the container
docker-compose up -d
# View logs
docker-compose logs -f
# Stop the container
docker-compose downThe app will be available at http://localhost:3001 (or integrated with your Nginx reverse proxy).
- Image: Node.js 20 Alpine with
servepackage - Port: 3001 (internal)
- Network: Uses default bridge network for integration with existing Nginx
- Health Check: Monitors
/index.htmlavailability
If you have an existing Nginx setup (like in the example), add this to your Nginx configuration:
# Subdomain: https://prompt.yourdomain.com
server {
listen 443 ssl;
server_name prompt.yourdomain.com;
ssl_certificate /etc/nginx/ssl/_.yourdomain.com.cer;
ssl_certificate_key /etc/nginx/ssl/_.yourdomain.com.key;
location / {
proxy_pass http://prompt-builder:3001;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_cache_bypass $http_upgrade;
}
}
# HTTP to HTTPS redirection
server {
listen 80;
server_name prompt.yourdomain.com;
return 301 https://$server_name$request_uri;
}Alternative: Subpath (e.g., https://yourdomain.com/prompt)
# Add to your existing server block
location /prompt {
proxy_pass http://prompt-builder:3001;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_cache_bypass $http_upgrade;
}Then reload Nginx:
docker exec nginx nginx -t
docker exec nginx nginx -s reload| Key | Action |
|---|---|
C |
Create new tag |
E |
Edit selected node |
Del |
Delete selected node |
β / β |
Navigate up/down |
Alt+β / Alt+β |
Move node up/down |
Tab |
Indent node (nest under previous sibling) |
Shift+Tab |
Unindent node (move up one level) |
H |
Show help |
- Create a root tag - Press
Cto create a tag (default:<prompt>) - Add nested tags - Navigate and press
Cto add child tags like<context>,<instructions> - Add content - When creating tags, optionally add text content
- Organize structure - Use
Tab/Shift+Tabto nest/unnest,Alt+β/βto reorder - Export - Copy the formatted XML or send directly to your AI platform
This is an open-source project - feel free to fork, modify, and create your own version!
MIT License - Feel free to use this project for any purpose.
Created by Cyrizon
Built with:
