Convert plain English questions into SQL queries and run them on any uploaded CSV dataset.
Backend powered by FastAPI + MySQL + RAG.
Frontend built using React/Next.js.
- Upload any
.csvfile - Backend automatically creates a SQL table in MySQL
- Schema is extracted and piped into RAG
Examples:
- βShow total revenue by categoryβ
- βList top 10 customers by spendingβ
- βGive count of employees in each departmentβ
Backend returns:
- β Generated SQL
- β Executed result
- β RAG-improved query understanding
- Clicking Finish drops all temporary uploaded tables
- Keeps database clean for next user
- Python 3.12
- FastAPI
- SQLAlchemy
- MySQL (AlwaysData / free hosting)
- OpenAI (or Groq) LLMs
- ChromaDB (RAG embeddings)
- React / Next.js
- Axios
- Deployed on Vercel / Render
NL2SQLX/ βββ backend/ β βββ app.py β βββ db.py β βββ rag.py β βββ schema_extractor.py β βββ nl2sql.py β βββ requirements.txt βββ frontend/ β βββ app/ β βββ components/ β βββ public/ β βββ package.json βββ README.md
cd backend
python -m venv venv
venv/Scripts/activate # Windowspip install -r requirements.txt###3οΈβ£ Create .env file inside backend
MYSQL_USER=root
MYSQL_PASSWORD=xxxx
MYSQL_HOST=localhost
MYSQL_PORT=3306
MYSQL_DB=mydb
OPENAI_API_KEY=your_key
###4οΈβ£ Run FastAPI uvicorn app:app --reload
###π¨ Run Frontend Locally (React/Next.js)
cd frontend
npm install
npm run dev
Frontend runs on:
Backend runs on:
Edit API_BASE inside frontend:
export const API_BASE = "http://localhost:8000";
###π¨βπ» About the Developer
Prathamesh Shivaji Salokhe B.Tech Computer Engineering (Final Year)