{"id":18909793,"url":"https://github.com/nitinpatel2001/node.js-driver-location-analytics-service","last_synced_at":"2026-04-10T23:03:25.884Z","repository":{"id":230014813,"uuid":"775573135","full_name":"NitinPatel2001/Node.js-Driver-Location-Analytics-Service","owner":"NitinPatel2001","description":"This Node.js service collects driver location data continuously and provides analytics around how much distance the driver has driven in a day and identifies hotspots in a city on a given day.","archived":false,"fork":false,"pushed_at":"2024-03-27T10:50:17.000Z","size":46,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-24T15:32:01.359Z","etag":null,"topics":["dotenv","express","nodejs","postman","rest-api"],"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/NitinPatel2001.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":"2024-03-21T16:31:09.000Z","updated_at":"2024-03-22T16:07:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"6c0da615-1a83-4912-ab32-0fdcf3fdb5b5","html_url":"https://github.com/NitinPatel2001/Node.js-Driver-Location-Analytics-Service","commit_stats":null,"previous_names":["nitinpatel2001/node.js-driver-location-analytics-service"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NitinPatel2001%2FNode.js-Driver-Location-Analytics-Service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NitinPatel2001%2FNode.js-Driver-Location-Analytics-Service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NitinPatel2001%2FNode.js-Driver-Location-Analytics-Service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NitinPatel2001%2FNode.js-Driver-Location-Analytics-Service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NitinPatel2001","download_url":"https://codeload.github.com/NitinPatel2001/Node.js-Driver-Location-Analytics-Service/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NitinPatel2001%2FNode.js-Driver-Location-Analytics-Service/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":257305635,"owners_count":22524642,"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":["dotenv","express","nodejs","postman","rest-api"],"created_at":"2024-11-08T09:35:14.685Z","updated_at":"2026-04-10T23:03:20.849Z","avatar_url":"https://github.com/NitinPatel2001.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Node.js Driver Location Analytics Service\n\nThis Node.js service collects driver location data continuously and provides analytics around how much distance the driver has driven in a day and identifies hotspots in a city on a given day.\n\n## Environment Variables\n\nThis project uses environment variables for configuration. Create a `.env` file in the root directory of the project and add the following variables\n\n```\nFIREBASE_API_KEY=YOUR_FIREBASE_API_KEY\nFIREBASE_AUTH_DOMAIN=YOUR_FIREBASE_AUTH_DOMAIN\nFIREBASE_PROJECT_ID=YOUR_FIREBASE_PROJECT_ID\nFIREBASE_STORAGE_BUCKET=YOUR_FIREBASE_STORAGE_BUCKET\nFIREBASE_MESSAGING_SENDER_ID=YOUR_FIREBASE_MESSAGING_SENDER_ID\nFIREBASE_APP_ID=YOUR_FIREBASE_APP_ID\n```\n\n## Installation\n\n1. Clone this repository to your local machine.\n2. Navigate to the project directory.\n3. Install dependencies using npm:\n\n```bash\nnpm install\n```\n\n## Usage\n\n1. Start the server:\n\n```bash\nnpm start\n```\n\n2. Send POST requests to the following endpoints to interact with the service:\n\n   - `/addlocation`: Add driver location data.\n   - `/getanalytics`: Get analytics for a driver's distance driven in a day.\n   - `/gethotspots`: Get hotspots in the city on a given day.\n\n## Endpoints\n\n### 1. Add Location (`/addlocation`)\n\nAdds driver location data to the database.\n\n#### Request\n\n- Method: POST\n- Body:\n  ```json\n  {\n    \"driverId\": \"123456\",\n    \"latitude\": 37.7749,\n    \"longitude\": -122.4194\n  }\n  ```\n\n#### Response\n\n- Success:\n  - Status Code: 200\n  - Response Body: New location data saved successfully.\n\n- Failure:\n  - Status Code: 400\n  - Response Body: Please provide the necessary data.\n\n### 2. Get Analytics (`/getanalytics`)\n\nGet analytics for a driver's distance driven in a day.\n\n#### Request\n\n- Method: POST\n- Body:\n  ```json\n  {\n    \"driverId\": \"123456\",\n    \"date\": \"2023-01-01\"\n  }\n  ```\n\n#### Response\n\n- Success:\n  - Status Code: 200\n  - Response Body: JSON object containing the sum of distances driven by the driver on the specified date.\n\n- Failure:\n  - Status Code: 400\n  - Response Body: Please enter all data.\n\n### 3. Get Hotspots (`/gethotspots`)\n\nGet hotspots in the city on a given day.\n\n#### Request\n\n- Method: POST\n- Body:\n  ```json\n  {\n    \"date\": \"2023-01-01\"\n  }\n  ```\n\n#### Response\n\n- Success:\n  - Status Code: 200\n  - Response Body: JSON array containing the top 10 hotspots in the city on the specified date.\n\n- Failure:\n  - Status Code: 400\n  - Response Body: Please enter all data.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnitinpatel2001%2Fnode.js-driver-location-analytics-service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnitinpatel2001%2Fnode.js-driver-location-analytics-service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnitinpatel2001%2Fnode.js-driver-location-analytics-service/lists"}