A modern, full-featured web application for managing, organizing, and sharing SQL queries with advanced collaboration features.
SQL Query Manager is a comprehensive Next.js application that provides developers and data analysts with a powerful platform to store, organize, execute, and share SQL queries. Built with modern web technologies, it offers both individual productivity features and team collaboration capabilities.
- Create & Store: Save SQL queries with names, descriptions, and metadata
- Version Control: Track query versions and changes over time
- Rich Editor: Syntax highlighting and code formatting for SQL
- Result Storage: Save query results and screenshots for reference
- Favorites System: Mark important queries for quick access
- Tag System: Organize queries with custom tags and categories
- Advanced Search: Find queries by name, description, tags, or content
- Filtering: Filter by favorites, tags, visibility, and date ranges
- Smart Categorization: Automatic organization suggestions
- Public/Private Queries: Control query visibility and sharing
- Public Query Feed: Browse and discover queries shared by the community
- User Profiles: View queries by specific users
- Read-only Sharing: Safe sharing without edit permissions
- Dark/Light Mode: Toggle between themes for comfortable viewing
- Color Themes: Multiple color schemes (Ocean, Forest, Sunset, Purple, Rose, etc.)
- Responsive Design: Works seamlessly on desktop, tablet, and mobile
- Intuitive Interface: Clean, modern UI with excellent usability
- User Authentication: Secure login system with NextAuth.js
- Row-Level Security: Database-level access control
- Owner Permissions: Only query owners can edit or change visibility
- Admin Panel: Administrative controls for user and query management
The application leverages Supabase as its primary cloud database solution, providing:
- PostgreSQL Database: Robust, scalable relational database in the cloud
- Real-time Subscriptions: Live updates when queries are shared or modified
- Row Level Security (RLS): Database-level access control for user data protection
- Authentication Integration: Seamless user management with built-in auth
- Automatic Backups: Enterprise-grade data protection and recovery
- Global CDN: Fast data access from anywhere in the world
- RESTful APIs: Auto-generated APIs for all database operations
- Supabase Integration: Cloud-based PostgreSQL with real-time features
- Local Storage: Client-side storage for offline usage
- Flexible Backend: Adaptable storage layer supporting multiple backends
- Next.js 15 - React framework with App Router
- React 19 - Modern React with latest features
- TypeScript - Type-safe development
- Tailwind CSS 4 - Utility-first styling
- Heroicons - Beautiful SVG icons
- Prism.js - SQL syntax highlighting
- Supabase - PostgreSQL database with real-time subscriptions
- NextAuth.js - Authentication and session management
- Row Level Security - Database-level access control
- RESTful APIs - Clean API design with proper HTTP methods
- Jest - Unit and integration testing
- React Testing Library - Component testing
- ESLint - Code linting and formatting
- TypeScript - Static type checking
- Turbopack - Fast development and builds
- Node.js 18+
- npm, yarn, or pnpm
- Supabase account (for cloud storage)
-
Clone the repository
git clone https://github.com/ilesanmi-007/SQL-Query-Manager.git cd SQL-Query-Manager -
Install dependencies
npm install # or yarn install # or pnpm install
-
Environment setup
cp .env.local.example .env.local # Edit .env.local with your configuration -
Database setup
# Run the schema in your Supabase project psql -f supabase-schema.sql # Apply visibility migration if upgrading psql -f migration-add-visibility.sql
-
Start development server
npm run dev # or yarn dev # or pnpm dev
-
Open in browser Navigate to http://localhost:3000
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=your-secret-key
SUPABASE_URL=your-supabase-url
SUPABASE_ANON_KEY=your-supabase-anon-keyThe application uses PostgreSQL with the following main tables:
users- User accounts and profilesqueries- SQL queries with metadatatags- Query categorization system
- Fill in the query name and description
- Write your SQL query in the code editor
- Add query results (text or upload an image)
- Select relevant tags or create new ones
- Mark as favorite if needed
- Click "Save Query" to store
- View All: Navigate to
/savedto see all stored queries - Search: Use the search bar to find specific queries
- Filter: Filter by tags, favorites, or date ranges
- Edit: Click on any query to modify and create new versions
- Delete: Remove queries you no longer need
- Each edit creates a new version automatically
- View version history with timestamps
- Compare different versions of the same query
- Restore previous versions when needed
- Create custom tags for better organization
- Assign multiple tags to queries
- Filter queries by specific tags
- Manage tag colors and descriptions
- Export: Download all queries as a JSON backup file
- Import: Upload and restore queries from backup files
- Selective Import: Choose which queries to import
sql-query-manager/
βββ src/
β βββ app/
β β βββ saved/ # Saved queries page
β β βββ public/ # Public queries page
β β βββ api/ # API routes
β β βββ globals.css # Global styles
β β βββ layout.tsx # Root layout
β β βββ page.tsx # Main query creation page
β βββ components/ # React components
β βββ utils/
β β βββ exportImport.ts # Export/import functionality
β β βββ sqlValidator.ts # SQL syntax validation
β β βββ tagManager.ts # Tag management system
β βββ lib/ # Library functions
β βββ types/ # TypeScript type definitions
βββ package.json
βββ README.md
npm run dev- Start development server with Turbopacknpm run build- Build production applicationnpm start- Start production servernpm run lint- Run ESLint for code qualitynpm test- Run Jest testsnpm run test:watch- Run tests in watch mode
- Store frequently used SQL queries
- Build a personal knowledge base of database operations
- Track query performance and results over time
- Organize queries by project or functionality
- Share common queries across team members
- Collaborate on complex data analysis
- Maintain a centralized query repository
- Document data workflows and procedures
- Create a company-wide SQL knowledge base
- Standardize common database operations
- Enable knowledge sharing between teams
- Maintain query documentation and best practices
GET /api/queries- List user queriesPOST /api/queries- Create new queryGET /api/queries/[id]- Get specific queryPUT /api/queries/[id]- Update queryDELETE /api/queries/[id]- Delete queryPATCH /api/queries/[id]/visibility- Toggle visibility
GET /api/queries/public- List all public queriesGET /public- Public queries page (no auth required)
POST /api/auth/signin- User loginPOST /api/auth/signup- User registrationPOST /api/auth/signout- User logout
# Run all tests
npm test
# Run tests in watch mode
npm run test:watch
# Run specific test file
npm test -- visibility.test.ts- Private Queries: Only visible to the owner
- Public Queries: Visible to all users in the public feed
- Owner Controls: Toggle visibility with a single click
- Security: Database-level access control ensures data privacy
- Create custom tags for query organization
- Color-coded tag system for visual organization
- Filter queries by single or multiple tags
- Automatic tag suggestions based on query content
- Track all changes to queries over time
- Compare different versions side-by-side
- Restore previous versions when needed
- Maintain complete audit trail
The application supports both light and dark themes. Toggle using the sun/moon icon in the header.
Create custom tags with:
- Custom names and descriptions
- Color coding for visual organization
- Hierarchical categorization
All data is stored locally in your browser's localStorage. To backup your data:
- Use the export feature to download a JSON file
- Import the file on any device to restore your queries
- Push your code to GitHub
- Connect your repository to Vercel
- Deploy with zero configuration
The application can be deployed on any platform that supports Next.js:
- Netlify
- AWS Amplify
- Railway
- Render
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
We welcome contributions! Please see our Contributing Guidelines for details on:
- Code style and standards
- Pull request process
- Issue reporting
- Development setup
This project is open source and available under the MIT License.
- Documentation: Check the
/docsfolder for detailed guides - Issues: Report bugs via GitHub Issues
- Discussions: Join community discussions in GitHub Discussions
- Email: ilesanmi3451@gmail.com
- Query Execution: Direct database connection and query execution
- Result Visualization: Charts and graphs for query results
- Team Workspaces: Shared spaces for team collaboration
- Query Templates: Reusable query patterns and snippets
- Advanced Analytics: Query performance tracking and optimization
- Export/Import: Backup and migration tools
- API Integration: REST API for external tool integration
- Multi-database Support: Connect to various database types
- Real-time Collaboration: Live editing and sharing
- AI-powered Suggestions: Smart query completion and optimization
- Enterprise Features: SSO, audit logs, and compliance tools
Built with β€οΈ by Ilesanmi
Transform your SQL workflow with intelligent query management and seamless collaboration.