This application allows users to generate SQL queries using natural language input. It connects to a database and provides an interface for users to ask questions in English, which are then converted into SQL queries and executed against the database.
-
Frontend:
- Next.js for server-side rendering and API routes
- Tailwind CSS for styling
- Shadcn/UI for components
-
Backend:
- FastAPI for handling database connections and text-to-SQL conversion
- OpenAI for text-to-SQL conversion
-
Clone the repository:
git clone https://github.com/theGateway1/QueryWise-Frontend.git cd QueryWise-Frontend
-
Install frontend dependencies:
npm install
-
Set up frontend environment variables: Create a
.env.local
file in the root directory and add:API_URL=http://localhost:8000 # FastAPI backend URL
-
Install backend dependencies:
- Clone the backend repository:
git clone https://github.com/theGateway1/QueryWise-Backend.git cd QueryWise-Backend
-
Install backend dependencies:
pip install -r requirements.txt
-
Set up backend environment variables: Create a
.env
file in theQueryWise-Backend
directory and add necessary variables.OPENAI_API_KEY=<your-openai-api-key>
-
Start the FastAPI backend:
cd QueryWise-Backend uvicorn main:app --reload
-
In a new terminal, start the Next.js frontend:
npm run dev
-
Open http://localhost:3000 in your browser.
-
Enter your database credentials and click "Connect" to establish a database connection.
-
Enter a natural language query in the text area. Click "Generate SQL" to convert your query to SQL and execute it.