A real-time web application that tracks and displays user locations on an interactive map. Built with Node.js, Socket.io, and Leaflet, this location tracker allows multiple users to share their geographic position instantly.
- Real-Time Tracking: Instantly updates user locations on the map as they move.
- Multi-User Support: Visualize multiple users simultaneously on the same map interface.
- Interactive Maps: Powered by Leaflet for smooth zooming and panning.
- Automatic Disconnection: Removes users from the map when they disconnect.
graph TD
A[User Moves] -->|Get Coordinates| B(Client App)
B -->|socket.emit 'send-location'| C{Server}
C -->|io.emit 'receive-location'| D[All Connected Clients]
D -->|Update Markers| E[Map Interface]
- Backend: Node.js, Express.js
- Real-Time Engine: Socket.io
- Frontend: HTML5, CSS3, JavaScript
- Templating Engine: EJS
- Maps: Leaflet.js
- Containerization: Docker
Before you begin, ensure you have the following installed:
- Node.js (v20 or higher)
- npm (usually comes with Node.js)
- Docker (optional, for containerized deployment)
-
Clone the repository:
git clone https://github.com/YashashavGoyal/real-time-location-tracker cd real-time-location-tracker -
Install dependencies:
npm install
-
Start the server:
npm start
-
Open your browser and navigate to:
http://localhost:5000Allow location permissions when prompted to see your position on the map.
This project includes a multi-stage Dockerfile optimized for production performance using Alpine Linux.
-
Build the Docker image:
docker build -t rtlt . -
Run the container:
docker run -p 5000:5000 rtlt
-
Access the application at
http://localhost:5000.
real-time-location-tracker/
├── public/ # Static files (CSS, client-side JS)
├── views/ # EJS templates (index.ejs)
├── app.js # Main server entry point
├── Dockerfile # Multi-stage Docker configuration
├── package.json # Project dependencies and scripts
└── README.md # Project documentation
| Permission Request | Real-Time Mapping |
|---|---|
| Browser asks for location access | Live location updates on the map |