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)