https://github.com/tsembp/sql-gym
https://github.com/tsembp/sql-gym
fastapi react sqlalchemy tailwindcss typescript
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/tsembp/sql-gym
- Owner: tsembp
- License: mit
- Created: 2025-06-16T09:32:24.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-07-08T08:43:32.000Z (12 months ago)
- Last Synced: 2025-07-08T08:43:36.619Z (12 months ago)
- Topics: fastapi, react, sqlalchemy, tailwindcss, typescript
- Language: Python
- Homepage:
- Size: 103 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ๐๏ธ SQLGym
**SQLGym** is an interactive SQL challenge platform designed to help users practice SQL using realistic, fintech-style datasets โ all in a clean local-first setup.
Built with a Python + FastAPI backend and a React + Tailwind frontend, SQLGym evaluates SQL queries safely and gives instant feedback using mock financial data (users, transactions, refunds, subscriptions).
## โจ Features
- ๐ง 15 realistic SQL challenges (from `BASIC` to `HARD`)
- ๐ Secure backend with safe SQL evaluation (no DDL/DML)
- ๐งพ Realistic mock financial datasets generated with `Faker`
- ๐ก Frontend with challenge prompts, schema previews, and Monaco-based SQL editor
- โ
Query correctness feedback with result previews
- โก Local SQLite support for rapid development
// ...existing code...
## ๐ธ Preview
| Home Page | Filtered View |
|-----------------------------------------------|------------------------------------------------|
|  |  |
| Challenge Page | Correct Solution |
|-----------------------------------------------|------------------------------------------------|
|  |  |
| Incorrect Solution | SQL Injection Protection |
|-----------------------------------------------|------------------------------------------------|
|  |  |
## ๐ Getting Started
### 1. Clone and setup environment
```bash
git clone https://github.com/tsembp/SQL-Gym.git
cd SQL-Gym
python -m venv venv
source venv/bin/activate # or venv\Scripts\activate on Windows
pip install -r requirements.txt
````
### 2. Generate mock DB
```bash
python backend/db/db_seeder.py
```
### 3. Start backend
```bash
cd backend
uvicorn main:app --reload
```
### 4. Setup frontend
```bash
cd frontend/tailwindcss4
npm install
npm run dev
```
## ๐๏ธ Project Structure
```
sqlgym/
โโโ backend/
โ โโโ main.py # FastAPI app
โ โโโ challenge_definitions # Challenges JSON
โ โโโ db/
โ โ โโโ db_seeder.py # SQLite + Faker mock data
โ โ โโโ models.py # SQLAlchemy models
| | โโโ sqlgym.db # Generated DB (gitignored)
โโโ frontend/
โ โโโ src/
โ โโโ pages/
โ โโโ api/
| ...
```
## ๐ ๏ธ Tech Stack
* **Backend**: Python, FastAPI, SQLAlchemy, SQLite
* **Frontend**: React, TypeScript, Tailwind CSS, Vite
* **Editor**: Monaco Editor
* **Data**: Faker, Pandas
## ๐ Future Ideas
* ๐ค GPT-powered SQL hints
* ๐ฌ AI assistant for each challenge
* ๐ Leaderboard or progress tracking
## ๐ License
MIT License ยฉ 2025 \[Panagiotis Tsembekis]