SQL Query Generator is a full-stack web application that converts natural language into SQL queries using an AI model. The goal of this project is to make SQL easier for users who are not comfortable writing queries manually while also making sure the generated queries are safe and valid before execution.
- Convert natural language into SQL queries using AI.
- Separate MySQL workspace for every admin to keep data isolated.
- One admin can create and manage a dedicated user for the workspace.
- Schema-aware query generation where the AI receives only the database schema instead of actual user data.
- Hallucination reduction by validating table names and column names against the database schema.
- Suggests existing tables or columns when an invalid name is requested instead of generating incorrect SQL.
- SQL validation pipeline before execution to reduce syntax errors and invalid queries.
- Different handling for SELECT, INSERT, UPDATE, DELETE and DDL queries before execution.
- Secure user authentication using JWT.
- Passwords stored securely using bcrypt hashing.
- Email OTP verification during signup.
- Role-based access control for Admin and User.
- Rate limiting to prevent excessive API requests.
- Helmet middleware for secure HTTP headers.
- Restricted CORS configuration allowing requests only from trusted frontend origins.
- Friendly error messages instead of raw database errors.
- Automatic creation of a dedicated MySQL database for every new admin workspace.
- React
- TypeScript
- Vite
- Node.js
- Express
- TypeScript
- MySQL (Railway)
- MongoDB Atlas
- Groq API (GPT OSS Model)
- Frontend: Vercel
- Backend: Render
Frontend: https://sql-query-generator-vert.vercel.app/
Backend API: https://sql-query-generator-lzxx.onrender.com
- PostgreSQL support in addition to MySQL.
- Multiple users under a single workspace.
- Download query results as CSV or Excel.
- AI explanation for generated SQL queries.
- Visual database schema explorer.