NF QueryGPT – AI Database Analyst
Link to Live Project: https://frontend-two-plum-99.vercel.app/
An AI-powered conversational Database Analyst for matrimony platforms supporting English, Hinglish, and voice queries. Integrates dual-layer read-only security, an interactive 3D table relationship explorer, and on-the-fly CSV/JSON/Excel dataset analysis.
💡 The Problem (The Why)
In fast-growing enterprises (like matrimony services), operational managers, customer support reps, and marketing leaders frequently need data insights to make strategic decisions. Currently, they face two options:
- Wait Days for IT: Requesting custom SQL reports from data engineers, delaying fast decisions.
- Direct Client Vulnerabilities: Granting non-technical users access to SQL consoles, which exposes the system to query performance degradation, accidental deletions, or injection attacks.
✨ The Solution (The What)
NF QueryGPT is a secure, natural language analytics portal. It acts as an on-demand AI Business Analyst that translates voice commands, standard English, or colloquial Hinglish ("Delhi se kitne users active active hain?") into safe, optimized database queries, executing them instantly.
Core Features:
- Interactive 3D Schema Explorer: Renders an interactive 3D table node mesh showing database tables, column types, and foreign key references. Drag-to-rotate interaction allows users to visualize how database entities relate.
- Dual-Layer SQL Safety:
- Grammar Scanner (Regex Layer): Screens SQL commands pre-execution to block administrative commands, mutations, and DML keywords (
INSERT,DROP,DELETE,UPDATE,ALTER). - Physical System Locks (SQLite Level): Opens the database connection pool strictly in read-only mode (
?mode=ro). Even if system prompts or regex filters are bypassed, the database engine physically rejects write operations.
- Grammar Scanner (Regex Layer): Screens SQL commands pre-execution to block administrative commands, mutations, and DML keywords (
- Structured AI Analyst Insights: Rather than just displaying raw numbers, the tool automatically breaks down every data query into three categories:
- What Happened: A concise summary of raw data metrics.
- Why It Matters: The business value, anomalies, or underlying trends.
- What Action to Take: Actionable operational recommendations.
- Hinglish & Real-Time Voice Search: Air-tight integration with the browser Web Speech API for voice recognition, system-prompted to interpret colloquial terminology. Includes a text-to-speech speaker to read executive summaries aloud.
- No-API-Key Mock Mode: Dynamic regex-based mock router allows the system to resolve standard query paths offline/without an API key, ensuring 100% demo uptime for hackathon judges.
- Custom Dataset File Upload Analyzer (New Build Feature):
- Users can drag-and-drop or upload custom external data files (
.csv,.json,.xlsx). - Parses datasets on-the-fly and projects them in the UI table preview, feeding sample records to the AI Business Analyst to yield strategic insights and auto-recommend charts.
- Users can drag-and-drop or upload custom external data files (
- Publication-Grade PDF & Excel Exports: Instantly compiles user prompts, queries, and charts into executive PDF reports ready for print.
🛠️ Tech Stack
- Frontend: Next.js 16 (App Router), React 19, TypeScript, Tailwind CSS, Recharts (for dynamic visualizations), Lucide Icons.
- Backend: FastAPI (Python 3.12), SQLite3, SQLAlchemy, OpenPyXL, google-generativeai / Gemini LLM.
- Deployment: Vercel (Frontend), Local FastAPI (Backend Uvicorn server).
⚙️ How It Works (System Design)
- Input: User speaks or types a query (e.g., "Show subscription revenue splits").
- SQL Generation: The query is routed to the FastAPI backend, which matches schema context with Gemini to generate a
SELECTSQL block. - Safety Verification: Code runs through regex scanner, and executes on the database opened with
?mode=ro. - Execution & Mapping: The results are parsed. The engine matches the number/types of columns to recommend the best visualization (KPI Card, Pie, Bar, or Line Chart).
- AI Synthesis: Data is processed to produce strategic insights.
- File Upload Mode: External CSV/JSON/Excel files skip SQL generation, parse the contents into a preview model, and pipe data structures directly into the visualizers and AI analyst.





