{"id":25347605,"url":"https://github.com/kaivankeren/mikrotik-api","last_synced_at":"2025-04-08T18:54:25.036Z","repository":{"id":276412528,"uuid":"929214965","full_name":"KaivanKeren/mikrotik-api","owner":"KaivanKeren","description":"Network Traffic Dashboard","archived":false,"fork":false,"pushed_at":"2025-02-24T11:29:10.000Z","size":27,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-24T12:24:56.203Z","etag":null,"topics":["backend","mikrotik-api","mikrotik-routeros-api","side-project","simple-project"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KaivanKeren.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2025-02-08T03:04:54.000Z","updated_at":"2025-02-24T11:29:13.000Z","dependencies_parsed_at":"2025-02-08T04:19:22.347Z","dependency_job_id":"f4a41d0b-e490-4348-b4ac-f1904e29da9e","html_url":"https://github.com/KaivanKeren/mikrotik-api","commit_stats":null,"previous_names":["kaivankeren/mikrotik-api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KaivanKeren%2Fmikrotik-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KaivanKeren%2Fmikrotik-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KaivanKeren%2Fmikrotik-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KaivanKeren%2Fmikrotik-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KaivanKeren","download_url":"https://codeload.github.com/KaivanKeren/mikrotik-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247909134,"owners_count":21016475,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["backend","mikrotik-api","mikrotik-routeros-api","side-project","simple-project"],"created_at":"2025-02-14T14:57:26.505Z","updated_at":"2025-04-08T18:54:25.008Z","avatar_url":"https://github.com/KaivanKeren.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚀 Network Traffic Backend\n\nA **real-time network traffic monitoring API** using **Express.js**, **WebSockets**, and **MikroTik RouterOS API**. This backend provides live network statistics and active IP tracking.\n\n## 📡 Features\n\n- 🔗 **MikroTik RouterOS Integration** - Fetches real-time network traffic and active IPs.\n- 📊 **WebSocket Streaming** - Sends live updates to clients.\n- 🔥 **REST API** - Provides an endpoint for initial data retrieval.\n\n## 🛠️ Tech Stack\n\n- **Backend:** Express.js, WebSockets\n- **Data Source:** MikroTik RouterOS\n- **Protocol:** REST API \u0026 WebSockets\n\n## 📦 Installation\n\n1. **Clone the repository**\n\n   ```sh\n   git clone https://github.com/KaivanKeren/mikrotik-api.git\n   cd mikrotik-api\n   ```\n\n2. **Install dependencies**\n\n   ```sh\n   npm install\n   ```\n\n3. **Run the server**\n\n   ```sh\n   node index.js\n   ```\n\n## ⚙️ Configuration\n\nModify the MikroTik connection details in `server.js`:\n\n```js\nconst connection = new RouterOSAPI({\n  host: \"192.168.1.1\",\n  user: \"user\",\n  password: \"password\",\n});\n```\n\nUpdate the WebSocket port in the frontend to match the backend WebSocket server:\n\n```ts\nexport const WS_URL = \"ws://localhost:9090\";\n```\n\n## 🔗 API Endpoints\n\n### **GET /api/network-data**\n\nFetches real-time network data, including bandwidth usage and active IPs.\n\n**Response:**\n\n```json\n{\n  \"interfaces\": [\n    {\n      \"interface\": \"ether1\",\n      \"rxKbps\": 500,\n      \"txKbps\": 300\n    }\n  ],\n  \"usageByIP\": {\n    \"192.168.1.11\": {\n      \"rx\": 50000,\n      \"tx\": 30000\n    }\n  },\n  \"activeIPs\": 5\n}\n```\n\n## 📡 WebSocket Events\n\n- **bandwidth\\_update** - Sends live network data updates every 3 seconds.\n\n**Example Message:**\n\n```json\n{\n  \"type\": \"bandwidth_update\",\n  \"data\": { ... },\n  \"timestamp\": \"2024-02-08T12:00:00Z\"\n}\n```\n\n## 🤝 Contributing\n\nContributions are welcome! Feel free to fork the repository, open issues, and submit pull requests.\n\n## 📜 License\n\nThis project is licensed under the **MIT License**. See the [LICENSE](./LICENSE) file for details.\n\n---\n\n🚀 **Happy Coding!** 🎉","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaivankeren%2Fmikrotik-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkaivankeren%2Fmikrotik-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaivankeren%2Fmikrotik-api/lists"}