A comprehensive, Wikipedia-style SQL knowledge resource with AI-powered features
SQLpedia is an open-source, community-driven SQL knowledge resource that provides comprehensive documentation, examples, and comparisons for multiple SQL dialects. Built with VitePress and enhanced with AI-powered tools, it helps developers, data engineers, and database administrators learn SQL, compare dialects, and solve real-world problems.
- ποΈ Multi-Database Coverage - PostgreSQL, MySQL, SQL Server, Oracle, SQLite, BigQuery, Snowflake, DuckDB, and more
- π Dialect Comparisons - Side-by-side syntax comparisons and migration guides
- π€ AI-Powered Assistance - Generate, explain, optimize, and translate SQL queries
- π Comprehensive Patterns - Real-world SQL patterns for analytics, ETL, and optimization
- π StackQL Integration - Query cloud infrastructure and APIs using SQL
- π Community-Driven - Open source with contributions via GitHub
- β‘ Fast & Modern - Built with VitePress for lightning-fast performance
- π¨ Wikipedia-Inspired - Familiar layout and intuitive navigation
graph TB
subgraph "User Interface"
A[Browser] --> B[VitePress Site]
B --> C[Vue Components]
C --> D[SQLAssistant]
C --> E[SQLComparison]
C --> F[CodePlayground]
end
subgraph "Content Layer"
G[Markdown Files] --> B
H[Static Assets] --> B
I[Search Index] --> B
end
subgraph "Backend Services"
D --> J[Netlify Functions]
J --> K[sql-assist Function]
end
subgraph "AI Integration"
K --> L{AI Provider}
L --> M[OpenAI GPT-4]
L --> N[Anthropic Claude]
L --> O[Self-Hosted Models]
K --> P[Response Cache]
K --> Q[Rate Limiter]
end
subgraph "Deployment"
B --> R[Static Build]
R --> S[Netlify CDN]
J --> T[Serverless Functions]
end
subgraph "Version Control"
U[GitHub Repository] --> V[Git Commits]
V --> W[GitHub Actions]
W --> R
end
S --> A
T --> K
style A fill:#e1f5ff
style B fill:#fff4e1
style D fill:#ffe1f5
style E fill:#ffe1f5
style F fill:#ffe1f5
style K fill:#e1ffe1
style M fill:#f5e1ff
style N fill:#f5e1ff
style O fill:#f5e1ff
style S fill:#ffe1e1
-
Frontend (VitePress)
- Static site generation with Vue 3
- Markdown-based content
- Custom Vue components for interactive features
- Built-in search functionality
-
Interactive Components
SQLAssistant: AI-powered SQL generation, explanation, optimization, and translationSQLComparison: Side-by-side dialect comparisonCodePlayground: Interactive SQL editor (coming soon)
-
Backend (Netlify Functions)
- Serverless functions for AI integration
- Response caching for performance
- Rate limiting for API protection
- Support for multiple AI providers
-
AI Integration
- OpenAI (GPT-4, GPT-3.5)
- Anthropic (Claude)
- Self-hosted models (Llama, CodeLlama)
- Automatic fallback and error handling
-
Deployment
- Netlify CDN for global distribution
- GitHub Actions for CI/CD
- Automatic preview deploys for PRs
- Node.js 18 or higher
- npm or yarn
- Git
- Clone the repository
git clone https://github.com/stackql/sqlpedia.org.git
cd sqlpedia.org- Install dependencies
npm install- Start development server
npm run devThe site will be available at http://localhost:5173
- Build for production
npm run build- Preview production build
npm run previewsqlpedia.org/
βββ docs/ # Documentation content
β βββ .vitepress/ # VitePress configuration
β β βββ config.mts # Site configuration
β β βββ theme/ # Custom theme
β β βββ index.ts # Theme entry point
β β βββ style.css # Custom styles
β β βββ components/ # Vue components
β β βββ SQLAssistant.vue
β β βββ SQLComparison.vue
β β βββ CodePlayground.vue
β βββ index.md # Homepage
β βββ databases/ # Database-specific docs
β β βββ postgresql/
β β βββ mysql/
β β βββ sqlserver/
β β βββ ...
β βββ concepts/ # SQL concepts
β β βββ basics/
β β βββ joins/
β β βββ window-functions/
β β βββ ...
β βββ patterns/ # SQL patterns
β β βββ analytics/
β β βββ etl/
β β βββ ...
β βββ comparisons/ # Dialect comparisons
β β βββ dialect-differences.md
β β βββ migration-guides.md
β βββ stackql/ # StackQL docs
β βββ cloud-apis.md
β βββ infrastructure.md
βββ netlify/
β βββ functions/ # Netlify Functions
β βββ sql-assist.mts # AI assistance endpoint
βββ netlify.toml # Netlify configuration
βββ package.json # Dependencies
βββ README.md # This file
The main configuration is in docs/.vitepress/config.mts. Key settings:
- Site metadata: Title, description, language
- Navigation: Top nav and sidebar menus
- Search: Local search configuration
- Theme: Colors, fonts, layout options
- Markdown: Code highlighting, plugins
Configuration is in netlify.toml:
- Build settings: Command, output directory
- Functions: Serverless function configuration
- Redirects: API routing
- Headers: Security and caching headers
For AI features to work, set these in Netlify dashboard or .env file:
# OpenAI (optional)
OPENAI_API_KEY=your-openai-api-key
# Anthropic (optional)
ANTHROPIC_API_KEY=your-anthropic-api-key
# At least one AI provider key is required for AI featuresNote: If no API keys are provided, the system falls back to demo/mock responses.
-
Create Netlify account at netlify.com
-
Connect repository
- Click "Add new site" β "Import an existing project"
- Connect your GitHub account
- Select the
sqlpedia.orgrepository
-
Configure build settings
- Build command:
npm run build - Publish directory:
docs/.vitepress/dist - Functions directory:
netlify/functions
- Build command:
-
Set environment variables (optional, for AI features)
- Go to Site settings β Environment variables
- Add
OPENAI_API_KEYorANTHROPIC_API_KEY
-
Deploy
- Click "Deploy site"
- Your site will be live at
https://your-site-name.netlify.app
# Install Netlify CLI
npm install -g netlify-cli
# Login to Netlify
netlify login
# Initialize Netlify (first time only)
netlify init
# Deploy
netlify deploy --prod- Go to Netlify dashboard β Domain settings
- Add custom domain
- Configure DNS according to Netlify instructions
- SSL certificate is automatically provisioned
We welcome contributions from the community! Here's how you can help:
-
Add Content
- Write new SQL guides and tutorials
- Add database-specific documentation
- Create pattern examples
- Improve existing content
-
Fix Issues
- Report bugs
- Fix typos and errors
- Improve code examples
- Update outdated information
-
Enhance Features
- Improve Vue components
- Add new interactive features
- Optimize performance
- Improve accessibility
- Fork the repository
# Click "Fork" on GitHub, then clone your fork
git clone https://github.com/YOUR-USERNAME/sqlpedia.org.git
cd sqlpedia.org- Create a feature branch
git checkout -b feature/your-feature-name-
Make your changes
- Edit markdown files in
docs/ - Test locally with
npm run dev - Follow existing content structure and style
- Edit markdown files in
-
Commit your changes
git add .
git commit -m "Add: your descriptive commit message"- Push to your fork
git push origin feature/your-feature-name- Create a Pull Request
- Go to the original repository on GitHub
- Click "New Pull Request"
- Select your fork and branch
- Describe your changes
- Submit the PR
- Use clear, concise language
- Include code examples with explanations
- Add cross-references to related topics
- Follow existing page templates
- Test code examples before submitting
- Use proper SQL formatting
See CONTRIBUTING.md for detailed guidelines.
Create new pages using this template:
---
title: Your Topic Title
description: Brief description of the topic
databases: [PostgreSQL, MySQL, etc.]
difficulty: beginner|intermediate|advanced
tags: [relevant, tags]
---
# Your Topic Title
<div class="difficulty-badge difficulty-beginner">Beginner</div>
## Quick Reference
\`\`\`sql
-- Quick example code
SELECT \* FROM table;
\`\`\`
## Overview
Brief explanation of the topic...
## Syntax
Detailed syntax information...
## Examples
### Basic Example
...
### Advanced Example
...
## Platform-Specific Notes
::: details PostgreSQL
PostgreSQL-specific information...
:::
## Performance Considerations
Tips and best practices...
## Common Pitfalls
What to avoid...
## See Also
- [Related Topic 1](/path/to/topic)
- [Related Topic 2](/path/to/topic)<SQLAssistant
mode="generate|explain|optimize|translate"
default-dialect="postgresql"
:show-model-selector="true"
/><SQLComparison
:dialects="['postgresql', 'mysql', 'sqlserver']"
/># Lint code
npm run lint
# Format code
npm run formatVitePress supports HMR. Changes to markdown files and Vue components are reflected immediately without full page reload.
# Add production dependency
npm install package-name
# Add development dependency
npm install -D package-name- Static site generation for fast page loads
- Automatic code splitting
- Image optimization
- Minified CSS and JavaScript
- Tree-shaking for minimal bundle size
- Lazy loading of components
- Virtual scrolling for long lists
- Response caching for AI features
- CDN distribution via Netlify
- Performance: 95+
- Accessibility: 95+
- Best Practices: 95+
- SEO: 100
- Semantic HTML structure
- Meta descriptions for all pages
- Open Graph tags
- Sitemap generation
- robots.txt
- Structured data
- Fast page loads
- Mobile-responsive design
- Chrome (latest)
- Firefox (latest)
- Safari (latest)
- Edge (latest)
- Mobile browsers (iOS Safari, Chrome Mobile)
- Netlify - Hosting and serverless functions
- Netlify Functions - Serverless backend
- OpenAI API - GPT models (optional)
- Anthropic API - Claude models (optional)
- TypeScript - Type safety
- ESLint - Code linting
- Prettier - Code formatting
- Hosting: Free (Netlify)
- Functions: Free tier (125K requests/month)
- Bandwidth: Free (100GB/month)
- Build minutes: Free (300 minutes/month)
- Domain: ~$12/year
Total: ~$1/month (essentially free)
- OpenAI API: ~$10-30/month (GPT-3.5)
- Anthropic API: ~$15-40/month (Claude)
- Self-hosted: Free (but requires infrastructure)
Recommendation: Start with free tier, add AI keys as needed
- VitePress setup
- Basic theme and navigation
- Initial content structure
- Netlify deployment
- Core SQL concepts (20+ pages)
- Database-specific guides (50+ pages)
- Pattern library (30+ pages)
- Migration guides
- SQL generation
- Query explanation
- Query optimization
- Dialect translation
- Community contributions system
- User accounts (optional)
- Bookmarking and favorites
- Learning paths
- SQL playground with execution
- Interactive tutorials
- Video content
- Mobile app
# Clear cache and node_modules
rm -rf node_modules .vitepress/cache .vitepress/dist
npm install
npm run build- Check environment variables are set
- Verify API keys are valid
- Check function logs in Netlify dashboard
- Test with mock responses (no API key)
- Search is generated during build
- Rebuild the site:
npm run build - Check browser console for errors
This project is licensed under the MIT License - see the LICENSE file for details.
- StackQL - Infrastructure as Code with SQL
- VitePress - Static site generator
- Netlify - Hosting and serverless functions
- OpenAI & Anthropic - AI models
Thank you to all our contributors! See CONTRIBUTORS.md for the full list.
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Twitter: @stackql
- Check existing documentation
- Search GitHub issues
- Ask in GitHub Discussions
- Create a new issue with detailed information
Inspired by:
- Wikipedia - For the concept and layout
- MDN Web Docs - For documentation style
- SQL standards and communities worldwide
Built with β€οΈ by the SQL community