Revolutionary AI-Powered Visual React Component Editor
Screen.Recording.2025-08-26.at.12.mp4
- Natural Language to Code: Describe any component in plain English and watch it come to life
- Google Gemini Integration: Powered by Google's latest Gemini 1.5-flash model for high-quality code generation
- Context-Aware: AI understands modern React patterns, Tailwind CSS, and responsive design
- Real-time Syntax Analysis: Advanced Babel-based parsing for instant component understanding
- Multi-attribute Matching: Sophisticated element identification using signatures, classes, and positioning
- Smart Text Replacement: Precise content updates with fallback strategies
- Click-to-Edit: Simply click on any element in the preview to start editing
- Real-time Preview: See changes instantly with split-pane editor and live preview
- Property Panel: Comprehensive editing controls for text, colors, fonts, and styles
- Beautiful Gradients: Stunning visual design with animated backgrounds and smooth transitions
- Responsive Design: Works perfectly on desktop and mobile devices
- Dark/Light Themes: Adaptive theming for comfortable coding in any environment
- Isolated Sandbox: Safe component rendering in iframe with full React support
- Interactive Elements: Hover effects and click handlers for intuitive interaction
- Error Handling: Graceful error display with helpful debugging information
- Monaco Editor: Professional code editing with syntax highlighting and IntelliSense
- Real-time Sync: Seamless synchronization between code and visual changes
- Read-only Mode: Safe viewing of components with full functionality
- Cloud Storage: Save and manage components with MongoDB integration
- User Authentication: Secure user accounts with Clerk authentication
- Version Control: Track changes and component history
- Dynamic Imports: Lazy loading for optimal bundle size
- Efficient Rendering: Optimized React components with proper memoization
- Fast AI Responses: Optimized API calls with proper error handling
- Node.js 18+
- MongoDB database
- Google Gemini API key
- Clone the repository
git clone <repository-url>
cd compcraft- Install dependencies
npm install- Set up environment variables
# Create .env.local file
cp .env.example .env.local
# Add your keys
GEMINI_API_KEY=your_gemini_api_key
MONGODB_URI=your_mongodb_uri
CLERK_SECRET_KEY=your_clerk_secret- Run the development server
npm run dev- Navigate to the editor (
/editor) - Click the AI button (β¨) in the code editor
- Describe your component: "Create a beautiful pricing card with gradient background and hover effects"
- Watch as AI generates production-ready React code
- Edit visually by clicking elements in the preview
- Paste your existing React component code
- Click Preview to see it rendered
- Click on any element to edit its properties
- Use the property panel for fine-tuned control
- Save your component to the cloud
- Select Element: Click any element in the live preview
- Edit Properties: Use the property panel to modify text, colors, fonts
- Real-time Updates: See changes instantly reflected in the preview
- Code Sync: All visual changes are automatically synced to the code
compcraft/
βββ app/ # Next.js app router
β βββ api/ # API routes
β β βββ ai/ # AI component generation
β β βββ component/ # Component CRUD operations
β βββ dashboard/ # User dashboard
β βββ editor/ # Main visual editor
β βββ preview/ # Component preview pages
βββ components/ # React components
β βββ CodeEditor.tsx # Monaco code editor
β βββ ComponentEditor.tsx # Main editor interface
β βββ Preview.tsx # Live component preview
β βββ PropertyPanel.tsx # Visual property editor
βββ lib/ # Utility functions
β βββ codeParser.ts # Code parsing and manipulation
β βββ mongodb.ts # Database connection
βββ types/ # TypeScript definitions
- Next.js 15: App router with server components
- TypeScript: Full type safety throughout
- Tailwind CSS: Utility-first styling
- Clerk: Authentication and user management
- API Routes: Serverless functions for AI and CRUD operations
- MongoDB: Document database for component storage
- Mongoose: ODM for data modeling
- Google Gemini 1.5-flash: Latest AI model for code generation
- Prompt Engineering: Carefully crafted prompts for consistent results
- Error Handling: Robust error handling for API failures
- Easily customizable color schemes
- Configurable gradients and animations
- Extensible component library
- Modify AI generation prompts in
/api/ai/route.ts - Add new component templates
- Customize code generation rules
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Google Gemini: For powering the AI component generation
- Next.js Team: For the incredible React framework
- Tailwind CSS: For the utility-first CSS framework
- Monaco Editor: For the professional code editing experience
For support, email support@compcraft.dev or join our Discord community.
Made with β€οΈ for developers who want to build beautiful components faster