A modern, full-stack MongoDB monitoring tool that presents db.currentOp() results in an intuitive interface. Built with TypeScript in a monorepo architecture, featuring a REST API with Server-Sent Events and a React web dashboard.
- Real-time monitoring with auto-refresh and SSE streaming
- Intelligent filtering of system/internal queries
- Color-coded highlighting for unindexed queries (COLLSCAN)
- GeoIP location display for public IPs
- Auto-save long-running and problematic queries
- Interactive controls (pause, reverse, snapshot, show all)
- Multi-server support with connection management
- Web dashboard with virtualized table and JSON viewer
The built-in db.currentOp() has limitations:
- ❌ JSON output not easily readable
- ❌ Cluttered with system queries
- ❌ No auto-refresh or persistence
- ❌ No summary statistics
This tool provides:
- ✅ Human-readable tabular display
- ✅ Automatic filtering of noise
- ✅ Auto-refresh and real-time streaming
- ✅ Instant identification of slow queries
- ✅ Detection of unindexed scans
- ✅ REST API and web dashboard
pnpm install
# Configure your MongoDB servers (see Configuration section)
cp config/local.yaml.example config/local.yaml
# Start web dashboard
pnpm run dev:webRun both API and Web services in containers:
# 1. Configure MongoDB and API settings in config/local.yaml
cp config/local.yaml.example config/local.yaml
# 2. Build Docker images (generates config from YAML - no env vars!)
pnpm docker:build
# 3. Start services
docker compose up -dAccess: Web UI at http://localhost:9000, API at http://localhost:9001
Production: pnpm docker:build https://api.yourdomain.com
See docs/DOCKER.md for complete documentation including production deployment, SSE-capable reverse proxy configuration, troubleshooting, and more.
pnpm run dev:webOpens http://localhost:9000 with:
- Real-time query monitoring
- Interactive table with virtualization
- Query details with JSON viewer
- Server selection and connection management
# Start API only on http://localhost:9001
pnpm run dev:apiSee docs/API.md for detailed API documentation.
Uses YAML configuration files in config/:
config/default.yaml (checked into git):
servers:
localhost:
name: Local MongoDB
uri: mongodb://localhost:27017
api:
port: 9001
host: 0.0.0.0
logLevel: info
apiKey: dev-key-change-in-production
cors:
origins:
- http://localhost:9000
credentials: trueconfig/local.yaml (gitignored - your servers):
servers:
production:
name: Production Cluster
uri: mongodb+srv://user:pass@cluster.mongodb.net/db
staging:
name: Staging
uri: mongodb://user:pass@staging:27017/db?authSource=admin
# Override API settings
api:
apiKey: your-secure-api-key-here
logLevel: debugCopy config/local.yaml.example to get started.
Monorepo Structure (Turborepo + pnpm workspaces):
apps/
├── api/ # Fastify REST API + SSE streaming
│ # Includes MongoDB services and query processing
└── web/ # React dashboard (TanStack Router, Zustand, shadcn/ui)
│ # Includes utility functions for styling
packages/
└── types/ # Shared TypeScript types
Services (apps/api/src/core):
MongoConnectionService- Connection poolingQueryService- Query processing and filteringQueryLoggerService- Logging and snapshots
- Monorepo: Turborepo, pnpm workspaces
- Backend: TypeScript, MongoDB Driver v7, Fastify, lodash-es
- Frontend: React 19, TanStack Router + Virtual, Zustand, Vite, Tailwind CSS, shadcn/ui
# Install dependencies
pnpm install
# Development modes
pnpm run dev:api # API only
pnpm run dev:web # API + Web (recommended)
pnpm run dev # All apps
# Build all packages
pnpm run build
# Build specific package
turbo build --filter=@mongo-query-top/api
# Format code
pnpm run format
# Production
pnpm run start:api- docs/API.md - Complete API endpoint documentation
- docs/DOCKER.md - Docker deployment guide with production setup and SSE support
- CLAUDE.md - Developer guide with code patterns, architecture details, and customization instructions
Queries are auto-saved to logs/<server-id>/ when:
- Runtime exceeds configured threshold (default: 10s)
- Query uses COLLSCAN (collection scan)
MIT

