How three7vn/desthetik works
Project Type and Purpose
• Desthetik is a full-stack, open-source “system design co-pilot.”
• Frontend: React/Next.js app (TypeScript) that captures user ideas (voice or text) and renders visual flowcharts using React Flow.
• Backend: A Python microservice (backend/main.py) and/or Next.js API routes (pages/api/prompts.ts) orchestrating prompt generation and LLM calls.
File-Structure Analysis
Top-Level Directories:
• backend/ – Python service (requirements.txt) for LLM orchestration and business logic
• pages/ – Next.js routes and API endpoints (pages/api/prompts.ts)
• components/ – Reusable UI pieces (FlowCanvas.tsx, Sidebar.tsx, Voice.tsx, ContactModal.tsx, LoadingSkeleton.tsx)
• public/ – Static assets (e.g., Desthetik.png)
• styles/ – Global CSS
Configuration/Build:
• package.json, tsconfig.json, next.config.js – Frontend build and type settings
• requirements.txt – Python dependencies for the backend
Tests:
• backend/test_api.py – Basic integration tests for the Python service
README Insights
• The system accepts multi-turn, conversational inputs (voice or text).
• It dynamically selects a “graph type” based on user context and maps user answers to nodes & edges.
• Uses React Flow in the browser to render graphs; calls an LLM (OpenAI or similar) on the backend.
a. Main Components
1. User Device / Browser
• Voice Input (Web Speech API) – Voice.tsx
• UI Shell (_app.tsx) with Sidebar, ContactModal, LoadingSkeleton
• FlowCanvas (React Flow) for rendering the graph
2. Next.js Frontend Server
• SSR/CSR pages (pages/index.tsx)
• REST API endpoint (pages/api/prompts.ts)
3. Python Backend Service
• main.py – Receives prompt payloads from Next.js or directly from client
• test_api.py – Verifies LLM orchestration
4. LLM Provider (External)
• OpenAI API or other LLM endpoint
5. (Optional) Hosting/Storage
• Vercel/AWS Lambda for Next.js
• AWS/GCP/Azure or Docker for Python service
• CDN for public assets
b. Relationships & Data Flows
1. User speaks → Voice.tsx captures audio → Web Speech API transcribes to text.
2. Client component packages multi-turn form data → POST to Next.js API (/api/prompts).
3. Next.js API route either:
• Directly calls LLM (node-sdk)
• Or forwards to Python backend (HTTP) for advanced orchestration.
4. Python service composes system-design prompt → calls external LLM API → returns structured graph JSON.
5. Next.js endpoint returns graph data to client.
6. FlowCanvas component ingests JSON → React Flow renders nodes & edges.
7. User can download/export PNG or JSON.
c. Architectural Patterns & Principles
• Separation of concerns: UI vs. orchestration vs. LLM.
• API Gateway pattern: Next.js API routes as a single public interface.
• Microservice for specialized logic (Python).
• Graph-oriented rendering (React Flow) on the client.
d. Key Technologies & Frameworks
• Next.js (React SSR/CSR)
• React Flow (visual layout library)
• Web Speech API (voice capture)
• Python (Flask/FastAPI or plain HTTP) for LLM prompt logic
• OpenAI or similar LLM endpoint