Transform natural language into powerful database queries with AI-driven insights and beautiful visualizations.
AI Query (askDB) is a revolutionary full-stack web application that democratizes database interaction by allowing users to query databases using natural language. Powered by Google's Gemini AI, it automatically generates SQL queries, provides intelligent suggestions, and delivers stunning data visualizations - all without requiring deep technical knowledge.
Whether you're a business analyst, data scientist, or developer, AI Query bridges the gap between complex databases and actionable insights.
- AI-Powered SQL Generation: Ask questions in plain English and get accurate SQL queries instantly
- Multi-Database Support: Connect to PostgreSQL, MySQL, MongoDB, and SQLite databases
- Intelligent Suggestions: Receive contextual query recommendations based on your database schema and conversation history
- Multiple Chart Types: View data as tables, bar charts, pie charts, or line graphs
- Auto-Detection: Automatically suggests the best visualization type for your data
- Export Capabilities: Download results as CSV or PNG images
- Responsive Design: Beautiful, mobile-friendly visualizations
- Interactive Schema Browser: Explore tables, columns, and relationships visually
- Entity-Relationship Diagrams: Generate and interact with ER diagrams of your database
- Real-time Schema Analysis: Understand your data structure at a glance
- Docker Support: Easy deployment with Docker and Docker Compose
- Development Ready: Hot-reload development environment
- Production Optimized: Lightweight containers for efficient deployment
- Dark/Light Themes: Choose your preferred visual experience
- Intuitive Design: Clean, modern interface inspired by modern data tools
- Real-time Feedback: Live status updates and progress indicators
Unlike traditional query builders, AI Query leverages cutting-edge AI to understand context, handle complex relationships, and generate optimized queries that traditional tools might miss.
Connect to any major database system without changing your workflow. Whether you're working with relational databases or NoSQL, AI Query adapts seamlessly.
Go beyond raw data - get automatic insights through intelligent visualizations that highlight trends, patterns, and anomalies in your data.
Maintain context across queries with conversation history, allowing for follow-up questions and iterative data exploration.
All processing happens locally or in your controlled environment. Your data stays secure while benefiting from AI capabilities.
- Docker and Docker Compose
- Git
-
Clone the repository
git clone https://github.com/yourusername/ai-query.git cd ai-query -
Set up environment variables
# Create .env file in Backend directory cd Backend cp .env.example .env # Edit .env with your Google Gemini API key
-
Launch with Docker
cd .. docker-compose up --build -
Access the application
- Frontend: http://localhost:5173
- Backend API: http://localhost:5000
cd Backend
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
# Set up your .env file with GEMINI_API_KEY
python app.pycd frontend
npm install
npm run dev- Launch the application
- Choose your database type (PostgreSQL, MySQL, MongoDB, or SQLite)
- Enter connection details:
- For local databases: host, port, database name, credentials
- For cloud databases: connection string or detailed credentials
- Click "Connect Database"
- Once connected, you'll see suggested queries based on your schema
- Type natural language questions like:
- "Show me the top 10 customers by revenue"
- "What are the sales trends over the last month?"
- "Find all orders from customers in California"
- AI Query generates the SQL and executes it automatically
- View results in table format or switch to visualizations
- Use the Schema Explorer sidebar to browse tables and columns
- Click "View ER Diagram" for a visual representation of relationships
- Expand/collapse tables to see column details and data types
- Results automatically suggest the best visualization type
- Switch between Table, Bar, Pie, and Line chart views
- Export data as CSV or save charts as PNG
GET /api/healthPOST /api/db/connect
Content-Type: application/json
{
"dbType": "postgresql",
"host": "localhost",
"port": "5432",
"database": "mydb",
"username": "user",
"password": "pass"
}POST /api/sql/query
Content-Type: application/json
{
"nl_query": "Show me all customers from New York",
"session_id": "your-session-id"
}POST /api/db/schema
Content-Type: application/json
{
"session_id": "your-session-id"
}For complete API documentation, see the API Reference.
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β React Frontendβ β Flask Backend β β AI Service β
β (Vite) βββββΊβ (REST API) βββββΊβ (Gemini AI) β
β β β β β β
β - Query UI β β - API Routes β β - Query Gen β
β - Visualizations β β - DB Connection β β - Suggestions β
β - Schema Explorerβ β - Session Mgmt β β β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β
βΌ
βββββββββββββββββββ
β Databases β
β β
β PostgreSQL β
β MySQL β
β MongoDB β
β SQLite β
βββββββββββββββββββ
We welcome contributions! Please see our Contributing Guide for details.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
- Additional database connectors
- New visualization types
- Enhanced AI prompts
- Performance optimizations
- UI/UX improvements
This project is licensed under the MIT License - see the LICENSE file for details.
- Google Gemini AI for powering intelligent query generation
- React & Vite for the modern frontend framework
- Flask for the robust backend API
- Recharts for beautiful data visualizations
- Tailwind CSS for the stunning UI design
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: support@aiquery.dev
Made with β€οΈ for data enthusiasts everywhere
Transforming the way the world interacts with databases, one query at a time.