A browser-based SQL learning platform where students can practice SQL queries against pre-configured assignments with real-time execution and AI-powered intelligent hints π€.
Screenshot 2025εΉ΄12ζ30ζ₯ 001621
- β¨ Features
- π Technology Stack
- π Architecture Overview
- π¦ Prerequisites
- π Installation
- π Environment Variables
βΆοΈ Running the Application- π Project Structure
- π Data Flow
- π API Documentation
- π Security Features
- π§ Technology Choices Explanation
- πΌ Screenshots
- π€ Contributing
- π License
- π Assignment Library β Browse SQL assignments by difficulty (Easy / Medium / Hard)
- π» Interactive SQL Editor β Write and execute SQL queries directly in the browser
- ποΈ Schema Viewer β View table structures and sample data
βΆοΈ Real-time Query Execution β Execute queries against a PostgreSQL sandbox database- π€ AI-Powered Hints β Intelligent guidance (hints only, no direct solutions)
- π Results Visualization β Scrollable, formatted result tables
β οΈ Error Handling β Clear syntax and logical error messages
- π‘ SQL injection prevention through query validation
- π Read-only database access for students
- β± Query execution timeout (5 seconds)
- π¦ API rate limiting
- β Whitelist-based SQL keyword filtering
- π± Mobile-first responsive design (320px β 1280px+)
- π Dark theme optimized for reading code
- π Touch-friendly UI elements (minimum 44px)
- β¨ Smooth animations and transitions
- π§© BEM methodology for SCSS organization
| Technology | Version | Purpose |
|---|---|---|
| β React | 18.2.0 | Component-based UI |
| π¨ SCSS | 1.70.0 | Styling with variables & nesting |
| π Axios | 1.6.5 | API communication |
| π§ React Router | 6.21.0 | Client-side routing |
| Technology | Version | Purpose |
|---|---|---|
| π’ Node.js | β₯18 | Runtime environment |
| π Express.js | 4.18.2 | Web framework |
| π PostgreSQL | β₯14 | Sandbox DB for query execution |
| π MongoDB | β₯6 | Assignment persistence |
| 𧬠Mongoose | 8.1.0 | MongoDB ODM |
- π§ OpenAI GPT-4 (Recommended)
- π Google Gemini
- π§ͺ Anthropic Claude
- π Morgan β HTTP request logging
- π‘ Helmet β Security headers
- π CORS
- π¦ Express Rate Limit
- π Nodemon
graph TD A[CLIENT: React + SCSS] -- Axios API Calls --> B[EXPRESS SERVER] B --> C[PostgreSQL: Sandbox Execution] B --> D[MongoDB: User Data & Metadata] B --> E[LLM API: AI Hints/Feedback]
cipher-sql-studio/
β
βββ client/ # Frontend React App
β βββ public/ # Static assets
β βββ src/
β βββ components/ # UI Components (Editor, Results, Sidebar)
β βββ services/ # API service layer (Axios)
β βββ hooks/ # Custom React hooks
β βββ styles/ # SCSS / CSS modules
β βββ App.jsx # Root component
β βββ index.js # React entry point
β
βββ server/ # Backend Express App
β βββ src/
β β βββ config/ # DB & App configuration
β β βββ models/ # MongoDB schemas (Metadata/Assignments)
β β βββ controllers/ # Route handlers
β β βββ services/ # Business logic & LLM integration
β β βββ routes/ # API endpoints
β β βββ middleware/ # Security & Error handling
β βββ seeds/ # Database seeders
β
βββ database/ # Database scripts
β βββ postgres/
β βββ schema.sql # Sandbox table definitions
β βββ sample_data.sql# Initial sandbox data
β
βββ docs/ # Documentation (API, Architecture)
Create a .env file in the server directory:
Code snippet
- PORT=5000
- NODE_ENV=development
- POSTGRES_HOST=localhost
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=your_password
- POSTGRES_DB=cipher_sql_sandbox -MONGODB_URI=mongodb://localhost:27017/cipher_sql_studio
- LLM_PROVIDER=openai
- OPENAI_API_KEY=sk-your-key-here
-MAX_QUERY_EXECUTION_TIME=5000 -MAX_RESULT_ROWS=1000
To get the environment up and running, open two separate terminal windows:
πΉ Terminal 1: Backend
cd server
npm run dev| Component | URL |
|---|---|
| π¨ Frontend UI | http://localhost:3000 |
| π Backend API | http://localhost:5000/api |
| β€οΈ Health Check | http://localhost:5000/api/health |
- π‘οΈ Security: The PostgreSQL sandbox is designed for read-only or simulated environments. Ensure user permissions are strictly restricted in production to prevent unauthorized data modification.
- π€ AI Hints: Execution and rate limits apply based on your chosen LLM provider's subscription plan.
- π οΈ Troubleshooting: If you encounter any issues, please check the logs in the server terminal for detailed error messages.
β¨ Happy Coding! You are all set to start building with CipherSQLStudio.