A zero-install, in-browser PostgreSQL learning platform with AI-powered SQL assistance
QueryLab is a full-stack application for learning SQL in your browser. It features a Monaco editor, client-side PostgreSQL execution powered by PGlite (the best engine matching standard SQL format), AI-powered SQL generation, and a beautiful mobile-first UI.
- Node.js 18+
- npm or pnpm
- DeepSeek API key (for AI features)
- Resend API key (for email verification)
-
Clone the repository:
git clone https://github.com/zamdevio/querylab.git cd querylab -
Set up Backend:
cd Backend npm install # Configure ENVIRONMENT in wrangler.jsonc (development or production) # Set secrets via .dev.vars (local) or Wrangler secrets (production) # See Backend/README.md for detailed setup instructions
-
Set up Frontend:
cd Frontend npm install # Configure NEXT_PUBLIC_API_URL in .env.local or edit "DEFAULT_API_URL" in Frontend/src/lib/config.ts # See Frontend/README.md for detailed setup instructions
For detailed setup and deployment guides, see:
- Backend README - Backend setup, configuration, and deployment
- Frontend README - Frontend setup, configuration, and deployment
QueryLab/
├── Backend/ # Hono backend (Cloudflare Workers)
│ ├── src/
│ │ ├── app.ts # Main Hono app
│ │ ├── routes/ # API routes
│ │ └── lib/ # Services and utilities
│ ├── wrangler.jsonc # Cloudflare Workers config
│ └── README.md # Backend documentation
│
├── Frontend/ # Next.js frontend
│ ├── app/ # Next.js App Router pages
│ ├── src/
│ │ ├── components/ # React components
│ │ └── lib/ # Utilities and clients
│ ├── public/ # Static assets
│ └── README.md # Frontend documentation
│
└── Documentations/ # Detailed documentation (markdown files)
- 🎨 Beautiful UI with light/dark mode
- 📱 Mobile-first responsive design
- 💻 Monaco SQL editor with syntax highlighting
- 🗄️ PGlite: PostgreSQL compiled to WebAssembly - the best engine matching standard SQL format
- 🤖 AI-powered SQL generation and error fixing
- 💾 IndexedDB persistence for databases
- 📤 Import/Export .sql files
- ⌨️ Keyboard shortcuts (Cmd/Ctrl+Enter to run)
- 📊 Interactive schema explorer
- 🔐 Email-based authentication
- ⚡ Rate limiting and security
- Client-Side Execution: All SQL runs in your browser - your data never leaves your device
- Edge-Ready Backend: Cloudflare Workers for global performance
- AI Integration: DeepSeek AI for intelligent SQL assistance
- Modern Stack: Next.js 16, React 19, Hono, PGlite
- Write SQL: Type your SQL queries in the Monaco editor
- Run Query: Press
Cmd/Ctrl+Enteror click "Run Query" - Ask AI: Click "Ask AI" to generate SQL from natural language
- Fix Errors: Use "Fix With AI" when you encounter SQL errors
- Explore Schema: Click on tables in the schema explorer
- Import/Export: Use the buttons to import or export .sql files
- Backend README - Complete backend setup, configuration, API reference, and deployment guide
- Frontend README - Complete frontend setup, configuration, and deployment guide
📖 Getting Started: See
Documentations/getting-started.mdfor a complete beginner's guide
📖 API Reference: See
Documentations/api-reference.mdfor detailed API documentation
📖 Deployment Guide: See
Documentations/deployment.mdfor step-by-step deployment instructions
📖 Authentication: See
Documentations/authentication.mdfor authentication flow and security details
📖 Database Management: See
Documentations/database-management.mdfor database operations guide
📖 SQL Editor: See
Documentations/sql-editor.mdfor SQL editor features and shortcuts
📖 AI Features: See
Documentations/ai-features.mdfor AI-powered SQL generation and fixing
📖 Troubleshooting: See
Documentations/troubleshooting.mdfor common issues and solutions
Frontend:
- Next.js 16 (App Router) + React 19
- PGlite (PostgreSQL compiled to WebAssembly)
- Monaco Editor (VS Code editor)
- Tailwind CSS
- IndexedDB
Backend:
- Hono (web framework)
- Cloudflare Workers (edge runtime)
- Durable Objects (state management)
- DeepSeek AI (SQL generation)
- Resend (email service)
See Backend/README.md and Frontend/README.md for detailed tech stack information.
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions welcome! Please open an issue or submit a PR.