Karbon is a desktop app that uses AI to generate and iteratively refine HTML/CSS/JS websites from simple prompts. Built with Python and Tkinter, it provides a live preview and export functionality.
- π€ Prompt-based website generation using AI
- π οΈ Iterative prompt-based updates to the code
- πΌοΈ Live preview in a browser window
- π€ Export final code to HTML/CSS/JS files
- ποΈ Simple and intuitive Tkinter GUI
git clone https://github.com/prakhardoneria/karbon.git
cd karbon
pip install -r requirements.txt
python main.py
The app window will launch, allowing you to enter a prompt to generate your first website layout.
karbon/
βββ main.py # Main application entry point
βββ ui.py # Legacy UI entry point (deprecated)
βββ contributors_page.py # Contributors page UI
βββ code_editor_ui.py # Code editor interface
βββ
βββ core/ # Core functionality
β βββ ai_engine.py # AI generation engine
β βββ token_manager.py # API token management
β βββ prompt_history.py # Prompt history management
β βββ prompt_drafts_system.py # Draft system
β
βββ ui_items/ # UI components
β βββ karbon_ui.py # Main UI controller
β βββ prompt_view.py # Prompt input interface
β βββ editor_view.py # Code editor view
β βββ contributors_view.py # Contributors display
β βββ token_manager_view.py # Token management UI
β
βββ exporters/ # Export functionality
β βββ exporter.py # General export functions
β βββ github_exporter.py # GitHub export
β βββ repo_pusher.py # Repository management
β
βββ utils/ # Utility functions
β βββ preview.py # Preview functionality
β βββ project_io.py # Project I/O operations
β
βββ tests/ # Test suite
β βββ test_dummy.py # Basic tests
β
βββ assets/ # Static assets
βββ docs/ # Documentation
βββ requirements.txt # Python dependencies
Use PyInstaller to create a standalone .exe
:
pyinstaller ui.py --onefile --noconsole --name Karbon --icon=icon.ico
The built executable will appear in the dist/
folder.
On push to the main
branch, GitHub Actions will:
- Build
Karbon.exe
using PyInstaller - Create a GitHub release with the
.exe
attached
See .github/workflows/build-karbon.yml
for details.
karbon/
βββ ui.py # Main UI launcher
βββ ai_engine.py # Handles AI code generation
βββ exporter.py # Exports final code to files
βββ preview.py # Opens code in browser preview
βββ ui_items/ # Modularized UI components
β βββ __init__.py
β βββ prompt_view.py
β βββ editor_view.py
β βββ karbon_ui.py
βββ requirements.txt
βββ .gitignore
βββ README.md
Here are some example prompts you can try in Karbon, along with typical outputs:
Output: Generates a login page which takes user's Username and Password as input for Login.
Output: Generates HTML/CSS with an About Me, My projects and Get in Touch.
Output: Renders a landing page layout with Pricing Plans, and What Our Users Say.
Output: Creates a dark-themed homepage with navbar having Home, About, Contact and features articles with images.
πΉ Prompt: βGenerate a simple form to collect name, email, and message withΒ aΒ submitΒ buttonβ
Output: Creates a form with labeled input fields and a submit button, styled using CSS.
The following diagram illustrates Karbon's high-level architecture.
It shows how user input flows from the GUI to the AI engine and how the generated code is previewed and exported.
This structure makes the project modular, easier to maintain, and simple to extend.
Pull requests are welcome! To contribute:
- Fork the repo
- Create a feature branch (
git checkout -b feature/new-feature
) - Commit your changes (
git commit -m 'Add feature'
) - Push to the branch (
git push origin feature/new-feature
) - Open a pull request
GNU General Public License v3.0. See LICENSE
file for details.