Convert natural language to SQL queries instantly with AI
Query GPT is a modern web application that transforms natural language questions into SQL and NoSQL database queries using advanced language models. The application provides an intuitive interface for generating queries across multiple database systems and offers features like syntax highlighting, schema analysis, and easy query sharing.
π Try Query GPT Online
Experience the tool directly in your browser without any installation.
- Project Architecture
- Technology Stack
- Core Features
- AI Capabilities
- Getting Started
- Key Components
- Project Structure
- Contributing
graph TD
A[User Interface] --> B[Query Generator]
B --> C[AI Model API]
B --> D[Database Type Selection]
E[Schema Input] --> B
F[Query Input] --> B
B --> G[Generated Query with Syntax Highlighting]
A --> H[Features Display]
C --> I[Language Model Selection]
C --> J[Context Handling]
style A fill:#f9f,stroke:#333,stroke-width:2px
style B fill:#bbf,stroke:#333,stroke-width:2px
style C fill:#fbf,stroke:#333,stroke-width:2px
style G fill:#bfb,stroke:#333,stroke-width:2px
style I fill:#fbf,stroke:#333,stroke-width:2px
style J fill:#fbf,stroke:#333,stroke-width:2px
Category | Technologies |
---|---|
Frontend Framework | React, TypeScript |
Build Tool | Vite |
Styling | TailwindCSS, Shadcn UI |
State Management | React Hooks, Context API |
Data Fetching | TanStack Query (React Query) |
Routing | React Router |
UI Components | Radix UI, Lucide React icons |
Form Handling | React Hook Form, Zod validation |
AI Integration | OpenRouter API, LLM prompting |
Developer Tools | ESLint, TypeScript |
- π€ AI-Powered Query Generation: Transforms natural language to SQL using advanced LLMs
- ποΈ Multi-Database Support: Generates queries for SQL, MySQL, PostgreSQL, SQL Server, SQLite, and MongoDB
- π Schema Analysis: Interprets database schemas to create accurate queries
- β¨ Syntax Highlighting: Displays generated queries with code highlighting
- π± Responsive Design: Works seamlessly across desktop and mobile devices
- π Preferences Saving: Remembers your model and language preferences
- π One-Click Copy: Easy sharing of generated queries
- Multiple LLM Support: Integrate with various language models through OpenRouter
- Context-Aware Queries: Generate database queries that understand table relationships and schema context
- Intelligent Schema Analysis: AI analyzes provided schemas to generate accurate and optimized queries
- Natural Language Understanding: Process complex questions and convert them to precise database queries
- Query Optimization: Suggestions for query performance improvements based on schema analysis
- Model Selection: Choose from different AI models based on your specific needs and performance requirements
- Prompt Engineering: Optimized prompts for generating accurate SQL and NoSQL queries
- Real-time Generation: Fast response times for an interactive query development experience
If you want to work locally using your own IDE, you can clone this repo and push changes.
The only requirement is having Node.js & npm installed - install with nvm
Follow these steps:
# Step 1: Clone the repository using the project's Git URL.
git clone <YOUR_GIT_URL>
# Step 2: Navigate to the project directory.
cd <YOUR_PROJECT_NAME>
# Step 3: Install the necessary dependencies.
npm i
# Step 4: Create a .env file based on .env.example and add your OpenRouter API key.
cp .env.example .env
# Edit .env and add your OpenRouter API key (get one from https://openrouter.ai/keys)
# Step 5: Start the development server with auto-reloading and an instant preview.
npm run dev
Component | Purpose | File Location |
---|---|---|
QueryGenerator | Core query generation functionality | src/components/QueryGenerator.tsx |
SchemaInput | Database schema input interface | src/components/SchemaInput.tsx |
QueryInput | Natural language question input | src/components/QueryInput.tsx |
CodeDisplay | Syntax highlighted query display | src/components/CodeDisplay.tsx |
ModelSelector | AI model and DB type selection | src/components/ModelSelector.tsx |
AIProvider | Manages AI model connections and context | src/providers/AIProvider.tsx |
Hero | Main landing section | src/components/Hero.tsx |
Features | Feature showcase section | src/components/Features.tsx |
query-gpt/
βββ src/ # Source code
β βββ components/ # React components
β β βββ ui/ # UI component library (Shadcn)
β β βββ QueryGenerator.tsx # Main query generation component
β β βββ ... # Other components
β βββ hooks/ # Custom React hooks
β β βββ useAIModel.ts # Hook for AI model management
β β βββ ... # Other hooks
β βββ lib/ # Utility functions and helpers
β β βββ ai/ # AI-related utilities and API clients
β β βββ ... # Other utilities
β βββ pages/ # Page components
β βββ App.tsx # Main application component
βββ public/ # Static assets
βββ index.html # HTML entry point
βββ vite.config.ts # Vite configuration
βββ tailwind.config.ts # Tailwind CSS configuration
βββ package.json # Project dependencies and scripts
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