MeshAG is an intelligent database performance monitoring and optimization platform that helps developers and DBAs monitor, analyze, and optimize their database performance using AI-powered insights.
MeshAG automatically monitors your PostgreSQL and MySQL databases, collects performance metrics, identifies slow queries, and provides AI-powered optimization suggestions. It runs background jobs using Temporal.io to continuously analyze your database performance and generate actionable recommendations.
- 🔌 Multi-Database Support: Connect to PostgreSQL and MySQL databases
- 📊 Performance Monitoring: Automatic collection of query statistics, execution times, and resource usage
- 🐌 Slow Query Detection: Identifies and tracks slow-running queries
- 🤖 AI-Powered Suggestions: Uses GPT-4 to generate optimization recommendations for indexes, queries, and schema
- 📈 Analytics Dashboard: Visualize query performance, index usage, and table access patterns
- 🔒 Secure Credentials: Encrypted storage of database credentials
- 🌐 Proxy Support: Optional SOCKS5 proxy for database connections
- ⚡ Background Processing: Temporal.io workflows for reliable, scalable background jobs
- Framework: Next.js 16 with App Router
- Database: PostgreSQL (application database)
- ORM: Prisma
- Background Jobs: Temporal.io
- Authentication: Clerk
- AI: OpenAI GPT-4
- UI: Tailwind CSS, Radix UI, Framer Motion
- Language: TypeScript
- Bun 1.0+
- PostgreSQL database (for application data)
- Temporal Cloud account or self-hosted Temporal server
- Clerk account for authentication
- OpenAI API key
-
Clone the repository
git clone <repository-url> cd meshag
-
Install dependencies
bun install
-
Set up environment variables
Copy
.env.exampleto.envand fill in the required values:cp .env.example .env
Required environment variables:
DATABASE_URL: PostgreSQL connection URL for application dataNEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: Clerk publishable keyCLERK_SECRET_KEY: Clerk secret keyWEBHOOK_SECRET: Clerk webhook secretENCRYPTION_KEY: Key for encrypting database credentials (generate withopenssl rand -hex 32)TEMPORAL_ADDRESS: Temporal server addressTEMPORAL_NAMESPACE: Temporal namespaceTEMPORAL_TASK_QUEUE: Temporal task queue nameTEMPORAL_API_KEY: Temporal API key (for Temporal Cloud)OPENAI_API_KEY: OpenAI API key for generating suggestionsPROXY_URL(optional): SOCKS5 proxy URL for database connections
-
Run database migrations
bun run prisma:migrate
-
Generate Prisma client
bun run prisma:generate
-
Start the development server
bun dev
Open http://localhost:3000 to view the application.
-
Start the Temporal worker (in a separate terminal)
bun run temporal:worker
MeshAG is designed to be deployed using Docker. We provide pre-built images for both the web application and the Temporal worker.
The easiest way to run MeshAG in production is using Docker Compose. This will spin up the Next.js application, the Temporal worker, and optionally a local Temporal server and PostgreSQL database if needed.
-
Configure Environment
Ensure your
.envfile is populated with production values. -
Run with Docker Compose
If you want to use the pre-built images from our registry:
# Set your GitHub username to pull the correct images docker-compose up -dThis will start:
- app: The Next.js web application (port 3000)
- worker: The Temporal worker for background tasks
- postgres: A local PostgreSQL instance (if DATABASE_URL is not provided)
- temporal-server: A local Temporal dev server (for testing/self-hosted)
You can also run the containers individually.
Web Application:
docker run -d \
--name meshag-app \
-p 3000:3000 \
--env-file .env.production \
ghcr.io/meshag-ai/monitor/monitor:latestTemporal Worker:
docker run -d \
--name meshag-worker \
--env-file .env.production \
ghcr.io/meshag-ai/monitor/worker:latestFor developers and AI agents working with the codebase, see CRUSOR.md for comprehensive documentation on:
- Application architecture and structure
- Database schema and models
- Temporal workflows and activities
- API routes and endpoints
MeshAG is dual-licensed:
- AGPLv3: Free for open-source and personal use
- Commercial License: Required for proprietary/SaaS use without source disclosure
See LICENSE_DUAL.md for details.
For commercial licensing inquiries, contact: abhishek@meshag.sh
Contributions are welcome! Please ensure you follow the AGPLv3 license requirements.
For issues, questions, or feature requests, please open an issue on GitHub.