{"id":37912555,"url":"https://github.com/publi0/mikrotik-dns","last_synced_at":"2026-01-16T17:20:55.240Z","repository":{"id":306889214,"uuid":"1027556479","full_name":"publi0/mikrotik-dns","owner":"publi0","description":"A lightweight self-hosted dashboard for visualizing DNS queries from your MikroTik router.","archived":false,"fork":false,"pushed_at":"2025-09-20T22:56:02.000Z","size":259,"stargazers_count":107,"open_issues_count":1,"forks_count":7,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-09T20:06:29.809Z","etag":null,"topics":["dns","golang","mikrotik","self-hosted"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/publi0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-07-28T07:30:33.000Z","updated_at":"2025-09-23T07:11:04.000Z","dependencies_parsed_at":"2025-07-28T09:26:18.251Z","dependency_job_id":"103129c6-4d22-4cbb-aef0-267488239c44","html_url":"https://github.com/publi0/mikrotik-dns","commit_stats":null,"previous_names":["publi0/mikrotik-dns"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/publi0/mikrotik-dns","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/publi0%2Fmikrotik-dns","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/publi0%2Fmikrotik-dns/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/publi0%2Fmikrotik-dns/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/publi0%2Fmikrotik-dns/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/publi0","download_url":"https://codeload.github.com/publi0/mikrotik-dns/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/publi0%2Fmikrotik-dns/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28480106,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dns","golang","mikrotik","self-hosted"],"created_at":"2026-01-16T17:20:55.174Z","updated_at":"2026-01-16T17:20:55.235Z","avatar_url":"https://github.com/publi0.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🔍 MikroTik DNS Analytics\n\n\u003e Modern real-time DNS analytics dashboard for MikroTik routers with beautiful web interface\n\n![DNS Analytics Dashboard](https://img.shields.io/badge/Dashboard-Next.js%2015-blue?style=for-the-badge)\n![Backend](https://img.shields.io/badge/Backend-Go-00ADD8?style=for-the-badge)\n![Database](https://img.shields.io/badge/Database-SQLite-003B57?style=for-the-badge)\n![Docker](https://img.shields.io/badge/Docker-Ready-2496ED?style=for-the-badge)\n\nA comprehensive DNS analytics solution that receives DNS logs from MikroTik routers via UDP, stores them in SQLite, and presents beautiful real-time statistics through a modern React dashboard.\n\n\u003cimg width=\"1920\" height=\"1080\" alt=\"image\" src=\"https://github.com/user-attachments/assets/46d31532-f1f3-4c2d-a513-5941e11d6175\" /\u003e\n\n---\n\n## ✨ Features\n\n### 🎯 **Modern Dashboard**\n\n- **Real-time Statistics**: Auto-refreshing dashboard with customizable intervals (5s-5min)\n- **Modern UI**: Next.js 15 + React 19 with Tailwind CSS and Radix UI components\n- **Responsive Design**: Works perfectly on desktop, tablet, and mobile devices\n- **Animated Numbers**: Smooth transitions when data updates\n- **Interactive Elements**: Click-to-copy functionality throughout the interface\n\n### 📊 **Comprehensive Analytics**\n\n- **Overview Page**: Modern cards with gradients, IPv4 vs IPv6 adoption, query rates\n- **Top Domains**: Visual ranking with progress bars and interactive selection\n- **Client Analysis**: Most active clients with detailed query history\n- **Domain Search**: Powerful search with partial matching capabilities\n- **Query Types**: Distribution analysis with special highlighting for unknown queries\n- **Network Insights**: Query rates, resolution success rates, client distribution\n\n### 🔧 **Advanced Functionality**\n\n- **Domain → Clients**: Click any domain to see which clients are querying it\n- **Client → Domains**: Click any client to see their query history\n- **IPv4/IPv6 Tracking**: Monitor protocol adoption in your network\n- **Failed Query Analysis**: Identify and troubleshoot DNS resolution issues\n- **Real-time Metrics**: Queries per minute, active clients, unique domains\n\n### 🚀 **Production Ready**\n\n- **Docker Containerized**: Complete containerization with Docker Compose\n- **API Proxy**: Single port deployment (3000) with backend proxying\n- **Optimized Backend**: Efficient Go API with SQLite and proper CORS\n- **Auto-purging**: Automatically removes data older than 24 hours\n- **Error Handling**: Robust error handling and null-safe operations\n\n---\n\n## 🏃‍♂️ Quick Start\n\n### 1. Using Docker Compose (Recommended)\n\n```bash\n# Clone the repository\ngit clone https://github.com/publi0/mikrotik-dns.git\ncd mikrotik-dns\n\n# Start with Docker Compose\ndocker compose up -d\n\n# View logs\ndocker compose logs -f\n```\n\n### 2. Using Docker Run Directly\n\n```bash\n# Pull and run the pre-built image\ndocker run -d \\\n  --name mikrotik-dns \\\n  --restart unless-stopped \\\n  -p 3000:3000 \\\n  -p 5354:5354/udp \\\n  -v $(pwd)/data:/data \\\n  ghcr.io/publi0/mikrotik-dns:latest\n\n# View logs\ndocker logs -f mikrotik-dns\n```\n\n### 3. Using Deployment Script\n\n```bash\n# Use the provided deployment script\n./deploy-example.sh\n```\n\n**Access the dashboard:**\n\n- 🌐 **Web Dashboard**: http://localhost:3000\n- 📡 **UDP Logs**: Port 5354 (for MikroTik)\n\n### 4. Using Makefile\n\n```bash\n# Check if all tools are available\nmake check-tools\n\n# Build and start single image\nmake single-build\nmake single-up\n\n# View real-time logs\nmake single-logs\n\n# Stop services\nmake single-down\n```\n\n---\n\n## 📡 MikroTik Configuration\n\nConfigure your MikroTik router to send DNS logs:\n\n### Option 1: WebFig/Winbox GUI\n\n1. Go to **System → Logging**\n2. Add new rule:\n   - **Topics**: `dns`\n   - **Action**: `remote`\n   - **Remote Address**: `\u003cyour_server_ip\u003e`\n   - **Remote Port**: `5354`\n\n### Option 2: Command Line Interface\n\n```shell\n/system logging add topics=dns action=remote remote=\u003cyour_server_ip\u003e remote-port=5354\n```\n\n### Expected Log Format\n\n```\n2025-01-15 14:23:45 dns query from 192.168.1.100: #12345 google.com. A\n2025-01-15 14:23:46 dns query from 192.168.1.100: #12346 facebook.com. AAAA\n```\n\n---\n\n## 🏗️ Architecture\n\n```mermaid\ngraph LR\n    A[MikroTik Router] --\u003e|UDP:5354| B[Single Container]\n    B --\u003e|Store| C[SQLite DB]\n    B --\u003e|Serve| D[User Browser]\n\n    subgraph \"Docker Container\"\n        E[Go Backend :8080]\n        F[Next.js Frontend :3000]\n        C\n        E --\u003e F\n    end\n\n    B --\u003e E\n    F --\u003e|Port 3000| D\n```\n\n## 📊 API Endpoints\n\n### Core Statistics\n\n- `GET /api/top-domains` - Most queried domains\n- `GET /api/query-types` - DNS query type distribution\n- `GET /api/clients` - Most active client IPs\n- `GET /api/unique-clients-count` - Count of unique clients\n- `GET /api/unique-domains-count` - Count of unique domains\n\n### Advanced Analytics\n\n- `GET /api/queries-per-minute` - Average queries per minute\n- `GET /api/ipv4-vs-ipv6` - IPv4 vs IPv6 usage statistics\n- `GET /api/all-queries?page=1\u0026page_size=50` - Recent queries with pagination\n\n### Interactive Features\n\n- `GET /api/client-queries?client=\u003cip\u003e\u0026page=1` - Queries from specific client\n- `GET /api/domain-clients?domain=\u003cdomain\u003e\u0026page=1` - Clients querying specific domain\n- `GET /api/domain-queries?domain=\u003cdomain\u003e\u0026partial=true\u0026page=1` - Search domains\n\n---\n\n## 🎨 Dashboard Features\n\n### Overview Page\n\n- **Modern Gradient Cards**: Beautiful statistics with color-coded themes\n- **IPv4/IPv6 Adoption**: Visual progress bars showing protocol usage\n- **Network Health**: Resolution success rates and query performance\n- **Real-time Metrics**: Live query rates and client distribution\n\n### Domains Page\n\n- **Interactive Domain List**: Click any domain to see client details\n- **Client Analysis**: Shows which clients query specific domains\n- **Query Counts**: Number of queries per client for selected domain\n- **Last Activity**: Timestamp of most recent query\n\n### Clients Page\n\n- **Active Client Ranking**: Most active IP addresses\n- **Query History**: Detailed query log for each client\n- **Domain Breakdown**: What domains each client is accessing\n\n### Search Page\n\n- **Live DNS Resolution**: Real-time DNS lookup for search results matching the original query type\n- **Query Type Specific**: Resolves A, AAAA, CNAME, TXT, MX, NS, PTR records based on logged query type\n- **Block Detection**: Identifies blocked or non-existent domains\n- **Performance Metrics**: Shows DNS resolution time for each domain\n- **Copy Functionality**: One-click copy for domains and DNS records\n\n### All Queries Page\n\n- **Complete Query Log**: Chronological list of all DNS queries\n- **Table Layout**: Organized columns for time, client, domain, type\n- **Responsive Design**: Proper column widths regardless of data length\n\n---\n\n## ⚙️ Configuration\n\n### Environment Variables\n\n- `BACKEND_URL`: Internal backend URL for API proxy (default: `http://mikrotik-dns-backend:8080`)\n- `DATABASE_PATH`: SQLite database location (default: `/data/queries.db`)\n- `DNS_SERVER`: Custom DNS server for resolution testing (optional, uses system default if not set)\n\n### Auto-refresh Settings\n\n- **5 seconds**: Real-time monitoring\n- **10 seconds**: Active monitoring\n- **30 seconds**: Regular updates\n- **1 minute**: Casual monitoring\n- **5 minutes**: Background monitoring\n\n---\n\n## 🔧 Development\n\n### Local Development\n\n```bash\n# Backend\ngo mod tidy\ngo run main.go\n\n# Frontend (in separate terminal)\ncd page\nnpm install\nnpm run dev\n```\n\n### Building from Source\n\n```bash\n# Backend\nCGO_ENABLED=1 go build -o mikrotik-dns .\n\n# Frontend\ncd page\nnpm run build\n```\n\n---\n\n## 📦 Docker Configuration\n\n### Single Image Deployment\n\nThe application is available as a single Docker image with both frontend and backend:\n\n```yaml\n# docker-compose.yml\nservices:\n  mikrotik-dns:\n    image: ghcr.io/publi0/mikrotik-dns:latest\n    container_name: mikrotik-dns\n    restart: unless-stopped\n    ports:\n      - \"3000:3000\" # Web dashboard\n      - \"5354:5354/udp\" # MikroTik logs\n    volumes:\n      - ./data:/data\n    environment:\n      - DNS_SERVER=${DNS_SERVER:-}\n      - DATABASE_PATH=/data/queries.db\n      - PORT=3000\n      - NODE_ENV=production\n    healthcheck:\n      test: [\"CMD\", \"wget\", \"-qO-\", \"http://127.0.0.1:3000\"]\n      interval: 30s\n      timeout: 5s\n      retries: 3\n      start_period: 10s\n```\n\n### Environment Variables\n\n- `DATABASE_PATH`: SQLite database location (default: `/data/queries.db`)\n- `DNS_SERVER`: Custom DNS server for resolution testing (optional)\n- `PORT`: Frontend port (default: `3000`)\n- `NODE_ENV`: Node.js environment (default: `production`)\n\n---\n\n## 🗄️ Database Schema\n\nSQLite database with automatic cleanup (24h retention):\n\n```sql\nCREATE TABLE queries (\n    id INTEGER PRIMARY KEY,\n    timestamp INTEGER,\n    client TEXT,\n    domain TEXT,\n    type TEXT\n);\n```\n\n---\n\n## 🐛 Troubleshooting\n\n### No Data Appearing\n\n1. Check MikroTik logging configuration\n2. Verify UDP port 5354 is accessible\n3. Check container logs: `docker compose logs -f`\n\n### DNS Resolution Issues\n\n- Monitor \"Failed Queries\" card for UNKNOWN query types\n- Check \"Resolution Rate\" in Activity Summary\n- Use Domain Search to investigate specific issues\n\n### Performance Issues\n\n- Monitor \"Query Rate\" metrics\n- Check \"Avg. per Client\" statistics\n- Review IPv4/IPv6 distribution for network optimization\n\n### Build Issues\n\n- Ensure CGO is enabled for SQLite support\n- Check Docker build context includes all necessary files\n- Verify Node.js dependencies are properly installed\n\n---\n\n## 🤝 Contributing\n\n1. Fork the repository\n2. Create a feature branch: `git checkout -b feature/amazing-feature`\n3. Commit changes: `git commit -m 'Add amazing feature'`\n4. Push to branch: `git push origin feature/amazing-feature`\n5. Open a Pull Request\n\n---\n\n## 📄 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n---\n\n## 🙏 Acknowledgments\n\n- **MikroTik**: For excellent router hardware and logging capabilities\n- **Go**: For the efficient backend implementation\n- **Next.js \u0026 React**: For the modern frontend framework\n- **Tailwind CSS**: For the beautiful and responsive design\n- **Radix UI**: For accessible and customizable components\n- **SQLite**: For the lightweight and reliable database\n\n---\n\n\u003cdiv align=\"center\"\u003e\n\nMade with ❤️ for network administrators and DNS enthusiasts\n\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpubli0%2Fmikrotik-dns","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpubli0%2Fmikrotik-dns","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpubli0%2Fmikrotik-dns/lists"}