{"id":24488701,"url":"https://github.com/mahmud-r-farhan/realtime-location-tracker","last_synced_at":"2025-07-06T18:37:49.693Z","repository":{"id":268774378,"uuid":"859532256","full_name":"mahmud-r-farhan/Realtime-Location-Tracker","owner":"mahmud-r-farhan","description":"Real-Time Location Tracker enables live device tracking with Leaflet, WebSockets, and WebRTC, supporting offline maps and a responsive UI for seamless monitoring.","archived":false,"fork":false,"pushed_at":"2025-05-17T09:01:42.000Z","size":3470,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-17T09:35:01.453Z","etag":null,"topics":["admin-panel","audio-call","audio-room","chat-app","communications","delivery-tracking","ejs","fleet-management","javascript","leaflet-map","location-services","location-tracker","location-tracking","monitoring","nodejs","share-location","socket-io","web-application","webrtc","websocket"],"latest_commit_sha":null,"homepage":"https://realtime-location-tracker-v9ow.onrender.com/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mahmud-r-farhan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-09-18T20:30:37.000Z","updated_at":"2025-05-17T09:02:00.000Z","dependencies_parsed_at":"2024-12-18T21:21:56.583Z","dependency_job_id":"4189ad9c-aa9e-4e5f-9ba8-0ddb8f8c46a2","html_url":"https://github.com/mahmud-r-farhan/Realtime-Location-Tracker","commit_stats":null,"previous_names":["mahmud-r-farhan/realtime-location-tracker"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/mahmud-r-farhan/Realtime-Location-Tracker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahmud-r-farhan%2FRealtime-Location-Tracker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahmud-r-farhan%2FRealtime-Location-Tracker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahmud-r-farhan%2FRealtime-Location-Tracker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahmud-r-farhan%2FRealtime-Location-Tracker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mahmud-r-farhan","download_url":"https://codeload.github.com/mahmud-r-farhan/Realtime-Location-Tracker/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahmud-r-farhan%2FRealtime-Location-Tracker/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263953044,"owners_count":23535031,"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":["admin-panel","audio-call","audio-room","chat-app","communications","delivery-tracking","ejs","fleet-management","javascript","leaflet-map","location-services","location-tracker","location-tracking","monitoring","nodejs","share-location","socket-io","web-application","webrtc","websocket"],"created_at":"2025-01-21T16:29:22.593Z","updated_at":"2025-07-06T18:37:49.686Z","avatar_url":"https://github.com/mahmud-r-farhan.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Real-Time Location Tracker Documentation\n\nThe **Real-Time Location Tracker** is a web application designed to monitor and track the real-time locations of connected devices. It leverages interactive map visualizations (Leaflet), instant communication (WebSockets), and real-time audio communication (WebRTC). The application is suitable for various use cases, including:\n\n \n\n- Fleet management\n\n  \n\n- Delivery tracking\n\n  \n\n- Team coordination\n\n  \n\n- Personal location sharing\n\n  \n\n- Emergency response\n\n\nThe application provides a responsive design for a consistent user experience across desktops, tablets, and smartphones. It also supports offline map functionality.\n\n  \n\n---\n\n  \n\n## Features\n\n-  **Real-Time Tracking:** Track device locations with continuous real-time updates.\n\n-  **Smart Device Identification:** Recognizes and categorizes devices based on user agent strings.\n\n-  **Device Connection Panel:** View a list of connected devices and their active status.\n\n-  **Customizable Icons:** Unique icons for different device types.\n\n-  **Offline Map Support:** Intelligent switching between online and offline map modes.\n\n-  **Responsive Design:** Optimized for all devices.\n\n-  **Interactive Popups:** View details of connected devices.\n\n-  **Personalized User Authentication:** Assign custom names or use default device names.\n\n-  **Activity Logs:** A comprehensive log system that tracks server notifications, connection events, and disconnections.\n\n-  **Audio Communication (WebRTC):** Real-time voice communication between connected devices.\n\n-  **Live Chat Messaging:** Send instant text messages using WebSockets.\n\n## Prerequisites\n\n-   Node.js: v18 or higher\n    \n-   npm: v8 or higher\n    \n  \n\n## **Version Release**\n\n  \n\n### **Initial Release**\n\n  \n\n-  **Real-Time Location Tracker** is a web application designed for seamless, real-time device tracking.\n\n-  **Lightweight \u0026 Optimized** for minimal server load, ensuring efficient performance.\n\n  \n\n----------\n\n  \n\n### **Version 2.0** – **Major Enhancements \u0026 New Features**\n\n  \n\n-  **Real-Time Tracking:** Continuously updates device locations on the map as they move.\n\n-  **Smart Device Identification:** Automatically detects and categorizes devices based on their user agent (Android, iOS, Windows, Mac, etc.).\n\n-  **Device Connection Panel:** Displays a dynamic list of all connected devices with real-time count and allows instant location viewing.\n\n-  **Customizable Icons:** Unique icons for different device types for better visualization.\n\n-  **Offline Map Support:** Automatically switches between online and offline map modes based on internet availability.\n\n-  **Fully Responsive Design:** Optimized layouts for desktops, tablets, and mobile screens.\n\n-  **Interactive Popups:** Click on a device marker to view detailed information, including device name and user identification.\n\n-  **Personalized User Authentication:** Users can assign custom device names or use default names for identification.\n\n-  **Audio Communication:** Real-time voice communication between connected devices using WebRTC.\n\n  \n\n\u003e Recommended Version: 2.4.2\n\n  \n\n----------\n\n  \n\n### **Version 3.0 (Latest Update)** – **Advanced Features \u0026 Performance Upgrades**\n\n  \n\n-  **Enhanced Interactive Popups:** Now includes real-time device details such as battery status, connection type, and more.\n\n-  **Activity Logs:** A comprehensive log system that tracks server notifications, connection events, and disconnections. Battery and Connection Status.\n\n-  **Live Chat Messaging:** Instant text communication between connected devices via WebSockets.\n\n  \n\nThis latest version introduces **enhanced real-time tracking, better device insights, and improved communication tools**, making the app more versatile and powerful.\n\n  \n\n\u003e Recommended Version: 3.5.7\n\n\n## Folder Structure\n\n```\n\nrealtime-location-tracker/\n\n``\nrealtime-location-tracker/\n├── public/\n│   ├── assets/\n│   │   ├── android-log.png\n│   │   ├── ios-log.png\n│   │   ├── windows-log.png\n│   │   ├── mac-log.png\n│   │   ├── unknown-log.png\n│   │   ├── microphone-on-icon.png\n│   │   ├── microphone-muted-icon.png\n│   │   ├── speaker-on-icon.png\n│   │   ├── speaker-off-icon.png\n│   │   ├── favico.png\n│   │   ├── icons8-location.gif\n│   ├── css/\n│   │   ├── style.css\n│   │   ├── panel.css\n│   │   ├── device.css\n│   │   ├── chat.css\n│   │   ├── audio.css\n│   │   ├── notification.css\n│   │   ├── popup.css\n│   │   ├── responsive.css\n│   │   ├── icon.css\n│   ├── js/\n│   │   ├── main.js\n│   │   ├── config.js\n│   │   ├── device.js\n│   │   ├── map.js\n│   │   ├── socket.js\n│   │   ├── ui.js\n│   │   ├── notification.js\n│   │   ├── chat.js\n│   │   ├── audio.js\n├── views/\n│   ├── index.ejs\n├── app.js\n├── package.json\n├── README.md\n├── dockerfile\n``\n\n```\n\n### Folder Details:\n\n  \n\n-  **public/assets/**: Stores static assets (images, icons).\n\n  \n  \n  \n\n-  **public/js/**: Holds JavaScript files for frontend logic:\n\n-  `config.js`: Constants (icons, WebRTC configuration, intervals).\n\n-  `device.js`: Device name and info utilities.\n\n-  `map.js`: Map initialization, marker management, and popups.\n\n-  `socket.js`: Socket.IO initialization and event handlers.\n\n-  `ui.js`: Sidebar, name popup, and device list management.\n\n-  `notification.js`: Notification panel and draggable functionality.\n\n-  `chat.js`: Chat panel and messaging logic.\n\n-  `audio.js`: WebRTC audio controls and peer connections.\n\n-  `main.js`Orchestrates all modules and initializes the app.\n\n  \n\n-  **views/index.ejs**: Main view template.\n\n  \n\n-  **app.js**: Initializes the server and routes.\n\n  \n\n-  **package.json**: Contains project metadata and dependencies.\n\n  \n\n-  **README.md**: Project documentation.\n\n-  **Dockerfile**: Docker configuration for containerized deployment.\n    \n-  **.dockerignore**: Excludes unnecessary files from Docker builds.\n\n  \n\n---\n\n  \n\n## Installation\n\n1.  **Clone the Repository:**\n\n```bash\n\ngit clone https://github.com/mahmud-r-farhan/realtime-location-tracker.git\n\n```\n\n```bash\n\ncd realtime-location-tracker\n\n```\n\n2.  **Install Dependencies:**\n\n```bash\n\nnpm install\n\n```\n\n3.  **Configure Offline Support(optional):**\n\n- Download Leaflet library and place CSS/JS files in `public/leaflet/`.\n\n- Generate offline map tiles and place them in `public/tiles/offline-map-tiles/`.\n\n4.  **Run the Application:**\n\n```bash\n\nnpm start\n\n```\n\n  \n\n---\n\n  \n\n## Usage\n\n  \n\n1. Open `http://localhost:3007` in a web browser.\n\n  \n\n2. Grant location access when prompted.\n\n  \n\n3. View the real-time locations of connected devices on the map.\n\n  \n\n4. Click on device markers to view detailed information in the popup.\n\n  \n\n5. Use the microphone and speaker buttons to initiate and manage audio communication.\n\n  \n\n6. Use the chat panel (accessed via the chat icon) to send text messages.\n\n  \n\n---\n\n  \n\n5. **Map System (Leaflet):**\n\n  \n\n- Leaflet is used to display the map and device markers.\n\n  \n\n- The map updates in real-time as device locations change.\n\n  \n\n6. **Chat System:**\n\n  \n\n- Users can send text messages to each other through the chat interface.\n\n  \n\n- Messages are transmitted via Socket.IO.\n\n  \n\n7. **WebRTC Audio:**\n\n  \n\n- WebRTC enables real-time audio communication between users.\n\n  \n\n- Signaling (session setup) is handled via Socket.IO.\n\n  \n\n- Audio data is transmitted directly between peers.\n\n  \n\n8. **Notification System:**\n\n  \n\n- Displays real-time notifications about device connections, disconnections, and other events.\n\n  \n  \n\n---\n\n  \n\n## Live Test\n\n- Live: [Render Deployment](https://realtime-location-tracker-v9ow.onrender.com/)\n\n- Invite multiple users to test tracking and communication features.\n\n  \n\n---\n\n## Deployment Options\n\n1. Docker Deployment\n\nDeploy the application as a containerized service for consistency and scalability.\n\nSteps:\n\n1.  Build the Docker Image:\n    \n    bash\n    \n    ```bash\n    docker build -t realtime-location-tracker .\n    ```\n    \n2.  Run the Container:\n    \n    bash\n    \n    ```bash\n    docker run -p 3007:3007 --name tracker -d realtime-location-tracker\n    ```\n    \n    -   Maps port 3007 on the host to 3007 in the container.\n        \n    -   Use -d for detached mode.\n        \n3.  Access the Application:\n    \n    -   Open http://localhost:3007 in a browser.\n        \n4.  Stop and Remove the Container:\n    \n    bash\n    \n    ```bash\n    docker stop tracker\n    docker rm tracker\n    ```\n    \n\nOptional: Docker Compose\n\nFor managing multi-container setups (e.g., with a database), create a docker-compose.yml:\n\nyaml\n\n```yaml\nversion: '3.8'\nservices:\n  app:\n    build: .\n    ports:\n      - \"3007:3007\"\n    environment:\n      - NODE_ENV=production\n    volumes:\n      - ./public/tiles:/app/public/tiles\n```\n\nRun with:\n\nbash\n\n```bash\ndocker-compose up -d\n```\n\n2. Render Deployment\n\nDeploy to [Render](https://render.com/) for a managed cloud solution.\n\nSteps:\n\n1.  Push to GitHub:\n    \n    -   Ensure your repository is public or private on GitHub.\n        \n2.  Create a Render Account:\n    \n    -   Sign up at [render.com](https://render.com/).\n        \n3.  New Web Service:\n    \n    -   In Render, create a new Web Service and connect your GitHub repository.\n        \n4.  Configure Settings:\n    \n    -   Runtime: Node\n        \n    -   Build Command: npm install\n        \n    -   Start Command: npm start\n        \n            \n5.  Deploy:\n    \n    -   Trigger a deployment. Render provides a URL (e.g., https://realtime-location-tracker-v9ow.onrender.com).\n        \n6.  Test:\n    \n    -   Access the deployed URL and verify functionality.\n        \n\n3. AWS EC2 Deployment\n\nDeploy on an AWS EC2 instance for full control.\n\nSteps:\n\n1.  Launch an EC2 Instance:\n    \n    -   Choose an Ubuntu 20.04 or later AMI.\n        \n    -   Select an instance type (e.g., t2.micro for testing).\n        \n    -   Configure security group rules to allow:\n        \n        -   Port 3007 (HTTP)\n            \n        -   Port 22 (SSH)\n            \n2.  Connect to the Instance:\n    \n    bash\n    \n    ```bash\n    ssh -i \u003cyour-key.pem\u003e ubuntu@\u003cec2-public-ip\u003e\n    ```\n    \n3.  Install Dependencies:\n    \n    bash\n    \n    ```bash\n    sudo apt update\n    sudo apt install -y nodejs npm git\n    ```\n    \n4.  Clone and Set Up:\n    \n    bash\n    \n    ```bash\n    git clone https://github.com/mahmud-r-farhan/realtime-location-tracker.git\n    cd realtime-location-tracker\n    npm install\n    ```\n    \n5.  Run the Application:\n    \n    bash\n    \n    ```bash\n    npm start\n    ```\n    \n    -   For production, use a process manager like PM2:\n        \n        bash\n        \n        ```bash\n        sudo npm install -g pm2\n        pm2 start server.js --name tracker\n        pm2 startup\n        pm2 save\n        ```\n        \n6.  Access:\n    \n    -   Open http://\u003cec2-public-ip\u003e:3007 in a browser.\n        \n7.  Optional: Set Up a Reverse Proxy:\n    \n    -   Use Nginx to handle HTTPS and load balancing (see Nginx Guide (#nginx-configuration)).\n        \n\n4. VPS Deployment\n\nDeploy on any VPS provider (e.g., DigitalOcean, Linode).\n\nSteps:\n\n1.  Set Up the VPS:\n    \n    -   Provision an Ubuntu server.\n        \n    -   Update the system:\n        \n        bash\n        \n        ```bash\n        sudo apt update \u0026\u0026 sudo apt upgrade\n        ```\n        \n2.  Install Dependencies:\n    \n    bash\n    \n    ```bash\n    sudo apt install -y nodejs npm git\n    ```\n    \n3.  Clone and Configure:\n    \n    bash\n    \n    ```bash\n    git clone https://github.com/mahmud-r-farhan/realtime-location-tracker.git\n    cd realtime-location-tracker\n    npm install\n    ```\n    \n4.  Run the Application:\n    \n    bash\n    \n    ```bash\n    npm start\n    ```\n    \n    -   Use PM2 for production:\n        \n        bash\n        \n        ```bash\n        sudo npm install -g pm2\n        pm2 start server.js --name tracker\n        ```\n        \n5.  Configure Firewall:\n    \n    bash\n    \n    ```bash\n    sudo ufw allow 3007\n    sudo ufw allow 22\n    sudo ufw enable\n    ```\n    \n6.  Access:\n    \n    -   Open http://\u003cvps-ip\u003e:3007.\n        \n7.  Optional: Domain and HTTPS:\n    \n    -   Point a domain to your VPS IP.\n        \n    -   Set up Nginx and SSL (see Nginx Configuration (#nginx-configuration)).\n        \n\n----------\n\nNginx Configuration (Optional)\n\nFor production, use Nginx as a reverse proxy to handle HTTPS and load balancing.\n\n1.  Install Nginx:\n    \n    bash\n    \n    ```bash\n    sudo apt install nginx\n    ```\n    \n2.  Create an Nginx Configuration:\n    \n    bash\n    \n    ```bash\n    sudo nano /etc/nginx/sites-available/tracker\n    ```\n    \n    Add:\n    \n    nginx\n    \n    ```nginx\n    server {\n        listen 80;\n        server_name your-domain.com;\n    \n        location / {\n            proxy_pass http://localhost:3007;\n            proxy_http_version 1.1;\n            proxy_set_header Upgrade $http_upgrade;\n            proxy_set_header Connection 'upgrade';\n            proxy_set_header Host $host;\n            proxy_cache_bypass $http_upgrade;\n        }\n    }\n    ```\n    \n3.  Enable the Site:\n    \n    bash\n    \n    ```bash\n    sudo ln -s /etc/nginx/sites-available/tracker /etc/nginx/sites-enabled/\n    ```\n    \n4.  Test and Restart Nginx:\n    \n    bash\n    \n    ```bash\n    sudo nginx -t\n    sudo systemctl restart nginx\n    ```\n    \n5.  Set Up SSL (Optional):\n    \n    -   Use [Certbot](https://certbot.eff.org/) for free SSL:\n        \n        bash\n        \n        ```bash\n        sudo apt install certbot python3-certbot-nginx\n        sudo certbot --nginx -d your-domain.com\n        ```        \n  \n---\n## Contributing\n\n1. Fork the repository.\n\n2. Create a new branch:\n\n```bash\n\ngit checkout -b user-update\n\n```\n\n3. Make changes and commit:\n\n```bash\n\ngit commit -m \"Add new feature\"\n\n```\n\n4. Push to branch:\n\n```bash\n\ngit push origin user-update\n\n```\n\n5. Open a pull request.\n\n  \n\n---\n\n  \n\n## License\n\nThis project is licensed under the Personal Use License. See the LICENSE file for details.\n\n  \n\n---\n\n  \n\n## Contact\n\n- **Email:** [GMAIL](mailto:farhanstack.dev@gmail.com)\n\n- **GitHub:** [GitHub](https://github.com/mahmud-r-farhan)\n\n  \n  \n  \n\n---\n\n## FAQ\n\n**Q: How accurate is the GPS?**\n\nA: Depends on device hardware (typically ±5-50 meters).\n\n\n**Q: Can I use custom map providers?**\n\nA: Yes! Replace `leaflet.js` with Mapbox/Google Maps.\n\n\n---\n\n## Troubleshooting\n\n-   Location Not Updating: Ensure geolocation is enabled and the browser has permission.\n    \n-   WebSocket Errors: Verify port 3007 is open and not blocked by a firewall.\n    \n-   WebRTC Issues: Check STUN/TURN server configurations and network connectivity.\n    \n-   Deployment Fails: Review logs (e.g., docker logs tracker or Render logs) for errors.\n---","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmahmud-r-farhan%2Frealtime-location-tracker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmahmud-r-farhan%2Frealtime-location-tracker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmahmud-r-farhan%2Frealtime-location-tracker/lists"}