๐ฏ Project Overview
A comprehensive, AI-powered SQL learning platform designed for seamless integration with Shopify stores. This interactive educational tool enables customers to learn SQL through hands-on practice with real database queries, progressive skill development, and personalized learning experiences.
๐ Vision Statement
Transform SQL education by providing an accessible, interactive learning environment that combines real database practice with intelligent tutoring, seamlessly integrated into e-commerce platforms.
๐ MVP Development Workflow
This project is structured into six core MVP components, each addressing critical aspects of the learning platform:
The foundational component providing secure, real-time SQL query execution through Supabase integration.
Key Features:
- Secure SQL query execution with Supabase PostgreSQL
- Real-time results display with JSON formatting
- Security restrictions (SELECT-only) with input validation
- Anonymous access with controlled permissions
- Cross-browser compatibility and responsive design
Structured learning content with progressive difficulty levels and comprehensive educational materials.
Key Features:
- Progressive learning levels (Beginner โ Intermediate โ Advanced)
- Comprehensive question bank with hints and explanations
- Real-world business scenarios (customers, orders, analytics)
- Interactive learning paths with skill progression tracking
User-friendly interface optimized for Shopify integration with responsive design and seamless UX.
Key Features:
- Bootstrap-based responsive interface
- Advanced SQL code editor with syntax highlighting
- Shopify theme integration and compatibility
- Mobile-optimized learning experience
- Interactive results display and data visualization
Comprehensive progress tracking, performance analytics, and personalized feedback mechanisms.
Key Features:
- Detailed progress tracking and skill assessment
- Performance analytics and learning insights
- Adaptive feedback and hint systems
- Shopify customer account integration
- Achievement systems and gamification elements
AI-powered intelligent tutoring, query evaluation, and personalized learning assistance.
Key Features:
- Intelligent query evaluation and feedback
- Natural language to SQL conversion
- Adaptive learning algorithms and personalization
- AI-powered tutoring and step-by-step guidance
- Smart error explanation and learning recommendations
Seamless integration with Shopifyโs authentication and payment systems for monetization and user management.
Key Features:
- Shopify customer authentication and single sign-on
- Subscription-based access control and tiered pricing
- Recurring billing through Shopifyโs payment infrastructure
- Corporate licensing and bulk pricing options
- Revenue analytics and subscription management
๐๏ธ Technical Architecture
Backend Infrastructure
- Database: Supabase PostgreSQL with Row Level Security
- API: Supabase RPC functions and REST endpoints
- Authentication: Supabase Auth with Shopify integration
- File Storage: Static hosting (GitHub Pages, Vercel, Netlify)
Frontend Technology
- Framework: Vanilla JavaScript with modern ES6+ features
- UI Library: Bootstrap 5 for responsive design
- Code Editor: Enhanced textarea with syntax highlighting
- API Client: Supabase JavaScript client library
Integration Strategy
- Shopify Embedding: Iframe integration with theme compatibility
- Customer Sync: Shopify Customer API integration
- Progress Storage: Supabase database with customer linking
- Analytics: Custom analytics with Shopify integration
๐ Learning Experience Design
Skill Progression Path
- Foundation: Basic SELECT, WHERE, ORDER BY
- Data Relationships: JOINs, foreign keys, table relationships
- Aggregation: GROUP BY, HAVING, COUNT, SUM, AVG
- Advanced Queries: Subqueries, window functions, CTEs
- Optimization: Indexes, query performance, best practices
Interactive Features
- Real-time query execution with immediate feedback
- Progressive hint system with guided learning
- Visual schema exploration and relationship mapping
- Achievement system with skill badges and progress tracking
- Peer learning through community features and leaderboards
๐ Project Structure
sql_practice/
โโโ ๐ src/ # Source code
โ โโโ ๐ frontend/ # Frontend application
โ โ โโโ ๐ html/ # HTML templates
โ โ โ โโโ index.html # Landing page with redirect
โ โ โ โโโ sql_editor.html # Main SQL editor interface
โ โ โโโ ๐ css/ # Stylesheets
โ โ โ โโโ style.css # Main application styles
โ โ โโโ ๐ js/ # JavaScript modules
โ โ โโโ config.js # Application configuration
โ โ โโโ database-manager.js # Supabase integration
โ โ โโโ question-manager.js # Question bank management
โ โ โโโ ui-manager.js # User interface controller
โ โ โโโ app.js # Main application coordinator
โ โโโ ๐ database/ # Database schema and functions
โ โโโ ๐ schema/ # Table definitions
โ โ โโโ create_tables_public.sql # Sample tables setup
โ โโโ ๐ functions/ # Stored procedures
โ โโโ run_sql_query.sql # Safe query execution function
โ โโโ fix_function_naming.sql # Function permissions setup
โโโ ๐ docs/ # Documentation
โ โโโ ๐ mvp-components/ # MVP documentation
โ โโโ MVP_01_SQL_Runtime_Integration.md
โ โโโ MVP_02_Content_Preparation.md
โ โโโ MVP_03_UI_Development.md
โ โโโ MVP_04_User_Progress_Feedback.md
โ โโโ MVP_05_AI_Driven_Evaluation.md
โ โโโ MVP_06_Authentication_Payment.md
โโโ ๐ config/ # Configuration files
โ โโโ .env.example # Environment variables template
โโโ ๐ tests/ # Test suite
โ โโโ README.md # Testing documentation
โโโ ๐ scripts/ # Build and deployment scripts
โ โโโ README.md # Scripts documentation
โโโ ๐ assets/ # Static assets (images, icons)
โโโ ๐ .gitignore # Git ignore patterns
โโโ ๐ฆ package.json # Node.js dependencies and scripts
โโโ ๐ README.md # Project overview (this file)
๐ง Modular Architecture
The project is now organized into clear, maintainable modules:
Frontend Modules
config.js: Central configuration management with environment variables
database-manager.js: Handles all Supabase interactions and query execution
question-manager.js: Manages question bank, hints, and learning content
ui-manager.js: Controls DOM manipulation and user interface updates
app.js: Main application coordinator that orchestrates all components
Database Organization
schema/: Table definitions and database structure
functions/: Stored procedures and database functions
- Separation of concerns: Schema vs. logic for maintainability
Documentation Structure
docs/mvp-components/: Detailed MVP component specifications
- Comprehensive guides: Setup, development, and deployment instructions
- Version-controlled documentation: Keeps docs in sync with code
๐ฆ Current Status & Next Steps
โ
Completed Milestones
๐ In Progress
๐ Upcoming Priorities
๐ฎ Future Roadmap
๐ ๏ธ Development Setup
Prerequisites
- Supabase account with project setup
- Modern web browser (Chrome, Firefox, Safari, Edge)
- Local web server for development (Python
http.server, Node.js http-server, etc.)
- Git for version control and deployment
Quick Start
- Clone Repository:
git clone [repository-url]
- Database Setup: Execute SQL files in Supabase SQL Editor
- Run
create_tables_public.sql for sample data
- Run
run_sql_query.sql for query execution function
- Run
fix_function_naming.sql for permissions
- Configuration: Update Supabase URL and API key in
sql_editor.html
- Local Testing: Start HTTP server and navigate to
index.html
- Shopify Integration: Follow guidelines in
MVP_03_UI_Development.md
Environment Configuration
// Update these values in sql_editor.html
const supabaseUrl = 'YOUR_SUPABASE_PROJECT_URL';
const supabaseKey = 'YOUR_SUPABASE_ANON_KEY';
๐ฏ Success Metrics & KPIs
Learning Effectiveness
- Question completion rate > 80%
- Average session duration > 10 minutes
- Skill progression rate (beginner โ intermediate โ advanced)
- Knowledge retention measured through spaced repetition
User Engagement
- Daily/weekly active users
- Session frequency and return visits
- Feature adoption rates (hints, explanations, advanced queries)
- User satisfaction scores and feedback ratings
- Page load time < 3 seconds
- Query execution response time < 2 seconds
- 99.9% uptime and availability
- Cross-browser compatibility score > 95%
Business Impact
- Shopify store integration success rate
- Customer learning engagement metrics
- Platform scalability (concurrent users handled)
- Cost efficiency (infrastructure costs per active user)
๐ค Contributing & Support
Development Contribution
- Review MVP component documentation for implementation details
- Follow established coding standards and best practices
- Test thoroughly across browsers and devices
- Update documentation for new features and changes
Content Contribution
- Design additional SQL questions and exercises
- Create learning materials and explanations
- Develop real-world case studies and scenarios
- Contribute to accessibility and internationalization efforts
- Report issues and bugs through GitHub Issues
- Suggest feature enhancements and improvements
- Share integration experiences and success stories
- Participate in testing and quality assurance
๐ License & Legal
Open Source Licensing
This project is released under MIT License, allowing for commercial use, modification, and distribution with proper attribution.
Privacy & Data Protection
- GDPR compliance for EU users
- Transparent data collection and usage policies
- User consent management for tracking and analytics
- Secure handling of customer information and learning progress
Educational Use
- Free for educational institutions and non-commercial learning
- Commercial licensing available for enterprise integrations
- Attribution required for derivative works and adaptations
๐ Contact & Support: For technical support, feature requests, or partnership inquiries, please use the GitHub Issues system or contact the development team directly.
๐ Star this repository if you find it useful for your SQL learning or Shopify integration projects!
- Visit supabase.com and sign up for an account
- Verify your email address
Step 2: Create a New Project
- Click โNew projectโ in the Supabase dashboard
- Enter project details:
- Name: โSQL Tutorial Sandboxโ
- Database Password: Create a strong password
- Region: Choose one closest to your users
- Pricing Plan: Free tier is sufficient for MVP
- Click โCreate new projectโ and wait for setup (2-3 minutes)
Step 3: Create Sample Databases
- Go to the SQL Editor in your Supabase dashboard
- Create tables for your SQL tutorial:
โ Create SCHEMA practice
โ Create basic tables for practice: dim_customers, fact_orders
- Run the script to set up your sample database
Step 4: Create a Secure API Key
- Go to โSettingsโ โ โAPIโ in your Supabase dashboard
- Under โProject API keysโ, copy your
anon public key
- Create a service role key with limited permissions (optional but recommended for security)
Part 2: Creating the SQL Playground Interface
Step 5: Create a Custom SQL Editor Page
โ Create index.html to redirect to sql_editor.html
โ Create sql_editor.html
Step 6: Add Stored Procedure for Safe SQL Execution
Create a safe execution environment for user SQL queries:
- Go to SQL Editor in Supabase
- Create this stored procedure:
โ Execute the query create_sql_executor.sql to create a function to safely execute SQL queries
Part 3: Embedding in Shopify
Step 7: Prepare Your Shopify Store
- Log in to your Shopify admin panel
- Go to โOnline Storeโ โ โThemesโ
- Find your active theme and click โCustomizeโ
Step 8: Create a New Page
- Go to โPagesโ โ โAdd pageโ
- Name it โSQL Practiceโ or similar
- Switch to HTML editor mode
Step 9: Embed the SQL Editor
โ Upload the HTML file to a web hosting service or GitHub Pages
โ Embed it in your Shopify page
Step 10: Add Custom Theme Code (Optional for Better Integration)
- Go to โThemeโ โ โEdit codeโ
- Add this snippet to your theme.liquid or appropriate section:
```liquid name=custom-sql-page-style.liquid
```
- In Supabase Dashboard, go to โSettingsโ โ โAPIโ
- Add your Shopify domain to the allowed domains list:
- Format:
https://your-store.myshopify.com
- Save changes
Part 4: Final Setup and Testing
Step 12: Add Question Database
- Create a table in Supabase for storing questions
- Add more questions as needed
Step 13: Test the Integration
- View your SQL Practice page on your Shopify store
- Try running a simple query:
SELECT * FROM customers;
- Test question selection and hints
- Ensure error messages are user-friendly
Step 14: Monitor and Adjust
- Set up rate limiting in Supabase to prevent abuse
-
Monitor database performance
- Collect user feedback using a simple form
Troubleshooting Common Issues
- CORS Errors: Double-check allowed domains in Supabase settings
- Iframe Not Loading: Ensure hosting service allows embedding
- SQL Function Errors: Verify the stored procedure was created successfully
- Slow Performance: Consider upgrading Supabase plan for more resources
Additional Tips
- Scaling to 100+ Users:
- Supabase free tier supports multiple concurrent connections
- For heavy usage, consider the Pro plan ($25/month)
- Security:
- The stored procedure prevents destructive operations
- Consider creating read-only database roles for extra security
- User Authentication (optional):
- Link to Shopify customer accounts using Supabase Auth
- Track individual user progress across sessions