- π CSV Upload β Upload any
.csvfile as your dataset - π§ AI-Powered β Converts natural language to SQL using Groq's LLaMA 3.1
- π Instant Results β See query results in a clean, interactive table
- π Dynamic Schema β Auto-detects table structure from uploaded CSV
- π Copy SQL β One-click copy for generated queries
- β¨οΈ Keyboard Shortcut β
Ctrl + Enterto submit - π Premium Dark UI β Modern design with smooth animations
- π Safe Queries β Only
SELECTstatements allowed
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β FRONTEND (Vercel) β
β β
β React + Vite + Tailwind CSS β
β βββββββββββββββββββββββββββββββββββββββββββββ β
β β Step 1: Upload CSV file β β
β β Step 2: Ask question in plain English β β
β ββββββββββββ¬βββββββββββββββββ¬ββββββββββββββββ β
β β POST /upload β POST /query β
ββββββββββββββββΌβββββββββββββββββΌββββββββββββββββββββββββββ
β β
βΌ βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β BACKEND (Render) β
β β
β FastAPI + Python β
β βββββββββββββββββββ ββββββββββββββββββββββββ β
β β /upload API β β /query API β β
β β CSV β SQLite β β Question β Groq LLM β β
β β via Pandas β β β SQL β Execute β β
β ββββββββββ¬βββββββββ ββββββββββββ¬ββββββββββββ β
β β β β
β βΌ βΌ β
β βββββββββββββββββββββββββββββββββββββββββββ β
β β SQLite Database (uploaded_data.db) β β
β β Dynamic table from uploaded CSV β β
β βββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- Upload a CSV file β backend saves it to a SQLite database using Pandas
- Schema auto-detection β column names and types are extracted automatically
- Ask a question in natural language (e.g., "Show employees with salary > 50000")
- Groq AI (LLaMA 3.1-8B) generates a
SELECTSQL query using the detected schema - Backend executes the SQL on the SQLite database
- Results are returned as JSON and displayed in a styled table
| Layer | Technology | Purpose |
|---|---|---|
| Frontend | React 19, Vite 7, Tailwind CSS 4 | UI & styling |
| Backend | FastAPI, Python | REST API |
| AI/LLM | Groq Cloud, LLaMA 3.1-8B | NL β SQL conversion |
| Database | SQLite, SQLAlchemy, Pandas | Dynamic data storage |
| Deployment | Vercel (frontend), Render (backend) | Hosting |
- Node.js β₯ 18
- Python β₯ 3.9
- Groq API Key β Get one free at console.groq.com
git clone https://github.com/omsudhamsh/nl-sql.git
cd nl-sqlcd backend
# Create virtual environment
python -m venv venv
# Activate it
# Windows:
venv\Scripts\activate
# macOS/Linux:
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Create .env file
echo GROQ_API_KEY=your_groq_api_key_here > .env
# Run the backend
uvicorn app.main:app --reloadThe API server will start at http://127.0.0.1:8000
cd frontend/nl-sql
# Install dependencies
npm install
# Run dev server
npm run devThe app will be available at http://localhost:5173
nl-sql/
βββ backend/
β βββ app/
β β βββ main.py # FastAPI app, CORS, routes (/upload, /query)
β β βββ llm.py # Groq LLM integration (dynamic schema)
β β βββ db.py # SQLite database setup
β β βββ file_handler.py # CSV β SQLite via Pandas
β β βββ utils.py # SQL execution + safety checks
β βββ requirements.txt
β βββ .env # API keys (not committed)
β
βββ frontend/nl-sql/
β βββ src/
β β βββ App.jsx # Main app (upload + query UI)
β β βββ index.css # Premium dark theme styles
β β βββ main.jsx # React entry point
β βββ index.html
β βββ vite.config.js
β βββ package.json
β
βββ assets/ # Screenshots for README
βββ README.md
- Only
SELECTqueries are allowed β the backend rejectsINSERT,UPDATE,DELETE, etc. - SQL output is sanitized to strip markdown formatting from LLM responses
- CORS configured for secure cross-origin requests
- API key stored in
.env(never committed to repo)
This project is licensed under the MIT License β see the LICENSE file for details.
Built with β€οΈ by Om Sudhamsh Padma
β Star this repo if you found it useful!

