# mohit-gaur75/url-shortner-fullstack architecture

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

- Interactive diagram: https://gitdiagram.com/mohit-gaur75/url-shortner-fullstack
- Repository: https://github.com/mohit-gaur75/url-shortner-fullstack

## Overview

ShortLink is a full-stack URL-shortening and analytics platform. Users register or log in, create and manage links, and inspect click analytics; visitors follow short codes through the redirect service. The backend also handles sessions, administration, and health checks. Redis supports redirect caching and click buffering, while a BullMQ worker flushes buffered click data to MongoDB. Frontend page-to-page details and several backend subsystems are documented but unsampled, so their connections are shown only where the README or excerpts support them.

Main entry points: [`client/src/App.jsx`](https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/client/src/App.jsx) (React application), [`server/services/url.service.js`](https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/server/services/url.service.js) (Link resolution and management), [`server/app.js`](https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/server/app.js) (Express application), [`server/routes/url.routes.js`](https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/server/routes/url.routes.js) (URL routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_spa["React application<br/>[App.jsx]"]
  node_link_pages["Link and dashboard pages"]
  node_analytics_page["Analytics page<br/>[AnalyticsPage.jsx]"]
  node_admin_page["Admin page<br/>[AdminPage.jsx]"]
  node_redirect_bridge["Redirect bridge<br/>[RedirectBridge.jsx]"]
  node_url_api["URL API client<br/>[urls.js]"]
  node_auth_api["Auth API client<br/>[auth.js]"]
end

subgraph group_api["API and security"]
  node_express["Express application<br/>[app.js]"]
  node_url_routes["URL routes<br/>[url.routes.js]"]
  node_auth_routes["Auth routes<br/>[auth.routes.js]"]
  node_redirect_routes["Redirect routes<br/>[redirect.routes.js]"]
  node_health["Health probes<br/>[health.service.js]"]
end

subgraph group_links["Link and analytics domain"]
  node_url_controller["URL controller<br/>[url.controller.js]"]
  node_url_service["Link resolution and management<br/>[url.service.js]"]
  node_analytics["Click analytics"]
end

subgraph group_identity["Identity and administration"]
  node_auth_controller["Auth controller<br/>[auth.controller.js]"]
  node_auth_service["Authentication service<br/>[auth.service.js]"]
  node_session_service["Session rotation<br/>[session.service.js]"]
  node_admin["Administration<br/>[admin.service.js]"]
end

subgraph group_runtime["Storage and background runtime"]
  node_mongo[("MongoDB")]
  node_redis[("Redis")]
  node_link_cache["Link cache"]
  node_click_buffer["Click buffer"]
  node_click_recorder["Click recorder<br/>[clickRecorder.js]"]
  node_jobs["Flush scheduler and worker<br/>[index.js]"]
  node_click_flush["Click batch flush<br/>[clickFlush.job.js]"]
end

node_visitor(("Link visitor"))
node_user(("Platform user"))

node_user -->|"uses"| node_spa
node_spa -->|"routes to"| node_link_pages
node_spa -->|"routes to"| node_analytics_page
node_spa -->|"routes to"| node_admin_page
node_spa -->|"routes to"| node_redirect_bridge
node_link_pages -.->|"requests links"| node_url_api
node_analytics_page -.->|"requests analytics"| node_url_api
node_spa -.->|"uses"| node_auth_api
node_url_api -.->|"calls API"| node_express
node_auth_api -.->|"calls API"| node_express
node_visitor -.->|"opens short link"| node_redirect_bridge
node_express -->|"mounts"| node_url_routes
node_express -->|"mounts"| node_auth_routes
node_express -->|"mounts"| node_redirect_routes
node_url_routes -->|"dispatches"| node_url_controller
node_auth_routes -->|"dispatches"| node_auth_controller
node_redirect_routes -->|"dispatches"| node_url_controller
node_url_controller -->|"calls"| node_url_service
node_url_routes -->|"dispatches"| node_analytics
node_url_service -->|"reads and writes"| node_mongo
node_url_service -->|"resolves via"| node_link_cache
node_link_cache -->|"reads and writes"| node_redis
node_url_service -->|"records clicks"| node_click_buffer
node_url_service -->|"records clicks"| node_click_recorder
node_click_buffer -.->|"buffers events"| node_redis
node_click_recorder -.->|"records events"| node_analytics
node_jobs -->|"schedules"| node_click_flush
node_click_flush -->|"bulk writes"| node_mongo
node_jobs -->|"uses queue"| node_redis
node_auth_controller -->|"calls"| node_auth_service
node_auth_service -->|"manages sessions"| node_session_service
node_session_service -->|"stores tokens"| node_mongo
node_auth_service -->|"reads and writes users"| node_mongo
node_admin_page -.->|"requests administration"| node_admin
node_health -.->|"checks readiness"| node_mongo
node_health -.->|"checks readiness"| node_redis

click node_spa "https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/client/src/App.jsx"
click node_link_pages "https://github.com/mohit-gaur75/url-shortner-fullstack/tree/main/client/src/pages"
click node_analytics_page "https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/client/src/pages/AnalyticsPage.jsx"
click node_admin_page "https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/client/src/pages/AdminPage.jsx"
click node_redirect_bridge "https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/client/src/pages/RedirectBridge.jsx"
click node_url_api "https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/client/src/api/urls.js"
click node_auth_api "https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/client/src/api/auth.js"
click node_express "https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/server/app.js"
click node_url_routes "https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/server/routes/url.routes.js"
click node_auth_routes "https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/server/routes/auth.routes.js"
click node_redirect_routes "https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/server/routes/redirect.routes.js"
click node_url_controller "https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/server/controllers/url.controller.js"
click node_url_service "https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/server/services/url.service.js"
click node_analytics "https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/server/services/analytics.service.js"
click node_auth_controller "https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/server/controllers/auth.controller.js"
click node_auth_service "https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/server/services/auth.service.js"
click node_session_service "https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/server/services/session.service.js"
click node_admin "https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/server/services/admin.service.js"
click node_health "https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/server/services/health.service.js"
click node_link_cache "https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/server/services/linkCache.service.js"
click node_click_buffer "https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/server/services/clickBuffer.service.js"
click node_click_recorder "https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/server/services/clickRecorder.js"
click node_jobs "https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/server/jobs/index.js"
click node_click_flush "https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/server/jobs/clickFlush.job.js"

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_spa,node_link_pages,node_analytics_page,node_admin_page,node_redirect_bridge,node_url_api,node_auth_api,node_user toneBlue
class node_express,node_url_routes,node_auth_routes,node_redirect_routes,node_health toneAmber
class node_url_controller,node_url_service,node_analytics toneMint
class node_auth_controller,node_auth_service,node_session_service,node_admin toneRose
class node_mongo,node_redis,node_link_cache,node_click_buffer,node_click_recorder,node_jobs,node_click_flush,node_visitor toneIndigo
```

## Components

### Web application

- [React application](https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Link and dashboard pages](https://github.com/mohit-gaur75/url-shortner-fullstack/tree/main/client/src/pages): `client/src/pages`
- [Analytics page](https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/client/src/pages/AnalyticsPage.jsx): `client/src/pages/AnalyticsPage.jsx`
- [Admin page](https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/client/src/pages/AdminPage.jsx): `client/src/pages/AdminPage.jsx`
- [Redirect bridge](https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/client/src/pages/RedirectBridge.jsx): `client/src/pages/RedirectBridge.jsx`
- [URL API client](https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/client/src/api/urls.js): `client/src/api/urls.js`
- [Auth API client](https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/client/src/api/auth.js): `client/src/api/auth.js`

### API and security

- [Express application](https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/server/app.js): `server/app.js`
- [URL routes](https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/server/routes/url.routes.js): `server/routes/url.routes.js`
- [Auth routes](https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/server/routes/auth.routes.js): `server/routes/auth.routes.js`
- [Redirect routes](https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/server/routes/redirect.routes.js): `server/routes/redirect.routes.js`
- [Health probes](https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/server/services/health.service.js): `server/services/health.service.js`

### Link and analytics domain

- [URL controller](https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/server/controllers/url.controller.js): `server/controllers/url.controller.js`
- [Link resolution and management](https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/server/services/url.service.js): `server/services/url.service.js`
- [Click analytics](https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/server/services/analytics.service.js): `server/services/analytics.service.js`

### Identity and administration

- [Auth controller](https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/server/controllers/auth.controller.js): `server/controllers/auth.controller.js`
- [Authentication service](https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/server/services/auth.service.js): `server/services/auth.service.js`
- [Session rotation](https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/server/services/session.service.js): `server/services/session.service.js`
- [Administration](https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/server/services/admin.service.js): `server/services/admin.service.js`

### Storage and background runtime

- **MongoDB**
- **Redis**
- [Link cache](https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/server/services/linkCache.service.js): `server/services/linkCache.service.js`
- [Click buffer](https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/server/services/clickBuffer.service.js): `server/services/clickBuffer.service.js`
- [Click recorder](https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/server/services/clickRecorder.js): `server/services/clickRecorder.js`
- [Flush scheduler and worker](https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/server/jobs/index.js): `server/jobs/index.js`
- [Click batch flush](https://github.com/mohit-gaur75/url-shortner-fullstack/blob/main/server/jobs/clickFlush.job.js): `server/jobs/clickFlush.job.js`

### Other components

- **Link visitor**
- **Platform user**

## Connections

- Platform user → React application: uses (evidence: `README.md`)
- React application → Link and dashboard pages: routes to (evidence: `client/src/App.jsx`)
- React application → Analytics page: routes to (evidence: `client/src/App.jsx`)
- React application → Admin page: routes to (evidence: `client/src/App.jsx`)
- React application → Redirect bridge: routes to (evidence: `client/src/App.jsx`)
- Link and dashboard pages → URL API client: requests links
- Analytics page → URL API client: requests analytics
- React application → Auth API client: uses
- URL API client → Express application: calls API
- Auth API client → Express application: calls API
- Link visitor → Redirect bridge: opens short link
- Express application → URL routes: mounts (evidence: `server/app.js`)
- Express application → Auth routes: mounts (evidence: `server/app.js`)
- Express application → Redirect routes: mounts (evidence: `server/app.js`)
- URL routes → URL controller: dispatches (evidence: `server/routes/url.routes.js`)
- Auth routes → Auth controller: dispatches (evidence: `server/routes/auth.routes.js`)
- Redirect routes → URL controller: dispatches (evidence: `server/routes/redirect.routes.js`)
- URL controller → Link resolution and management: calls (evidence: `server/controllers/url.controller.js`)
- URL routes → Click analytics: dispatches (evidence: `server/routes/url.routes.js`)
- Link resolution and management → MongoDB: reads and writes (evidence: `server/services/url.service.js`)
- Link resolution and management → Link cache: resolves via (evidence: `server/services/url.service.js`)
- Link cache → Redis: reads and writes (evidence: `server/services/linkCache.service.js`)
- Link resolution and management → Click buffer: records clicks (evidence: `server/services/url.service.js`)
- Link resolution and management → Click recorder: records clicks (evidence: `server/services/url.service.js`)
- Click buffer → Redis: buffers events
- Click recorder → Click analytics: records events
- Flush scheduler and worker → Click batch flush: schedules (evidence: `server/jobs/index.js`)
- Click batch flush → MongoDB: bulk writes (evidence: `README.md`)
- Flush scheduler and worker → Redis: uses queue (evidence: `server/jobs/index.js`)
- Auth controller → Authentication service: calls (evidence: `server/controllers/auth.controller.js`)
- Authentication service → Session rotation: manages sessions (evidence: `server/services/auth.service.js`)
- Session rotation → MongoDB: stores tokens (evidence: `server/services/session.service.js`)
- Authentication service → MongoDB: reads and writes users (evidence: `server/services/auth.service.js`)
- Admin page → Administration: requests administration
- Health probes → MongoDB: checks readiness (evidence: `README.md`)
- Health probes → Redis: checks readiness (evidence: `README.md`)
