# punnamkoushik/locationservice architecture

> Architecture diagram of the GitHub repository punnamkoushik/locationservice, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/punnamkoushik/locationservice
- Repository: https://github.com/punnamkoushik/locationservice

## Overview

This is a Spring Boot location service for a ride-hailing workflow. Clients search destinations, request route-based distance/time and vehicle fare estimates, or submit rider coordinates; the service uses LocationIQ for search/routing and Redis geospatial storage for current rider positions. DTOs carry requests and results, while a global handler formats unidentified-location errors. The sampled sources establish these links; the README is empty, so no further capabilities are documented.

Main entry points: [`src/main/java/com/Rapido/locationservice/Service/LocationService.java`](https://github.com/punnamkoushik/locationservice/blob/main/src/main/java/com/Rapido/locationservice/Service/LocationService.java) (Location Service), [`src/main/java/com/Rapido/locationservice/Controller/LocationController.java`](https://github.com/punnamkoushik/locationservice/blob/main/src/main/java/com/Rapido/locationservice/Controller/LocationController.java) (Location Controller), [`src/main/java/com/Rapido/locationservice/DTO`](https://github.com/punnamkoushik/locationservice/tree/main/src/main/java/com/Rapido/locationservice/DTO) (Request and Result DTOs), [`src/main/java/com/Rapido/locationservice/Exception/GlobalExceptionHandler.java`](https://github.com/punnamkoushik/locationservice/blob/main/src/main/java/com/Rapido/locationservice/Exception/GlobalExceptionHandler.java) (Global Error Handler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["HTTP API"]
  node_controller["Location Controller"]
  node_errorhandler["Global Error Handler"]
end

subgraph group_domain["Location Operations"]
  node_service["Location Service"]
end

subgraph group_contracts["Contracts and Errors"]
  node_dtos["Request and Result DTOs"]
  node_exception["Unidentified Location Error"]
end

subgraph group_integrations["External Systems"]
  node_locationiq{{"LocationIQ"}}
  node_redis[("Redis Geo Store")]
end

node_client(("API Client"))

node_client -->|"calls endpoints"| node_controller
node_controller -->|"delegates operations"| node_service
node_service -->|"searches and routes"| node_locationiq
node_service -->|"writes coordinates"| node_redis
node_service -->|"uses and returns"| node_dtos
node_controller -->|"accepts request bodies"| node_dtos
node_service -->|"throws on invalid locations"| node_exception
node_errorhandler -->|"handles"| node_exception
node_errorhandler -->|"formats error response"| node_dtos

click node_controller "https://github.com/punnamkoushik/locationservice/blob/main/src/main/java/com/Rapido/locationservice/Controller/LocationController.java"
click node_service "https://github.com/punnamkoushik/locationservice/blob/main/src/main/java/com/Rapido/locationservice/Service/LocationService.java"
click node_dtos "https://github.com/punnamkoushik/locationservice/tree/main/src/main/java/com/Rapido/locationservice/DTO"
click node_exception "https://github.com/punnamkoushik/locationservice/blob/main/src/main/java/com/Rapido/locationservice/Exception/UnidentifiedLocationException.java"
click node_errorhandler "https://github.com/punnamkoushik/locationservice/blob/main/src/main/java/com/Rapido/locationservice/Exception/GlobalExceptionHandler.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_controller,node_errorhandler,node_client toneBlue
class node_service toneAmber
class node_dtos,node_exception toneMint
class node_locationiq,node_redis toneRose
```

## Components

### HTTP API

- [Location Controller](https://github.com/punnamkoushik/locationservice/blob/main/src/main/java/com/Rapido/locationservice/Controller/LocationController.java): `src/main/java/com/Rapido/locationservice/Controller/LocationController.java`
- [Global Error Handler](https://github.com/punnamkoushik/locationservice/blob/main/src/main/java/com/Rapido/locationservice/Exception/GlobalExceptionHandler.java): `src/main/java/com/Rapido/locationservice/Exception/GlobalExceptionHandler.java`

### Location Operations

- [Location Service](https://github.com/punnamkoushik/locationservice/blob/main/src/main/java/com/Rapido/locationservice/Service/LocationService.java): `src/main/java/com/Rapido/locationservice/Service/LocationService.java`

### Contracts and Errors

- [Request and Result DTOs](https://github.com/punnamkoushik/locationservice/tree/main/src/main/java/com/Rapido/locationservice/DTO): `src/main/java/com/Rapido/locationservice/DTO`
- [Unidentified Location Error](https://github.com/punnamkoushik/locationservice/blob/main/src/main/java/com/Rapido/locationservice/Exception/UnidentifiedLocationException.java): `src/main/java/com/Rapido/locationservice/Exception/UnidentifiedLocationException.java`

### External Systems

- **LocationIQ**
- **Redis Geo Store**

### Other components

- **API Client**

## Connections

- API Client → Location Controller: calls endpoints (evidence: `src/main/java/com/Rapido/locationservice/Controller/LocationController.java`)
- Location Controller → Location Service: delegates operations (evidence: `src/main/java/com/Rapido/locationservice/Controller/LocationController.java`)
- Location Service → LocationIQ: searches and routes (evidence: `src/main/java/com/Rapido/locationservice/Service/LocationService.java`)
- Location Service → Redis Geo Store: writes coordinates (evidence: `src/main/java/com/Rapido/locationservice/Service/LocationService.java`)
- Location Service → Request and Result DTOs: uses and returns (evidence: `src/main/java/com/Rapido/locationservice/Service/LocationService.java`)
- Location Controller → Request and Result DTOs: accepts request bodies (evidence: `src/main/java/com/Rapido/locationservice/Controller/LocationController.java`)
- Location Service → Unidentified Location Error: throws on invalid locations (evidence: `src/main/java/com/Rapido/locationservice/Service/LocationService.java`)
- Global Error Handler → Unidentified Location Error: handles (evidence: `src/main/java/com/Rapido/locationservice/Exception/GlobalExceptionHandler.java`)
- Global Error Handler → Request and Result DTOs: formats error response (evidence: `src/main/java/com/Rapido/locationservice/Exception/GlobalExceptionHandler.java`)
