Skip to content

YashashavGoyal/real-time-location-tracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Real-Time Location Tracker

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.

features

  • 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.

logic flow

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]
Loading

tech stack

  • Backend: Node.js, Express.js
  • Real-Time Engine: Socket.io
  • Frontend: HTML5, CSS3, JavaScript
  • Templating Engine: EJS
  • Maps: Leaflet.js
  • Containerization: Docker

prerequisites

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)

installation

  1. Clone the repository:

    git clone https://github.com/YashashavGoyal/real-time-location-tracker
    cd real-time-location-tracker
  2. Install dependencies:

    npm install

usage

running locally

  1. Start the server:

    npm start
  2. Open your browser and navigate to:

    http://localhost:5000
    

    Allow location permissions when prompted to see your position on the map.

running with docker

This project includes a multi-stage Dockerfile optimized for production performance using Alpine Linux.

  1. Build the Docker image:

    docker build -t rtlt .
  2. Run the container:

    docker run -p 5000:5000 rtlt
  3. Access the application at http://localhost:5000.

project structure

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

screenshots

Permission Request Real-Time Mapping
Permission Map
Browser asks for location access Live location updates on the map

About

Using Leaflet and socket.io, I have prepared an app which shows users real time location

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors