# abhishek-2502/urlshortener architecture

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

- Interactive diagram: https://gitdiagram.com/abhishek-2502/urlshortener
- Repository: https://github.com/abhishek-2502/urlshortener

## Overview

UrlShortener is a React/Spring Boot link-management application. Users register or log in, create and manage short links, then follow a short link to its destination; authenticated users can inspect click analytics. The graph preserves the frontend routing and dashboard, backend authentication and URL/analytics services, and persistence layers. Frontend-to-API communication is documented generally in the README; some backend and frontend internals are represented from the source index because their full implementations were not excerpted.

Main entry points: [`Url-Shortner-Frontend/src/AppRouter.jsx`](https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-Frontend/src/AppRouter.jsx) (Routes and access), [`Url-Shortner-Frontend/src/components/Dashboard/DashboardLayout.jsx`](https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-Frontend/src/components/Dashboard/DashboardLayout.jsx) (Dashboard), [`Url-Shortner-sb/src/main/java/com/url/shortner/service/UserService.java`](https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-sb/src/main/java/com/url/shortner/service/UserService.java) (User service), [`Url-Shortner-sb/src/main/java/com/url/shortner/service/UrlMappingService.java`](https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-sb/src/main/java/com/url/shortner/service/UrlMappingService.java) (URL and analytics service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Frontend"]
  node_frontend["React application<br/>[App.jsx]"]
  node_routing["Routes and access<br/>[AppRouter.jsx]"]
  node_landing["Landing page<br/>[LandingPage.jsx]"]
  node_authpages["Login and registration<br/>[LoginPage.jsx]"]
  node_dashboard["Dashboard"]
  node_linklist["Link controls<br/>[ShortenItem.jsx]"]
  node_analyticsui["Analytics graph<br/>[Graph.jsx]"]
  node_query["API queries<br/>[useQuery.js]"]
  node_apiclient["HTTP client<br/>[api.js]"]
  node_context["Token context<br/>[ContextApi.jsx]"]
end

subgraph group_auth["Authentication"]
  node_authcontroller["Auth endpoints"]
  node_userservice["User service<br/>[UserService.java]"]
  node_jwt["JWT utilities<br/>[JwtUtils.java]"]
  node_jwtfilter["JWT request filter"]
  node_userdetails["User details"]
end

subgraph group_links["Link Management"]
  node_urlcontroller["URL endpoints"]
  node_redirect["Short-link redirect"]
  node_urlservice["URL and analytics service"]
end

subgraph group_data["Persistence"]
  node_userrepo["User repository"]
  node_urlrepo["URL repository"]
  node_clickrepo["Click repository"]
  node_entities["Relational entities<br/>[UrlMapping.java]"]
end

node_visitor(("Visitor"))
node_database[("Relational database")]

node_visitor -->|"uses"| node_frontend
node_frontend -->|"renders"| node_routing
node_routing -->|"routes to"| node_landing
node_routing -->|"routes to"| node_authpages
node_routing -->|"guards route"| node_dashboard
node_dashboard -->|"renders"| node_linklist
node_dashboard -->|"renders"| node_analyticsui
node_dashboard -->|"loads data"| node_query
node_query -->|"requests"| node_apiclient
node_frontend -->|"provides token"| node_context
node_apiclient -->|"HTTP API"| node_authcontroller
node_authcontroller -->|"delegates"| node_userservice
node_userservice -->|"reads and writes"| node_userrepo
node_userservice -->|"creates token"| node_jwt
node_jwtfilter -->|"validates token"| node_jwt
node_userdetails -->|"loads user"| node_userrepo
node_apiclient -->|"HTTP API"| node_urlcontroller
node_urlcontroller -->|"resolves user"| node_userservice
node_urlcontroller -->|"delegates"| node_urlservice
node_redirect -->|"resolves destination"| node_urlservice
node_urlservice -->|"reads and writes"| node_urlrepo
node_urlservice -->|"records and queries"| node_clickrepo
node_userrepo -.->|"persists"| node_database
node_urlrepo -.->|"persists"| node_database
node_clickrepo -.->|"persists"| node_database

click node_frontend "https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-Frontend/src/App.jsx"
click node_routing "https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-Frontend/src/AppRouter.jsx"
click node_landing "https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-Frontend/src/components/LandingPage.jsx"
click node_authpages "https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-Frontend/src/components/LoginPage.jsx"
click node_dashboard "https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-Frontend/src/components/Dashboard/DashboardLayout.jsx"
click node_linklist "https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-Frontend/src/components/Dashboard/ShortenItem.jsx"
click node_analyticsui "https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-Frontend/src/components/Dashboard/Graph.jsx"
click node_query "https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-Frontend/src/hooks/useQuery.js"
click node_apiclient "https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-Frontend/src/apis/api.js"
click node_context "https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-Frontend/src/contextApi/ContextApi.jsx"
click node_authcontroller "https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-sb/src/main/java/com/url/shortner/controllers/AuthController.java"
click node_userservice "https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-sb/src/main/java/com/url/shortner/service/UserService.java"
click node_jwt "https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-sb/src/main/java/com/url/shortner/security/jwt/JwtUtils.java"
click node_jwtfilter "https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-sb/src/main/java/com/url/shortner/security/jwt/JwtAuthenticationFilter.java"
click node_userdetails "https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-sb/src/main/java/com/url/shortner/service/UserDetailsServiceImpl.java"
click node_urlcontroller "https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-sb/src/main/java/com/url/shortner/controllers/UrlMappingController.java"
click node_redirect "https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-sb/src/main/java/com/url/shortner/controllers/RedirectController.java"
click node_urlservice "https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-sb/src/main/java/com/url/shortner/service/UrlMappingService.java"
click node_userrepo "https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-sb/src/main/java/com/url/shortner/repository/UserRepository.java"
click node_urlrepo "https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-sb/src/main/java/com/url/shortner/repository/UrlMappingRepository.java"
click node_clickrepo "https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-sb/src/main/java/com/url/shortner/repository/ClickEventRepository.java"
click node_entities "https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-sb/src/main/java/com/url/shortner/models/UrlMapping.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_frontend,node_routing,node_landing,node_authpages,node_dashboard,node_linklist,node_analyticsui,node_query,node_apiclient,node_context toneBlue
class node_authcontroller,node_userservice,node_jwt,node_jwtfilter,node_userdetails,node_database toneAmber
class node_urlcontroller,node_redirect,node_urlservice toneMint
class node_userrepo,node_urlrepo,node_clickrepo,node_entities toneRose
class node_visitor toneIndigo
```

## Components

### Frontend

- [React application](https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-Frontend/src/App.jsx): `Url-Shortner-Frontend/src/App.jsx`
- [Routes and access](https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-Frontend/src/AppRouter.jsx): `Url-Shortner-Frontend/src/AppRouter.jsx`
- [Landing page](https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-Frontend/src/components/LandingPage.jsx): `Url-Shortner-Frontend/src/components/LandingPage.jsx`
- [Login and registration](https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-Frontend/src/components/LoginPage.jsx): `Url-Shortner-Frontend/src/components/LoginPage.jsx`
- [Dashboard](https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-Frontend/src/components/Dashboard/DashboardLayout.jsx): `Url-Shortner-Frontend/src/components/Dashboard/DashboardLayout.jsx`
- [Link controls](https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-Frontend/src/components/Dashboard/ShortenItem.jsx): `Url-Shortner-Frontend/src/components/Dashboard/ShortenItem.jsx`
- [Analytics graph](https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-Frontend/src/components/Dashboard/Graph.jsx): `Url-Shortner-Frontend/src/components/Dashboard/Graph.jsx`
- [API queries](https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-Frontend/src/hooks/useQuery.js): `Url-Shortner-Frontend/src/hooks/useQuery.js`
- [HTTP client](https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-Frontend/src/apis/api.js): `Url-Shortner-Frontend/src/apis/api.js`
- [Token context](https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-Frontend/src/contextApi/ContextApi.jsx): `Url-Shortner-Frontend/src/contextApi/ContextApi.jsx`

### Authentication

- [Auth endpoints](https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-sb/src/main/java/com/url/shortner/controllers/AuthController.java): `Url-Shortner-sb/src/main/java/com/url/shortner/controllers/AuthController.java`
- [User service](https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-sb/src/main/java/com/url/shortner/service/UserService.java): `Url-Shortner-sb/src/main/java/com/url/shortner/service/UserService.java`
- [JWT utilities](https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-sb/src/main/java/com/url/shortner/security/jwt/JwtUtils.java): `Url-Shortner-sb/src/main/java/com/url/shortner/security/jwt/JwtUtils.java`
- [JWT request filter](https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-sb/src/main/java/com/url/shortner/security/jwt/JwtAuthenticationFilter.java): `Url-Shortner-sb/src/main/java/com/url/shortner/security/jwt/JwtAuthenticationFilter.java`
- [User details](https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-sb/src/main/java/com/url/shortner/service/UserDetailsServiceImpl.java): `Url-Shortner-sb/src/main/java/com/url/shortner/service/UserDetailsServiceImpl.java`

### Link Management

- [URL endpoints](https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-sb/src/main/java/com/url/shortner/controllers/UrlMappingController.java): `Url-Shortner-sb/src/main/java/com/url/shortner/controllers/UrlMappingController.java`
- [Short-link redirect](https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-sb/src/main/java/com/url/shortner/controllers/RedirectController.java): `Url-Shortner-sb/src/main/java/com/url/shortner/controllers/RedirectController.java`
- [URL and analytics service](https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-sb/src/main/java/com/url/shortner/service/UrlMappingService.java): `Url-Shortner-sb/src/main/java/com/url/shortner/service/UrlMappingService.java`

### Persistence

- [User repository](https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-sb/src/main/java/com/url/shortner/repository/UserRepository.java): `Url-Shortner-sb/src/main/java/com/url/shortner/repository/UserRepository.java`
- [URL repository](https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-sb/src/main/java/com/url/shortner/repository/UrlMappingRepository.java): `Url-Shortner-sb/src/main/java/com/url/shortner/repository/UrlMappingRepository.java`
- [Click repository](https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-sb/src/main/java/com/url/shortner/repository/ClickEventRepository.java): `Url-Shortner-sb/src/main/java/com/url/shortner/repository/ClickEventRepository.java`
- [Relational entities](https://github.com/abhishek-2502/urlshortener/blob/main/Url-Shortner-sb/src/main/java/com/url/shortner/models/UrlMapping.java): `Url-Shortner-sb/src/main/java/com/url/shortner/models/UrlMapping.java`

### Other components

- **Visitor**
- **Relational database**

## Connections

- Visitor → React application: uses
- React application → Routes and access: renders (evidence: `Url-Shortner-Frontend/src/App.jsx`)
- Routes and access → Landing page: routes to (evidence: `Url-Shortner-Frontend/src/AppRouter.jsx`)
- Routes and access → Login and registration: routes to (evidence: `Url-Shortner-Frontend/src/AppRouter.jsx`)
- Routes and access → Dashboard: guards route (evidence: `Url-Shortner-Frontend/src/AppRouter.jsx`)
- Dashboard → Link controls: renders (evidence: `Url-Shortner-Frontend/src/components/Dashboard/DashboardLayout.jsx`)
- Dashboard → Analytics graph: renders (evidence: `Url-Shortner-Frontend/src/components/Dashboard/DashboardLayout.jsx`)
- Dashboard → API queries: loads data (evidence: `Url-Shortner-Frontend/src/components/Dashboard/DashboardLayout.jsx`)
- API queries → HTTP client: requests (evidence: `Url-Shortner-Frontend/src/hooks/useQuery.js`)
- React application → Token context: provides token (evidence: `Url-Shortner-Frontend/src/main.jsx`)
- HTTP client → Auth endpoints: HTTP API
- Auth endpoints → User service: delegates (evidence: `Url-Shortner-sb/src/main/java/com/url/shortner/controllers/AuthController.java`)
- User service → User repository: reads and writes (evidence: `Url-Shortner-sb/src/main/java/com/url/shortner/service/UserService.java`)
- User service → JWT utilities: creates token (evidence: `Url-Shortner-sb/src/main/java/com/url/shortner/service/UserService.java`)
- JWT request filter → JWT utilities: validates token (evidence: `Url-Shortner-sb/src/main/java/com/url/shortner/security/jwt/JwtAuthenticationFilter.java`)
- User details → User repository: loads user (evidence: `Url-Shortner-sb/src/main/java/com/url/shortner/service/UserDetailsServiceImpl.java`)
- HTTP client → URL endpoints: HTTP API
- URL endpoints → User service: resolves user (evidence: `Url-Shortner-sb/src/main/java/com/url/shortner/controllers/UrlMappingController.java`)
- URL endpoints → URL and analytics service: delegates (evidence: `Url-Shortner-sb/src/main/java/com/url/shortner/controllers/UrlMappingController.java`)
- Short-link redirect → URL and analytics service: resolves destination (evidence: `Url-Shortner-sb/src/main/java/com/url/shortner/controllers/RedirectController.java`)
- URL and analytics service → URL repository: reads and writes (evidence: `Url-Shortner-sb/src/main/java/com/url/shortner/service/UrlMappingService.java`)
- URL and analytics service → Click repository: records and queries (evidence: `Url-Shortner-sb/src/main/java/com/url/shortner/service/UrlMappingService.java`)
- User repository → Relational database: persists
- URL repository → Relational database: persists
- Click repository → Relational database: persists
