Transform your OpenAPI Specifications into Production-Ready UI components instantly.
Code2UI is an intelligent, AI-powered development tool designed to radically accelerate the frontend development lifecycle. By analyzing your OpenAPI/Swagger specifications, architectural diagrams, and requirement documents, it generates fully functional, aesthetically premium Vue.js 3 components using the latest Mistral LLM technology.
In modern software development, a significant bottleneck exists in the "hand-off" between backend and frontend engineering:
- Duplicate Effort: Backend engineers define data structures in APIs, and frontend engineers manually recreate these same structures in UI forms and tables.
- Stale Integration: Frontend code often drifts from the backend spec (API) as the project evolves, leading to runtime errors and "it works on my machine" bugs.
- Boilerplate Fatigue: Writing the same CRUD (Create, Read, Update, Delete) interfaces for every new entity is tedious, time-consuming, and prone to copy-paste errors.
- Design Inconsistency: Without a strict design system enforcement, rapid prototyping often results in "Frankenstein" UIs that look different across various modules.
Code2UI acts as an AI-driven bridge that automates the translation of technical specifications into working user interfaces.
It doesn't just "guess" what the UI should look like; it deterministically parses your OpenAPI 3.0+ specs to understand:
- Data Types: Automatically generating correct form inputs (e.g., date pickers for
format: date, toggles fortype: boolean). - Validation Rules: Enforcing backend constraints (e.g.,
maxLength,required) directly in the frontend code. - Relationships: Understanding nested objects to create sub-forms or detailed views.
Why Code2UI?
- For Backend Developers: Visualize your API immediately. Test your endpoints with a real UI, not just curl commands.
- For Frontend Developers: Skip the boilerplate. Get a 80% complete Vue.js component that handles loading states, error handling, and types—so you can focus on the complex business logic and polish.
- For Architects: Ensure adherence to design patterns by supplying "Context Diagrams" that the AI uses to structure the generated application.
- ⚡ Instant UI Generation: Upload your
openapi.jsonorswagger.yamland get ready-to-use Vue components in seconds. - 🧠 AI-Powered Architecture: Uses Mistral AI with advanced Chain-of-Thought prompting to understand not just the schema, but the intent of your API.
- 🎨 Premium Aesthetics: Generated UIs are styled with Bootstrap 5 and custom "Pro" CSS (Glassmorphism, Gradients, Dark Mode) out of the box.
- 📁 Context-Aware: Drag & drop architectural diagrams and text requirements to give the AI context about your design system and business logic.
- 🛡️ Robust Validation: Integrated Pydantic validation ensures generated code is syntactically correct and structurally sound.
- 🔒 Secure & Private: Designed to run locally or self-hosted, keeping your API specs private.
Code2UI operates on a modern, decoupled architecture:
- Framework: Vue.js 3 (Composition API)
- Build Tool: Vite
- Styling: Bootstrap 5 + Custom CSS Variables (Dark Theme)
- Features:
- Modern Glassmorphism Design
- Drag-and-Drop File Uploads
- Real-time Code Highlighting & Preview
- Framework: FastAPI (Python 3.9+)
- AI Engine: Mistral AI (via API or Local Weights)
- Validation: Pydantic models for structured JSON output
- Orchestration: Custom Prompt Engineering with Few-Shot examples
- Node.js (v18+)
- Python (v3.9+)
- Mistral API Key (Optional for mock mode, required for live generation)
-
Clone the Repository
git clone https://github.com/your-username/code2ui.git cd code2ui -
Setup Backend
cd backend pip install -r requirements.txt # Set your Mistral API Key (Optional) # export MISTRAL_API_KEY=your_key_here # Run the server python -m uvicorn main:app --reload
The backend will start at
http://localhost:8000. -
Setup Frontend Open a new terminal:
cd vue-project npm install npm run devThe frontend will launch at
http://localhost:5173.
- Navigate to the Web App: Open
http://localhost:5173in your browser. - Name Your Project: Enter a name for your generated dashboard context.
- Upload OpenAPI Spec:
- Click "Upload File" to select your
openapi.json/swagger.yaml. - Or enter a URL to import it directly.
- Click "Upload File" to select your
- Add Context (Optional):
- Drag architectural diagrams into the "Architecture Diagrams" zone.
- Drop requirements text files into the "Requirements / Docs" zone.
- Generate: Click Start Generating.
- Review & Export: The AI will generate Vue components. You can view the code, copy it to your clipboard, and drop it directly into your codebase.
Create a .env file in the backend directory:
MISTRAL_API_KEY=your_actual_api_key_here
CHROMA_DB_PATH=./chroma_dbYou can tweak the system prompts in backend/prompts/system_prompts.py to adjust:
- Coding Style: Prefer Tailwind over Bootstrap? Edit the "Golden Example".
- Tone: Make error messages friendlier or more technical.
Contributions are welcome! Please read our Contributing Guide for details on our code of conduct and the process for submitting pull requests.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Distributed under the MIT License. See LICENSE for more information.
Project Link: https://github.com/your-username/code2ui