A web application that generates HTML and CSS code from text prompts using AI. It features a file explorer, code editor, and live preview. It also includes a React Builder that can create React applications using LangChain's shell agent.
- Generate HTML and CSS from text prompts
- Edit code directly in the browser
- Live preview of generated websites
- AI-powered code modifications using Groq API
- Workspace management for multiple projects
- Create React applications with an intelligent shell agent
- Add React components with natural language descriptions
- Modify React files with AI assistance
├── backend/
│ ├── app/
│ │ ├── agents/ # LangChain agents
│ │ ├── models/ # Pydantic models
│ │ ├── routers/ # API endpoints
│ │ └── main.py # FastAPI application
│ ├── workspaces/ # Generated code workspaces
│ └── requirements.txt # Python dependencies
├── frontend/
│ ├── css/
│ │ ├── styles.css # Main application styles
│ │ ├── split-pane.css # Resizable panel styles
│ │ ├── modal.css # Modal styles
│ │ └── react-agent.css # React agent UI styles
│ ├── js/
│ │ ├── app.js # Main application logic
│ │ ├── editor.js # Code editor functionality
│ │ ├── preview.js # Live preview functionality
│ │ ├── file-explorer.js # File explorer functionality
│ │ ├── modal.js # Welcome modal functionality
│ │ └── react-agent.js # React builder functionality
│ └── index.html # Main HTML file
└── README.md # This file
-
Install Python 3.8+ if not already installed
-
Navigate to the backend directory:
cd backend -
Install dependencies:
pip install -r requirements.txt -
Create a
.envfile with your Groq API key:GROQ_API_KEY=your_groq_api_key_hereYou must get an API key from Groq's website: https://console.groq.com/keys
-
Start the backend server:
uvicorn app.main:app --reload
If using Python 3.12, you might encounter some compatibility issues. In that case:
- Use Python 3.10 or 3.11 instead
- Or create a virtual environment to install dependencies in an isolated environment:
python -m venv venv venv\Scripts\activate # Windows source venv/bin/activate # Linux/Mac pip install -r requirements.txt
-
Open a new terminal
-
Serve the frontend directory using any static file server. For example, using Python's built-in server:
cd frontend python -m http.server 3000Or using Node.js with
http-server:npm install -g http-server cd frontend http-server -p 3000 -
Open your browser and navigate to:
http://localhost:3000
- Enter a workspace name in the top-right input field
- Enter a prompt in the bottom text area describing what you want to create
- Click "Generate New" to create a new project
- Edit the generated files in the code editor
- Use the "Update Current File" button to modify the code with AI assistance
- View the live preview on the right panel
- Save changes with the Save button
- Click on the "React Builder" tab at the top of the page
- Use the following panels to create and manage React applications:
- Create New React Project: Create a new React app in a workspace with optional TypeScript support
- Add Component: Add new React components to an existing project
- Modify File: Update any file in a React project with natural language instructions
- Custom Task: Perform custom tasks within a React project workspace
The application uses a LangChain agent to interact with the system shell for creating and modifying React applications. This agent can:
- Create new React applications using
create-react-app - Install npm packages
- Create functional React components based on descriptions
- Modify existing React files
- Execute custom shell commands when needed
The agent is powered by the Groq LLM for intelligent decision-making and leverages LangChain's toolkit architecture with custom React-specific tools.
This application uses the Groq API for generating and modifying code. Groq offers high-performance language models with very low latency. The application uses the "llama3-8b-8192" model by default, but you can change this to other available models like "mixtral-8x7b-32768" by editing the GROQ_MODEL variable in backend/app/routers/generation.py.
-
Backend:
- FastAPI
- Python 3.8+
- Groq API for code generation
- LangChain for agent-based operations
-
Frontend:
- HTML/CSS/JavaScript
- CodeMirror editor
- Split.js for resizable panels
- Font Awesome for icons