AI-powered database design through natural language. Convert plain English to SQL, generate ER diagrams, and execute queries on your MySQL database.
- Natural Language to SQL — Describe what you want in plain English, get optimized SQL
- ER Diagram Generation — Auto-generate entity relationship diagrams from your schema
- Direct Database Execution — Run queries on your MySQL database with confirmation safeguards
- Chat Interface — Conversational AI that understands context and intent
- Schema Visualization — Mermaid-based diagrams rendered in real-time
Entia uses a dual database architecture:
┌─────────────────────────────────────────────────────────┐
│ Entia App │
└─────────────────────────────────────────────────────────┘
│ │
▼ ▼
┌─────────────┐ ┌─────────────────┐
│ User's │ │ Supabase │
│ MySQL DB │ │ PostgreSQL │
│ │ │ │
│ (queries │ │ (app data: │
│ executed │ │ users, chats, │
│ here) │ │ messages) │
└─────────────┘ └─────────────────┘
- Supabase PostgreSQL — Stores app data (users, conversations, messages) via Drizzle ORM
- User's MySQL — Connected via
mysql2/promise, used for executing user queries
- Node.js 18+
- pnpm (recommended) or npm
- A Supabase project (free tier works)
- A Clerk account (free tier works)
- OpenAI API key
git clone https://github.com/shahidhustles/entia.git
cd entiapnpm install
# or
npm installCreate a .env.local file in the root directory:
# Database (Supabase PostgreSQL)
DATABASE_URL=postgresql://postgres:[PASSWORD]@db.[PROJECT-REF].supabase.co:5432/postgres
# Clerk Authentication
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_...
CLERK_SECRET_KEY=sk_test_...
# OpenAI
OPENAI_API_KEY=sk-...
# Optional: Clerk redirect URLs
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-upPush the Drizzle schema to your Supabase database:
pnpm db:push
# or
npm run db:pushpnpm dev
# or
npm run devOpen http://localhost:3000 in your browser.
src/
├── app/
│ ├── actions/ # Server actions
│ │ ├── tools/ # AI tool implementations
│ │ │ ├── execute-sql.ts
│ │ │ ├── get-database-schema.ts
│ │ │ └── query-database.ts
│ │ ├── conversations.ts
│ │ └── search.ts
│ ├── api/
│ │ └── chat/
│ │ └── route.ts # Main AI chat endpoint
│ ├── chat/ # Chat pages
│ └── settings/ # Settings page
├── components/
│ ├── ui/ # shadcn/ui components
│ │ └── ai/ # AI-specific components
│ ├── chat-input.tsx
│ └── client-chat.tsx
├── db/
│ ├── index.ts # Drizzle client
│ └── schema.ts # Database schema
├── hooks/
│ └── use-chat.ts # Custom chat hook
└── lib/
└── utils.ts
| Command | Description |
|---|---|
pnpm dev |
Start development server with Turbopack |
pnpm build |
Build for production |
pnpm start |
Start production server |
pnpm lint |
Run ESLint |
pnpm db:push |
Push Drizzle schema to database |
pnpm db:migrate |
Run database migrations |
- Framework: Next.js 15 (App Router)
- Language: TypeScript
- Database: Supabase (PostgreSQL) + User's MySQL
- ORM: Drizzle ORM
- Auth: Clerk
- AI: OpenAI via Vercel AI SDK
- Styling: Tailwind CSS + shadcn/ui
- Diagrams: Mermaid
| Variable | Description | Required |
|---|---|---|
DATABASE_URL |
Supabase PostgreSQL connection string | ✅ |
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY |
Clerk publishable key | ✅ |
CLERK_SECRET_KEY |
Clerk secret key | ✅ |
OPENAI_API_KEY |
OpenAI API key | ✅ |
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Shahid Patel
- GitHub: @shahidhustles
Made with ❤️ using Next.js and AI
