Skip to content

Text-to-SQL Generator web app built using Node.js, Express.js, and the Hugging Face Inference API.

Notifications You must be signed in to change notification settings

nathutev/sql_generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

18 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧠 Text-to-SQL Generator

This project is a simple Text-to-SQL Generator web app built using Node.js, Express.js, and the Hugging Face Inference API. It converts natural language input into SQL queries based on user-defined tables and columns. It is deployed at https://sql-generator-xivz.onrender.com

πŸš€ Features

Converts natural language text into SQL queries using AI (via Hugging Face).

Clean, responsive front-end with simple UI.

Built-in CORS and JSON handling.

Customizable table and column inputs.

πŸ› οΈ Tech Stack

Node.js

Express.js

Hugging Face Inference API

dotenv

CORS

Vanilla HTML, CSS (Frontend)

πŸ“¦ Installation

Clone the Repository

git clone https://github.com/nathutev/sql_generator.git
cd sql_generator

Install Dependencies

npm install

Set Up Environment Variables Create a .env file in the root directory and add:

HG_API=your_huggingface_api_key
PORT=10000 # or any port you want to run it on

Start the Server

node app.js

Visit in Browser Open http://localhost:10000 (or your selected port from .env) in your web browser. It is also deployed online at https://sql-generator-xivz.onrender.com

πŸ“ Project Structure

β”œβ”€β”€ public/

β”‚ β”œβ”€β”€ index.html

β”‚ β”œβ”€β”€ local.js

β”‚ └── styles.css

β”œβ”€β”€ .env

β”œβ”€β”€ app.js

β”œβ”€β”€ notes.js
β”œβ”€β”€ package-lock.json
β”œβ”€β”€ package.json

✨ Example Usage

Enter your table name(s), column name(s), and query intent in plain English. Hit Submit. Receive a clean SQL statement, ready to copy-paste and run.

🧠 Powered By (current version)

πŸ€– Hugging Face Inference API 🐘 LLaMA 3.1 - 8B Instruct Model

πŸ§ͺ Future Improvements

Add history of generated queries. - DONE IN v2

About

Text-to-SQL Generator web app built using Node.js, Express.js, and the Hugging Face Inference API.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published