SQLit is a free, open-source SQL practice platform β like LeetCode, but purpose-built for databases. Write real queries against real schemas, get instant results in the browser, and level up from beginner to expert.
Whether you're prepping for a data engineering or analytics interview, learning SQL from scratch, or sharpening your window functions β SQLit has you covered with 412 curated problems, real-world datasets, and a built-in query optimizer.
No account required to start. No setup needed. Just open the browser and write SQL.
- Features
- Screenshots
- Tech Stack
- Project Structure
- Getting Started
- API Reference
- Roadmap
- Contributing
- License
- 412 curated problems across Easy, Medium, and Hard difficulties
- Covers JOINs, subqueries, CTEs, window functions, aggregations, and more
- Problems organized by concept tags and categories
- Hints, explanations, and multiple solution approaches for every problem
- Write and execute SQL directly in the browser β no setup required
- Supports SQLite (instant, client-side fallback) and PostgreSQL (production sandbox)
- MySQL dialect support via automatic syntax translation
- Sandboxed execution with timeout protection and rate limiting
| Domain | Tables |
|---|---|
| π E-Commerce | customers, orders, products, reviews |
| π° Finance | accounts, transactions, portfolios, market data |
| π₯ Healthcare | patients, diagnoses, prescriptions, appointments |
Interactive dataset explorer with schema diagrams, column types, and sample data.
- Visual EXPLAIN plan analyzer with color-coded node types
- See
Seq ScanvsIndex Scan,Nested LoopvsHash Join - Learn to read and optimize execution plans hands-on
- Interactive ER Diagram Builder β drag-and-drop entities on an SVG canvas
- Add tables, columns (19 PostgreSQL types), primary keys, and foreign keys
- Export to SQL DDL with one click
- Import from SQL β paste
CREATE TABLEstatements and get a visual diagram - Schema normalization guide and best practices
- Timed SQL challenges simulating real interview conditions
- Company-style question sets (FAANG, startups, finance)
- Difficulty progression from phone screen to on-site level
- Fresh SQL problem every day with a countdown timer
- Streak tracking to keep you consistent
- GitHub-style activity heatmap showing your full solve history
- Concept badges β earn Beginner β Learner β Proficient β Expert β Master per topic
- XP system with level progression
- Track solved problems, accuracy, and streaks
- Light and dark theme with smooth toggle
- Resizable editor panels
- Syntax-highlighted SQL editor with auto-formatting
- Mobile-responsive design
πΈ Screenshots coming soon β try the live demo in the meantime.
| Layer | Technology |
|---|---|
| Frontend | Next.js 16, TypeScript, Tailwind CSS 4 |
| Backend | FastAPI, Python 3.12, Uvicorn |
| Database | PostgreSQL (production), SQLite (fallback) |
| State | Zustand with localStorage persistence |
| Auth | Auth0 (optional) |
| Deployment | Vercel (frontend) + Railway (backend) |
SQLit/
βββ frontend/ # Next.js app
β βββ src/
β β βββ app/ # Pages (App Router)
β β β βββ (main)/ # All authenticated routes
β β β β βββ practice/ # Problem list + solver
β β β β βββ datasets/ # Dataset explorer
β β β β βββ db-design/ # ER builder + normalization
β β β β βββ optimization/ # EXPLAIN visualizer
β β β β βββ interview/ # Interview prep
β β β β βββ profile/ # Activity heatmap + badges
β β β βββ api/ # API route proxies
β β βββ components/ # Reusable UI components
β β βββ stores/ # Zustand state stores
β β βββ lib/ # Utilities, API client, schemas
β βββ package.json
β
βββ backend/ # FastAPI app
β βββ app/
β β βββ api/ # Route handlers
β β βββ core/ # Config, auth, database, rate limiter
β β βββ datasets/ # E-commerce, Finance, Healthcare
β β βββ models/ # SQLAlchemy models
β β βββ services/ # Query executor, problem service
β βββ Dockerfile
β βββ requirements.txt
β
βββ docker-compose.yml # Full-stack local development
- Node.js 18+ and npm
- Python 3.11+
- PostgreSQL 16+ (optional β SQLite fallback works out of the box)
git clone https://github.com/Amarnath27me/SQLit.git
cd SQLitcd backend
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env # Edit if you have PostgreSQL
uvicorn app.main:app --port 8001 --reloadThe API will be running at http://localhost:8001. Test it:
curl http://localhost:8001/health
# β {"status": "ok", "service": "sqlit-api"}cd frontend
npm install
cp .env.local.example .env.local
npm run devOpen http://localhost:3000 and start practicing!
docker-compose up --buildThis starts the frontend, backend, and PostgreSQL together in one command.
Frontend β Vercel
- Push this repo to GitHub
- Go to vercel.com β Import your repo
- Set Root Directory to
frontend - Add environment variable:
BACKEND_URL = your Railway backend URL - Deploy
Backend β Railway
- Go to railway.com β New Project β Deploy from GitHub
- Set Root Directory to
backend - Add environment variables from
backend/.env.example - Deploy β Railway auto-detects the Dockerfile
| Method | Endpoint | Description |
|---|---|---|
GET |
/health |
Health check |
GET |
/api/problems |
List all problems (with filters) |
GET |
/api/problems/{slug} |
Get problem details |
POST |
/api/query/execute |
Execute SQL query in sandbox |
GET |
/api/progress |
Get user progress |
Full API docs available at http://localhost:8001/docs (Swagger UI) when running locally.
- AI-powered query reviewer β get natural language feedback on your SQL
- Docker-based query sandbox for full execution isolation
- Skill tree visualization β see your learning path across concepts
- More datasets β education, social media, logistics, SaaS metrics
- Onboarding tutorial tour for new users
- Community solutions β browse and upvote top solutions per problem
- SQL interview simulator β live timer, hints disabled, score report
Contributions are welcome! If you'd like to help:
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature - Commit your changes:
git commit -m 'Add your feature' - Push to the branch:
git push origin feature/your-feature - Open a Pull Request
High-priority areas:
- Adding new datasets (education, social media, logistics)
- More SQL problems (especially hard-level window function challenges)
- AI-powered query review integration
- UI/UX improvements
Please open an issue first for major changes so we can discuss the approach.
This project is open source and available under the MIT License.
Built with β€οΈ for the SQL community by Amarnath Allamraju
β If SQLit helped you, consider starring the repo!