An interactive browser SQL learning app, now with a SQL Server practice mode in /sandbox.
This is a learning simulator, not a real SQL Server engine. User-entered SQL Server (T-SQL) is transpiled internally and executed in-browser.
- Interactive SQL Lessons: Step-by-step tutorials covering SQL basics to more advanced topics
- Live SQL Editor: Execute queries and see results immediately
- Built-in Database: Practice with a pre-populated e-commerce database
- Instant Feedback: Get helpful error messages and validation for your queries
- Progress Tracking: Your progress is saved automatically to local storage
- Zero Backend Required: Everything runs client-side using SQL.js
- SQL Server (T-SQL) Practice Lab: SQL Server-style practice workflow with compatibility feedback
- Dark Mode Toggle: Theme switch in the top navigation with local persistence
- Keyboard-First Command Palette:
Ctrl/Cmd+Kglobal command menu with nested pages and quick navigation
- Frontend: React, Next.js 15
- Language: TypeScript
- Styling: Tailwind CSS
- SQL Engine: SQL.js (SQLite compiled to WebAssembly)
- State Management: React hooks with local storage persistence
- Node.js 20.x or later
- npm, yarn, or pnpm
-
Clone the repository:
git clone https://github.com/HenryGetz/BuddySQLServer.git cd BuddySQLServer -
Install dependencies:
npm install # or yarn install # or pnpm install
-
Start the development server:
npm run dev # or yarn dev # or pnpm dev
-
Open http://localhost:3000 with your browser to see the result.
-
Open http://localhost:3000/sandbox for SQL Server practice mode.
This repository is configured for GitHub Pages static hosting:
- Next.js static export is enabled in
next.config.ts(output: "export"). - GitHub Pages project path is configured with:
basePath: "/BuddySQLServer"andassetPrefix: "/BuddySQLServer/". - Build output is generated in
out/. - Deployment workflow is in
.github/workflows/deploy-pages.yml.
npm ci
npm run buildAfter build:
out/contains static files for deploymentout/404.htmlis generated fromout/index.htmlfor deep-link fallbackout/.nojekyllis created for GitHub Pages compatibility
- Learner writes SQL Server (T-SQL) in the sandbox editor.
- App transpiles it with Polyglot (SQL Server (T-SQL) -> SQLite).
- App executes transpiled SQL in SQL.js (browser/WASM).
- Learner sees only SQL Server practice-oriented UX and feedback.
Normal UI does not show transpiled SQL. For local debugging only, set:
localStorage.setItem("sql-playground-debug-transpiled-sql", "true")
- Toggle is in the header (
moon/sunbutton). - Persisted to
localStoragekeysql-playground-theme. - Uses class-based theme switching (
darkon<html>). - Sandbox editor, cards, buttons, tables, results, and error/compatibility panels are readable in both themes.
Ctrl/Cmd+K: Open/close the global command palettegtheni: Jump directly to/sandbox(when not typing in a form field)- In any SQL Server (T-SQL) editor box:
Ctrl/Cmd+EnterorF5runs the current SQL Server (T-SQL) statement
The command palette includes:
- nested command pages (
Go to ->,Settings ->) Backspaceto return to previous palette page when search is empty- focus trapping and focus restore on close
aria-livepolite announcements for command result counts while searching
Sandbox statements return one of:
success: statement executed in practice mode.caveat: executed but SQL Server-specific behavior may differ.failed: transpilation or execution failed in this practice environment.
Learner-facing messages avoid SQLite implementation jargon.
TOP + ORDER BYSELECT + WHEREJOIN + aliasesGROUP BYCREATE TABLEINSERT INTOQuery created table
- Basic
SELECT,WHERE,ORDER BY JOINGROUP BYand simple aggregatesTOPin many query cases- Basic
CREATE TABLE/INSERT
- Procedural SQL Server (T-SQL) (
DECLARE, variables, control flow) - SQL Server administrative/procedural constructs (
EXEC, stored proc flows) - More advanced SQL Server-specific syntax not mapped by current transpiler/runtime
- App and sandbox load successfully.
- Main sandbox UI renders (schema panel, quick examples, editor, result area).
- Editor accepts SQL Server (T-SQL) input and runs through existing flow.
- Working scenarios confirmed in browser:
TOP,SELECT+WHERE,JOIN,GROUP BY,CREATE TABLE,INSERT, follow-upSELECT. - Failure scenarios confirmed in browser with readable messaging: variable/procedural and unsupported proc calls.
- Theme toggle verified in browser for both light and dark modes.
- Dark mode persistence verified via
localStorageand page reload. - No fatal runtime console errors were observed during these manual flows.
/app: Next.js app directory structure with pages and layouts/components: React components organized by purpose/hooks: Custom React hooks including SQL.js integration/lib: Utility functions, database initialization, and lesson content/types: TypeScript type definitions/public: Static assets
- SqlEditor: Interactive SQL editor with query execution and feedback
- LessonContent: Markdown-rendered lesson content with code highlighting
- useSqlJs: Custom hook to initialize and interact with SQL.js
- lessons.ts: Content and structure of all SQL lessons
The application includes a sample e-commerce database with the following tables:
- Customers: customer information
- Products: product catalog
- Orders: order information
- Order_Items: individual items within orders
- Introduction to SQL
- SELECT Basics
- Filtering with WHERE
- Sorting Results
- Aggregate Functions
- Grouping Data
- Basic JOINs
Contributions are welcome! Feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'Add some amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- SQL.js - SQLite compiled to WebAssembly
- Next.js - The React framework
- Tailwind CSS - Utility-first CSS framework