<<<<<<< HEAD
An AI-powered database schema generation tool that converts natural language descriptions into complete database schemas with interactive visualization.
- 🤖 AI-Powered Generation: Describe your application in natural language and get a complete database schema
- 🔄 Dialect Support: Generate schemas for MySQL or PostgreSQL with proper syntax
- 📊 Interactive ER Diagrams: Visualize your schema with Mermaid.js diagrams
- 🌳 Tree View Editor: Browse and modify tables, columns, and relationships
- ✏️ Live Editing: Change relationship cardinality (1:1, 1:N, N:M) and see instant SQL updates
- 📋 Export Options: Copy SQL, download .sql files, export Mermaid diagrams, or JSON schemas
- 🎨 Modern UI: Beautiful dark theme with glassmorphism effects
The application uses an Intermediate Representation (IR) architecture:
- AI Processing: User prompt → LLM → Structured JSON Schema
- Compilation Engine: JSON Schema → SQL DDL + Mermaid Diagram
- Interactive Editing: UI changes → JSON updates → Instant recompilation
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ User Prompt │────▶│ AI (Backend) │────▶│ JSON Schema │
└─────────────────┘ └──────────────────┘ └────────┬────────┘
│
┌─────────────────────────────────┴──────────────────────────────────┐
│ │
▼ ▼
┌──────────────────┐ ┌──────────────────┐
│ SQL Compiler │ │ Mermaid Compiler │
└────────┬─────────┘ └────────┬─────────┘
│ │
▼ ▼
┌──────────────────┐ ┌──────────────────┐
│ SQL DDL │ │ ER Diagram │
└──────────────────┘ └──────────────────┘
- React + TypeScript (Vite)
- Tailwind CSS for styling
- Zustand for state management
- Mermaid.js for ER diagrams
- Prism.js for SQL syntax highlighting
- Lucide Icons
- FastAPI (Python)
- OpenAI / Anthropic for AI generation
- Pydantic for data validation
- Node.js 18+
- Python 3.10+
- OpenAI or Anthropic API key
cd backend
# Create virtual environment
python -m venv venv
# Activate venv (Windows)
.\venv\Scripts\activate
# Activate venv (Linux/Mac)
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Copy environment file and add your API key
copy .env.example .env
# Edit .env and add your OPENAI_API_KEY or ANTHROPIC_API_KEY
# Run the server
python -m uvicorn app.main:app --reloadcd frontend
# Install dependencies
npm install
# Run development server
npm run dev- Frontend: http://localhost:5173
- Backend API: http://localhost:8000
- API Docs: http://localhost:8000/docs
- Describe your application in the text area (e.g., "A multi-vendor e-commerce platform with inventory management")
- Select your SQL dialect (MySQL or PostgreSQL)
- Click "Generate Schema" to create your database schema
- View the ER diagram or browse the tree view to explore tables and relationships
- Edit relationships by clicking on them and changing cardinality
- Export your schema as SQL, Mermaid, or JSON
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/health |
Health check |
| POST | /api/generate-schema |
Generate schema from prompt |
| POST | /api/refine-schema |
Refine existing schema |
interface SchemaDefinition {
id: string;
name: string;
description: string;
dialect: "mysql" | "postgresql";
tables: TableDefinition[];
relationships: RelationshipDefinition[];
storedProcedures: StoredProcedureDefinition[];
createdAt: string;
updatedAt: string;
}MIT License
1a37a0800ae1c215b0a385cfb87ac1a4ce7af80c