https://github.com/mupinnn/chat-db
Chat DB - A simple app to chat with your database using Gemini
https://github.com/mupinnn/chat-db
chatbot flask gemini-api react sqlite
Last synced: 6 months ago
JSON representation
Chat DB - A simple app to chat with your database using Gemini
- Host: GitHub
- URL: https://github.com/mupinnn/chat-db
- Owner: mupinnn
- Created: 2025-12-23T16:25:43.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2025-12-25T06:53:37.000Z (6 months ago)
- Last Synced: 2025-12-26T19:55:10.638Z (6 months ago)
- Topics: chatbot, flask, gemini-api, react, sqlite
- Language: TypeScript
- Homepage: https://chat-db.13121957.xyz/
- Size: 509 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Chat DB - A simple app to chat with your database using Gemini
Chat with your database in most human way possible and get the human-friendly response about your question
without the need to understand SQL at all. This app can helps stakeholders to get business insights from their data really fast.
I made this for Hacktiv8 Maju Bareng AI - AI for Data Scientist program's final project.
## Stacks
- Flask
- Gemini 2.5 Flash
- SQLite
- React
- Tanstack Query
- shadcn/ui + Tailwind CSS
- Nginx
- Docker + Docker Compose
## Run locally
### Prepare the Gemini API key and other environment variables
0. Visit https://aistudio.google.com/api-keys and create new API key
1. Copy the `web/.env.example` to `web/.env.local` and `api/.env.example` to `.env`
```sh
cp web/.env.example web/.env.local
cp api/.env.example web/.env
```
2. Fill the environment variables
```sh
# web/.env.local
VITE_API_URL=http://localhost:5000/api
# api/.env
GOOGLE_API_KEY=
ALLOWED_CORS_ORIGIN=http://localhost:5174
FLASK_ENV=development
PORT=5000
```
Next follow each services setup below.
### Frontend (`web`)
0. Make sure you have Bun installed, because the `Dockerfile` and the compose config for the `web` is only for production purpose; at least for right now
1. Install dependencies
```sh
cd web && bun install
```
2. Run
```sh
cd web && bun dev
```
3. You can access the frontend at http://localhost:5174
### Backend (`api`)
0. Make sure you have Docker and `docker-compose` installed
1. Run
```sh
docker compose up -d
```
2. Seed the data to the database first before accessing the backend
```sh
# this will seed the `api/data/coffee-sales-datasets.csv` to the SQLite database
docker compose exec api python seed.py
```
3. You can access the backend at http://localhost:5000 and try to access http://localhost:5000/api/health in your browser, `curl`, or any API tools to make sure it works.
## Acknowledgement and resources
- https://github.com/ardyadipta/gemini_chatbot_sql/
- https://github.com/leodeveloper/google-gemini-chat-with-sqlserver/
- https://github.com/ardyadipta/gemini_chatbot_qna
- https://blog.laozhang.ai/api-guides/gemini-api-free-tier/
- https://photokheecher.medium.com/building-a-smart-text-to-sql-system-with-rag-and-langchain-1958c041d4f4
## Gallery

