Transform whiteboard photos, hand-drawn sketches, and plain-English descriptions into production-ready Mermaid and PlantUML diagram code β instantly.
β‘ Try it live β no signup, no credit card, no install. Upload a whiteboard photo or type a description and watch it generate Mermaid + PlantUML code in seconds.
| πΈ Upload a Photo | βοΈ Describe in Text | π¬ Chat to Refine |
|---|---|---|
| Drop any whiteboard, napkin sketch, or diagram screenshot | Type what you need in plain English β no diagram knowledge required | Ask the AI to modify, convert, or extend β it remembers context |
| Gemini Vision extracts every element and relationship | LLM understands your intent and generates clean code | Code updates live in the result panel as you chat |
| RAG pipeline retrieves exact syntax rules from official docs before every generation β no invented syntax, ever | ||
| Output: Valid Mermaid + PlantUML code with live whiteboard-style preview | ||
|
|
|
|
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β BROWSER β Vercel CDN β
β β
β ββββββββββββββββββββββββ βββββββββββββββββββββββββββββββββ β
β β Upload Panel β β Result Panel β β
β β β β β β
β β Image Drop Zone β β Live Mermaid Preview β β
β β Text Prompt β β (dot-grid whiteboard theme) β β
β β Type + Format Select β β β β
β β Generate Button β β Editable Code Editor β β
β β β β (800ms debounce preview) β β
β β AI Chat Panel β β β β
β β (localStorage mem) β β Elements Inspector β β
β ββββββββββββ¬βββββββββββββ βββββββββββββββββββββββββββββββββ β
β β React 18 + Vite 5 + Tailwind CSS β
βββββββββββββββͺβββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
β REST βββ POST /api/analyze
β SSE βββ POST /api/chat (streaming tokens)
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β FASTAPI BACKEND β Render β
β β
β /api/analyze /api/chat β
β β β β
β βΌ βΌ β
β Vision Service stream_chat_with_context() β
β Gemini 2.5 β 2.0 β 1.5 System prompt includes: β
β β OpenRouter vision x3 current code + image β
β + chat history + syntax rules β
β β β β
β ββββββββββββββ¬βββββββββββββββββββββ β
β βΌ β
β RAG Service (Singleton) β
β ChromaDB in-memory β 6 collections β
β mermaid_flowchart mermaid_sequence β
β mermaid_class mermaid_er β
β plantuml_class plantuml_sequence β
β gemini-embedding-001 β cosine similarity search β
β Top-k syntax chunks injected into LLM prompt β
β β β
β βΌ β
β Code Generation (Fallback Chain) β
β Groq LLaMA 3.3 70B β
β β DeepSeek R1 free β
β β LLaMA 3.3 70B free β
β β Mistral 7B free β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| Layer | Technology | Version | Purpose |
|---|---|---|---|
| Framework | FastAPI | Latest | REST API + SSE streaming |
| Vision AI | Google Gemini | gemini-2.5-flash |
Primary image analysis |
| Embeddings | Google Gemini | gemini-embedding-001 |
RAG vector embeddings |
| Text Generation | Groq | llama-3.3-70b-versatile |
Primary code generation |
| Fallback | OpenRouter | Multiple free models | Vision + text fallback chain |
| Vector DB | ChromaDB | Latest | In-memory RAG β 6 collections |
| Runtime | Python | 3.11+ |
| Layer | Technology | Version | Purpose |
|---|---|---|---|
| UI Framework | React | 18 | Component-based UI |
| Build Tool | Vite | 5 | Dev server + production build |
| Styling | Tailwind CSS | 3.4 | Utility-first CSS |
| Diagram Render | Mermaid.js | 10.6 | Live whiteboard-style preview |
| HTTP Client | Axios | 1.7 | REST API calls |
| Persistence | localStorage | Browser API | Client-side chat memory |
| Service | Provider | Tier | Notes |
|---|---|---|---|
| Frontend Hosting | Vercel | Free | Auto-deploy on push |
| Backend Hosting | Render | Free | Auto-deploy on push |
| CI/CD | GitHub Actions | Free | Push β deploy |
sktechAI/
βββ backend/
β βββ main.py # FastAPI app + lifespan + CORS
β βββ requirements.txt
β βββ .env.example
β βββ routers/
β β βββ analyze.py # POST /api/analyze
β β βββ chat.py # POST /api/chat (SSE streaming)
β βββ services/
β βββ vision.py # Gemini Vision + OpenRouter fallback
β βββ rag.py # ChromaDB singleton (6 collections)
β βββ codegen.py # generate_code() + stream_chat_with_context()
β βββ docs_loader.py # Hardcoded diagram syntax docs
β βββ memory.py # Legacy compatibility
β
βββ frontend/
β βββ index.html # Inline SVG favicon
β βββ vite.config.js # Dev proxy /api β localhost:8000
β βββ tailwind.config.js # Violet/graphite design tokens
β βββ src/
β βββ App.jsx # Root β lifted state (image, code, format)
β βββ config.js # API base URL (env-aware)
β βββ index.css # Tailwind + scrollbar + whiteboard mixin
β βββ hooks/
β β βββ useChatMemory.js # localStorage chat history hook
β βββ components/
β βββ UploadPanel.jsx # Left panel β upload, prompt, chat
β βββ ResultPanel.jsx # Right panel β preview, editor, elements
β βββ MermaidPreview.jsx # Whiteboard-style Mermaid renderer
β βββ SettingsPanel.jsx # API key modal β localStorage only
β
βββ .gitignore
βββ frontend/.env.production # VITE_API_URL=https://sktechai.onrender.com
βββ README.md
git clone https://github.com/Hamzi275/sktechAI.git
cd sktechAI| Provider | Link | Free Tier |
|---|---|---|
| Gemini | aistudio.google.com/app/apikey | 1500 req/day |
| Groq | console.groq.com/keys | 30 req/min |
| OpenRouter | openrouter.ai/keys | Free models available |
cd backend
python -m venv venv
# Windows
venv\Scripts\activate
# macOS/Linux
source venv/bin/activate
pip install -r requirements.txt
cp .env.example .envEdit .env:
GEMINI_API_KEY=AIza...
GROQ_API_KEY=gsk_...
OPENROUTER_API_KEY=sk-or-...uvicorn main:app --reload --port 8000Success output:
INFO: SketchFlow AI ready β 6 collections, 16 chunks loaded
INFO: Uvicorn running on http://127.0.0.1:8000
# New terminal
cd frontend
npm install
npm run dev| Setting | Value |
|---|---|
| Root Directory | backend |
| Environment | Python 3 |
| Build Command | pip install -r requirements.txt |
| Start Command | uvicorn main:app --host 0.0.0.0 --port $PORT |
Environment Variables:
GEMINI_API_KEY = your_key
GROQ_API_KEY = your_key
OPENROUTER_API_KEY = your_key
FRONTEND_URL = https://your-app.vercel.app
| Setting | Value |
|---|---|
| Root Directory | frontend |
| Framework Preset | Vite |
| Build Command | npm run build |
| Output Directory | dist |
Environment Variable:
VITE_API_URL = https://sktechai.onrender.com
git push origin main
β
βββ Vercel detects push β builds frontend β live in ~2 min
βββ Render detects push β installs deps β live in ~3 min
{
"image_base64": "string | null",
"filename": "diagram.jpg",
"diagram_type": "auto | flowchart | sequence | class | er | architecture",
"output_format": "auto | mermaid | plantuml",
"user_prompt": "optional instructions"
}Response:
{
"detected_type": "flowchart",
"description": "A user authentication flow",
"mode": "image | text",
"outputs": [
{ "format": "mermaid", "code": "graph TD...", "preview_supported": true },
{ "format": "plantuml", "code": "@startuml...", "preview_supported": false }
],
"elements": [{ "name": "User", "type": "actor" }],
"citations": [{ "title": "Mermaid Flowchart", "url": "https://mermaid.js.org/..." }]
}{
"message": "Make it a sequence diagram",
"current_code": "graph TD...",
"current_format": "mermaid",
"diagram_type": "auto",
"image_base64": "base64_or_empty",
"image_filename": "sketch.png",
"chat_history": [{ "role": "user", "content": "..." }]
}Optional headers:
X-User-Gemini-Key: AIza...
X-User-Groq-Key: gsk_...
X-User-Openrouter-Key: sk-or-...
Image Analysis (Vision)
1. gemini-2.5-flash Google AI Studio
2. gemini-2.0-flash Google AI Studio
3. gemini-1.5-flash Google AI Studio
4. google/gemini-flash-1.5 OpenRouter
5. llama-3.2-11b-vision:free OpenRouter
6. qwen-2-vl-7b:free OpenRouter
Code Generation and Chat (Text)
1. llama-3.3-70b-versatile Groq (primary)
2. deepseek/deepseek-r1:free OpenRouter
3. llama-3.3-70b-instruct:free OpenRouter
4. mistral-7b-instruct:free OpenRouter
Embeddings (RAG)
1. gemini-embedding-001 Required for RAG pipeline
Startup β runs once
6 diagram syntax docs loaded into ChromaDB
Each doc chunked (~400 chars, 50 char overlap)
Each chunk embedded via gemini-embedding-001
Stored in 6 in-memory ChromaDB collections
Per Request β runs every time
User prompt embedded with Gemini
Cosine similarity search across relevant collections
Top-k syntax chunks retrieved
Chunks injected as SYNTAX RULES in LLM prompt
LLM generates standards-compliant code
No invented syntax β rules are always grounded in docs
API Keys
- Entered in Settings modal
- Stored in browser
localStorageonly - Sent as
X-User-*-Keyrequest headers - Backend forwards to provider directly
- Never stored in any database
- Never logged server-side
Chat History
- Stored in browser
localStorageonly - Sent to backend per-request in request body
- Backend does not persist it anywhere
- Automatically cleared on new image upload
| Issue | Cause | Fix |
|---|---|---|
| First request takes 30-60s | Render free tier cold start | Wait β subsequent requests are fast |
| "All providers failed" | No API keys configured | Add keys in Settings or backend .env |
| Preview shows syntax error | LLM generated slightly invalid syntax | Edit code manually or ask chat to fix it |
| PlantUML has no preview | Requires Java server | Copy code β paste at plantuml.com |
| Chat does not see image | Image not attached | Ensure thumbnail is still visible in upload panel |
| Words joined in chat reply | SSE parsing bug (pre-v4) | Update to latest version |
| CORS error in console | FRONTEND_URL not set | Add your Vercel URL to Render environment variables |
- Export to PNG/SVG β download rendered diagrams as image files
- Diagram History β save and revisit previously generated diagrams
- Share Link β generate shareable URL for a diagram
- PlantUML Live Preview β render PlantUML in-browser without Java server
- Multi-diagram Canvas β work on multiple diagrams side by side
- VS Code Extension β generate diagrams directly from your editor
- GitHub Integration β auto-generate architecture diagrams from repos
git clone https://github.com/YOUR_USERNAME/sktechAI.git
cd sktechAI
git checkout -b feature/your-feature-name
git commit -m "feat: describe your change clearly"
git push origin feature/your-feature-nameOpen a Pull Request on GitHub. Keep PRs focused β one feature or fix per PR.
MIT License β Copyright (c) 2025 Hamzi275
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.