How shravya33/url-shortener-service works
This Spring Boot service accepts URL-shortening and analytics requests, persists mappings in MySQL, and redirects short-code visits while tracking clicks and enforcing expiration. The graph follows the sampled controller-to-service-to-repository calls; README-documented redirect and health endpoints are included. Some DTOs, utilities, and exception components are indexed but their implementation excerpts do not show all relationships, so those links are omitted where evidence is insufficient.
Main entry points: UrlServiceImpl.java URL service · UrlController.java URL endpoints · GlobalExceptionHandler.java Error mapping · UrlRepository.java URL repository
Components 18
HTTP API
- URL endpoints
src/main/java/com/urlshortener/controller/UrlController.java - Redirect endpoint
src/main/java/com/urlshortener/controller/RedirectController.java - Health check
src/main/java/com/urlshortener/controller/HealthController.java - Error mapping
src/main/java/com/urlshortener/exception/GlobalExceptionHandler.java - Create request
src/main/java/com/urlshortener/dto/CreateShortUrlRequest.java - Short URL response
src/main/java/com/urlshortener/dto/ShortUrlResponse.java - Analytics response
src/main/java/com/urlshortener/dto/UrlAnalyticsResponse.java - Error response
src/main/java/com/urlshortener/dto/ApiErrorResponse.java
URL workflows
- URL service
src/main/java/com/urlshortener/service/impl/UrlServiceImpl.java - Code generation
src/main/java/com/urlshortener/util/ShortCodeGenerator.java - Reserved aliases
src/main/java/com/urlshortener/util/ReservedAliases.java
Persistence and errors
- URL mapping
src/main/java/com/urlshortener/entity/UrlMapping.java - URL repository
src/main/java/com/urlshortener/repository/UrlRepository.java - MySQL database
- Not found error
src/main/java/com/urlshortener/exception/ShortUrlNotFoundException.java - Duplicate alias error
src/main/java/com/urlshortener/exception/DuplicateAliasException.java - Expired link error
src/main/java/com/urlshortener/exception/ExpiredLinkException.java
Other components
- HTTP client
Connections 21
- HTTP client → URL endpoints: submits URLs
README.md - HTTP client → Redirect endpoint: visits short link
README.md - HTTP client → Health check: checks health
README.md - URL endpoints → URL service: calls
src/main/java/com/urlshortener/controller/UrlController.java - URL endpoints → Create request: accepts
src/main/java/com/urlshortener/controller/UrlController.java - URL endpoints → Short URL response: returns
src/main/java/com/urlshortener/controller/UrlController.java - URL endpoints → Analytics response: returns
src/main/java/com/urlshortener/controller/UrlController.java - Redirect endpoint → URL service: calls
src/main/java/com/urlshortener/controller/RedirectController.java - URL service → URL repository: queries and saves
src/main/java/com/urlshortener/service/impl/UrlServiceImpl.java - URL service → URL mapping: builds and updates
src/main/java/com/urlshortener/service/impl/UrlServiceImpl.java - URL service → Code generation: generates codes
src/main/java/com/urlshortener/service/impl/UrlServiceImpl.java - URL service → Reserved aliases: checks aliases
src/main/java/com/urlshortener/service/impl/UrlServiceImpl.java - URL repository → MySQL database: persists mappings
- URL repository → URL mapping: stores entity
src/main/java/com/urlshortener/repository/UrlRepository.java - URL service → Not found error: throws
src/main/java/com/urlshortener/service/impl/UrlServiceImpl.java - URL service → Duplicate alias error: throws
src/main/java/com/urlshortener/service/impl/UrlServiceImpl.java - URL service → Expired link error: throws
src/main/java/com/urlshortener/service/impl/UrlServiceImpl.java - Error mapping → Error response: builds
src/main/java/com/urlshortener/exception/GlobalExceptionHandler.java - Error mapping → Not found error: handles
src/main/java/com/urlshortener/exception/GlobalExceptionHandler.java - Error mapping → Duplicate alias error: handles
src/main/java/com/urlshortener/exception/GlobalExceptionHandler.java - Error mapping → Expired link error: handles
src/main/java/com/urlshortener/exception/GlobalExceptionHandler.java