Skip to content

Latest commit

Β 

History

History
105 lines (72 loc) Β· 3.04 KB

File metadata and controls

105 lines (72 loc) Β· 3.04 KB

πŸ‹οΈ 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
Home Challenge
Challenge Page Correct Solution
Correct Incorrect
Incorrect Solution SQL Injection Protection
SQLi Filtered

πŸš€ Getting Started

1. Clone and setup environment

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

python backend/db/db_seeder.py

3. Start backend

cd backend
uvicorn main:app --reload

4. Setup frontend

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]