# sridharpasupuleti/url-shortener architecture

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

- Interactive diagram: https://gitdiagram.com/sridharpasupuleti/url-shortener
- Repository: https://github.com/sridharpasupuleti/url-shortener

## Overview

This repository contains a React URL-shortening interface and a Java backend. The visible user workflow is to enter a long URL and optional alias, submit it through the frontend service, and display or copy the returned short URL. Backend implementation details and README capability claims were not provided, so backend components are identified from the source tree; their internal relationships are not asserted.

Main entry points: [`url-shortener-frontend/src/components/UrlForm.js`](https://github.com/sridharpasupuleti/url-shortener/blob/main/url-shortener-frontend/src/components/UrlForm.js) (URL Form), [`url-shortener-frontend/src/services/urlService.js`](https://github.com/sridharpasupuleti/url-shortener/blob/main/url-shortener-frontend/src/services/urlService.js) (URL API Client), [`url-shortener-frontend/src/App.js`](https://github.com/sridharpasupuleti/url-shortener/blob/main/url-shortener-frontend/src/App.js) (React App), [`url-shortener-frontend/src/reportWebVitals.js`](https://github.com/sridharpasupuleti/url-shortener/blob/main/url-shortener-frontend/src/reportWebVitals.js) (Web Vitals)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend"]
  node_app["React App<br/>[App.js]"]
  node_url_form["URL Form<br/>[UrlForm.js]"]
  node_url_service["URL API Client<br/>[urlService.js]"]
  node_web_vitals["Web Vitals<br/>[reportWebVitals.js]"]
end

subgraph group_backend["Backend"]
  node_backend_api["Backend URL API"]
  node_url_service_backend["URL Service<br/>[UrlService.java]"]
  node_url_service_impl["URL Service Logic"]
  node_rate_limiter["Shortening Rate Limit"]
  node_base62["Base62 Encoding<br/>[Base62.java]"]
end

subgraph group_domain["URL Domain"]
  node_url_entity["URL Record<br/>[Urls.java]"]
  node_url_request["URL Request DTO<br/>[Urldto.java]"]
  node_url_response["URL Response DTO"]
  node_url_errors["URL Error Types"]
end

subgraph group_infrastructure["Infrastructure"]
  node_url_repository["URL Repository<br/>[UrlRepository.java]"]
  node_redis_config["Redis Configuration<br/>[RedisConfig.java]"]
end

node_user(("URL User"))
node_redis[("Redis")]
node_browser(("Browser"))

node_user -->|"enters URL"| node_url_form
node_app -->|"renders"| node_url_form
node_url_form -->|"requests shortening"| node_url_service
node_url_service -.->|"POSTs URL"| node_backend_api
node_url_form -->|"shows result"| node_user
node_url_form -->|"copies result"| node_browser
node_web_vitals -->|"collects metrics"| node_browser

click node_app "https://github.com/sridharpasupuleti/url-shortener/blob/main/url-shortener-frontend/src/App.js"
click node_url_form "https://github.com/sridharpasupuleti/url-shortener/blob/main/url-shortener-frontend/src/components/UrlForm.js"
click node_url_service "https://github.com/sridharpasupuleti/url-shortener/blob/main/url-shortener-frontend/src/services/urlService.js"
click node_web_vitals "https://github.com/sridharpasupuleti/url-shortener/blob/main/url-shortener-frontend/src/reportWebVitals.js"
click node_backend_api "https://github.com/sridharpasupuleti/url-shortener/tree/main/url-shortener-backend/src/main/java/com/example/url_shortener/controller"
click node_url_service_backend "https://github.com/sridharpasupuleti/url-shortener/blob/main/url-shortener-backend/src/main/java/com/example/url_shortener/service/UrlService.java"
click node_url_service_impl "https://github.com/sridharpasupuleti/url-shortener/blob/main/url-shortener-backend/src/main/java/com/example/url_shortener/serviceimplementation/UrlServiceImpl.java"
click node_rate_limiter "https://github.com/sridharpasupuleti/url-shortener/blob/main/url-shortener-backend/src/main/java/com/example/url_shortener/service/UrlShorteningRateLimiter.java"
click node_base62 "https://github.com/sridharpasupuleti/url-shortener/blob/main/url-shortener-backend/src/main/java/com/example/url_shortener/serviceimplementation/Base62.java"
click node_url_repository "https://github.com/sridharpasupuleti/url-shortener/blob/main/url-shortener-backend/src/main/java/com/example/url_shortener/repository/UrlRepository.java"
click node_redis_config "https://github.com/sridharpasupuleti/url-shortener/blob/main/url-shortener-backend/src/main/java/com/example/url_shortener/config/RedisConfig.java"
click node_url_entity "https://github.com/sridharpasupuleti/url-shortener/blob/main/url-shortener-backend/src/main/java/com/example/url_shortener/entities/Urls.java"
click node_url_request "https://github.com/sridharpasupuleti/url-shortener/blob/main/url-shortener-backend/src/main/java/com/example/url_shortener/dtos/Urldto.java"
click node_url_response "https://github.com/sridharpasupuleti/url-shortener/blob/main/url-shortener-backend/src/main/java/com/example/url_shortener/dtos/UrlResponseDTO.java"
click node_url_errors "https://github.com/sridharpasupuleti/url-shortener/tree/main/url-shortener-backend/src/main/java/com/example/url_shortener/exception"

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_app,node_url_form,node_url_service,node_web_vitals,node_user,node_browser toneBlue
class node_backend_api,node_url_service_backend,node_url_service_impl,node_rate_limiter,node_base62,node_redis toneAmber
class node_url_entity,node_url_request,node_url_response,node_url_errors toneMint
class node_url_repository,node_redis_config toneRose
```

## Components

### Frontend

- [React App](https://github.com/sridharpasupuleti/url-shortener/blob/main/url-shortener-frontend/src/App.js): `url-shortener-frontend/src/App.js`
- [URL Form](https://github.com/sridharpasupuleti/url-shortener/blob/main/url-shortener-frontend/src/components/UrlForm.js): `url-shortener-frontend/src/components/UrlForm.js`
- [URL API Client](https://github.com/sridharpasupuleti/url-shortener/blob/main/url-shortener-frontend/src/services/urlService.js): `url-shortener-frontend/src/services/urlService.js`
- [Web Vitals](https://github.com/sridharpasupuleti/url-shortener/blob/main/url-shortener-frontend/src/reportWebVitals.js): `url-shortener-frontend/src/reportWebVitals.js`

### Backend

- [Backend URL API](https://github.com/sridharpasupuleti/url-shortener/tree/main/url-shortener-backend/src/main/java/com/example/url_shortener/controller): `url-shortener-backend/src/main/java/com/example/url_shortener/controller`
- [URL Service](https://github.com/sridharpasupuleti/url-shortener/blob/main/url-shortener-backend/src/main/java/com/example/url_shortener/service/UrlService.java): `url-shortener-backend/src/main/java/com/example/url_shortener/service/UrlService.java`
- [URL Service Logic](https://github.com/sridharpasupuleti/url-shortener/blob/main/url-shortener-backend/src/main/java/com/example/url_shortener/serviceimplementation/UrlServiceImpl.java): `url-shortener-backend/src/main/java/com/example/url_shortener/serviceimplementation/UrlServiceImpl.java`
- [Shortening Rate Limit](https://github.com/sridharpasupuleti/url-shortener/blob/main/url-shortener-backend/src/main/java/com/example/url_shortener/service/UrlShorteningRateLimiter.java): `url-shortener-backend/src/main/java/com/example/url_shortener/service/UrlShorteningRateLimiter.java`
- [Base62 Encoding](https://github.com/sridharpasupuleti/url-shortener/blob/main/url-shortener-backend/src/main/java/com/example/url_shortener/serviceimplementation/Base62.java): `url-shortener-backend/src/main/java/com/example/url_shortener/serviceimplementation/Base62.java`

### URL Domain

- [URL Record](https://github.com/sridharpasupuleti/url-shortener/blob/main/url-shortener-backend/src/main/java/com/example/url_shortener/entities/Urls.java): `url-shortener-backend/src/main/java/com/example/url_shortener/entities/Urls.java`
- [URL Request DTO](https://github.com/sridharpasupuleti/url-shortener/blob/main/url-shortener-backend/src/main/java/com/example/url_shortener/dtos/Urldto.java): `url-shortener-backend/src/main/java/com/example/url_shortener/dtos/Urldto.java`
- [URL Response DTO](https://github.com/sridharpasupuleti/url-shortener/blob/main/url-shortener-backend/src/main/java/com/example/url_shortener/dtos/UrlResponseDTO.java): `url-shortener-backend/src/main/java/com/example/url_shortener/dtos/UrlResponseDTO.java`
- [URL Error Types](https://github.com/sridharpasupuleti/url-shortener/tree/main/url-shortener-backend/src/main/java/com/example/url_shortener/exception): `url-shortener-backend/src/main/java/com/example/url_shortener/exception`

### Infrastructure

- [URL Repository](https://github.com/sridharpasupuleti/url-shortener/blob/main/url-shortener-backend/src/main/java/com/example/url_shortener/repository/UrlRepository.java): `url-shortener-backend/src/main/java/com/example/url_shortener/repository/UrlRepository.java`
- [Redis Configuration](https://github.com/sridharpasupuleti/url-shortener/blob/main/url-shortener-backend/src/main/java/com/example/url_shortener/config/RedisConfig.java): `url-shortener-backend/src/main/java/com/example/url_shortener/config/RedisConfig.java`

### Other components

- **URL User**
- **Redis**
- **Browser**

## Connections

- URL User → URL Form: enters URL (evidence: `url-shortener-frontend/src/components/UrlForm.js`)
- React App → URL Form: renders (evidence: `url-shortener-frontend/src/App.js`)
- URL Form → URL API Client: requests shortening (evidence: `url-shortener-frontend/src/components/UrlForm.js`)
- URL API Client → Backend URL API: POSTs URL (evidence: `url-shortener-frontend/src/services/urlService.js`)
- URL Form → URL User: shows result (evidence: `url-shortener-frontend/src/components/UrlForm.js`)
- URL Form → Browser: copies result (evidence: `url-shortener-frontend/src/components/UrlForm.js`)
- Web Vitals → Browser: collects metrics (evidence: `url-shortener-frontend/src/reportWebVitals.js`)
