# jonasjore/url-shortener architecture

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

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

## Overview

The active Quarkus application provides URL creation, listing, reveal-by-ID, and redirect endpoints; redirects also increment a visit count. A separate Kotlin implementation remains under `legacy/` and supports additional lookup, update, and delete operations. The current controller, service, and repository wiring is visible in sampled source; legacy redirect wiring and some configuration details were not sampled, so they are omitted.

Main entry points: [`src/main/java/no/jore/adapter/in/web/ShortenedUrlController.java`](https://github.com/jonasjore/url-shortener/blob/master/src/main/java/no/jore/adapter/in/web/ShortenedUrlController.java) (URL controller), [`src/main/java/no/jore/application/service/ShortenedUrlService.java`](https://github.com/jonasjore/url-shortener/blob/master/src/main/java/no/jore/application/service/ShortenedUrlService.java) (URL service), [`src/main/java/no/jore/infrastructure/repository/ShortUrlPanacheRepository.java`](https://github.com/jonasjore/url-shortener/blob/master/src/main/java/no/jore/infrastructure/repository/ShortUrlPanacheRepository.java) (Panache repository), [`legacy/src/main/kotlin/UrlShortenerRepository.kt`](https://github.com/jonasjore/url-shortener/blob/master/legacy/src/main/kotlin/UrlShortenerRepository.kt) (Legacy SQL repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["HTTP API"]
  node_controller["URL controller"]
  node_inport["URL input port"]
end

subgraph group_application["Application Logic"]
  node_service["URL service"]
  node_usecases["URL use cases"]
  node_domain["Short URL model<br/>[ShortUrl.java]"]
  node_dto["API DTOs"]
  node_dto_mapper["DTO mapper"]
end

subgraph group_persistence["Persistence"]
  node_repo["Panache repository"]
  node_entity_mapper["Entity mapper"]
  node_entity["URL entity"]
  node_database[("PostgreSQL database")]
end

subgraph group_legacy["Legacy Application"]
  node_legacy_api["Legacy REST resource"]
  node_legacy_service["Legacy URL service"]
  node_legacy_repo["Legacy SQL repository"]
  node_legacy_model["Legacy URL model<br/>[ShortenedUrl.kt]"]
  node_legacy_database[("MySQL database")]
end

node_client(("HTTP client"))

node_client -->|"sends requests"| node_controller
node_controller -->|"implements"| node_inport
node_controller -->|"invokes"| node_service
node_controller -->|"maps input"| node_dto_mapper
node_controller -->|"returns DTO"| node_dto
node_service -->|"implements"| node_usecases
node_service -->|"calls"| node_repo
node_service -->|"handles"| node_domain
node_repo -->|"maps records"| node_entity_mapper
node_entity_mapper -->|"converts"| node_entity
node_repo -->|"reads and writes"| node_database
node_client -.->|"sends requests"| node_legacy_api
node_legacy_api -.->|"invokes"| node_legacy_service
node_legacy_service -.->|"calls"| node_legacy_repo
node_legacy_repo -.->|"maps rows"| node_legacy_model
node_legacy_repo -.->|"queries"| node_legacy_database

click node_controller "https://github.com/jonasjore/url-shortener/blob/master/src/main/java/no/jore/adapter/in/web/ShortenedUrlController.java"
click node_inport "https://github.com/jonasjore/url-shortener/blob/master/src/main/java/no/jore/port/in/ShortenedUrlPort.java"
click node_service "https://github.com/jonasjore/url-shortener/blob/master/src/main/java/no/jore/application/service/ShortenedUrlService.java"
click node_usecases "https://github.com/jonasjore/url-shortener/tree/master/src/main/java/no/jore/application/port/in"
click node_domain "https://github.com/jonasjore/url-shortener/blob/master/src/main/java/no/jore/domain/model/ShortUrl.java"
click node_dto "https://github.com/jonasjore/url-shortener/tree/master/src/main/java/no/jore/domain/dto"
click node_dto_mapper "https://github.com/jonasjore/url-shortener/blob/master/src/main/java/no/jore/application/mapper/ShortUrlDTOMapper.java"
click node_repo "https://github.com/jonasjore/url-shortener/blob/master/src/main/java/no/jore/infrastructure/repository/ShortUrlPanacheRepository.java"
click node_entity_mapper "https://github.com/jonasjore/url-shortener/blob/master/src/main/java/no/jore/application/mapper/ShortenedUrlEntityMapper.java"
click node_entity "https://github.com/jonasjore/url-shortener/blob/master/src/main/java/no/jore/infrastructure/persistance/ShortUrlEntity.java"
click node_legacy_api "https://github.com/jonasjore/url-shortener/blob/master/legacy/src/main/kotlin/endpoints/ShortenedUrlResource.kt"
click node_legacy_service "https://github.com/jonasjore/url-shortener/blob/master/legacy/src/main/kotlin/service/UrlShortenerService.kt"
click node_legacy_repo "https://github.com/jonasjore/url-shortener/blob/master/legacy/src/main/kotlin/UrlShortenerRepository.kt"
click node_legacy_model "https://github.com/jonasjore/url-shortener/blob/master/legacy/src/main/kotlin/domain/ShortenedUrl.kt"

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_inport,node_client toneBlue
class node_service,node_usecases,node_domain,node_dto,node_dto_mapper toneAmber
class node_repo,node_entity_mapper,node_entity,node_database toneMint
class node_legacy_api,node_legacy_service,node_legacy_repo,node_legacy_model,node_legacy_database toneRose
```

## Components

### HTTP API

- [URL controller](https://github.com/jonasjore/url-shortener/blob/master/src/main/java/no/jore/adapter/in/web/ShortenedUrlController.java): `src/main/java/no/jore/adapter/in/web/ShortenedUrlController.java`
- [URL input port](https://github.com/jonasjore/url-shortener/blob/master/src/main/java/no/jore/port/in/ShortenedUrlPort.java): `src/main/java/no/jore/port/in/ShortenedUrlPort.java`

### Application Logic

- [URL service](https://github.com/jonasjore/url-shortener/blob/master/src/main/java/no/jore/application/service/ShortenedUrlService.java): `src/main/java/no/jore/application/service/ShortenedUrlService.java`
- [URL use cases](https://github.com/jonasjore/url-shortener/tree/master/src/main/java/no/jore/application/port/in): `src/main/java/no/jore/application/port/in`
- [Short URL model](https://github.com/jonasjore/url-shortener/blob/master/src/main/java/no/jore/domain/model/ShortUrl.java): `src/main/java/no/jore/domain/model/ShortUrl.java`
- [API DTOs](https://github.com/jonasjore/url-shortener/tree/master/src/main/java/no/jore/domain/dto): `src/main/java/no/jore/domain/dto`
- [DTO mapper](https://github.com/jonasjore/url-shortener/blob/master/src/main/java/no/jore/application/mapper/ShortUrlDTOMapper.java): `src/main/java/no/jore/application/mapper/ShortUrlDTOMapper.java`

### Persistence

- [Panache repository](https://github.com/jonasjore/url-shortener/blob/master/src/main/java/no/jore/infrastructure/repository/ShortUrlPanacheRepository.java): `src/main/java/no/jore/infrastructure/repository/ShortUrlPanacheRepository.java`
- [Entity mapper](https://github.com/jonasjore/url-shortener/blob/master/src/main/java/no/jore/application/mapper/ShortenedUrlEntityMapper.java): `src/main/java/no/jore/application/mapper/ShortenedUrlEntityMapper.java`
- [URL entity](https://github.com/jonasjore/url-shortener/blob/master/src/main/java/no/jore/infrastructure/persistance/ShortUrlEntity.java): `src/main/java/no/jore/infrastructure/persistance/ShortUrlEntity.java`
- **PostgreSQL database**

### Legacy Application

- [Legacy REST resource](https://github.com/jonasjore/url-shortener/blob/master/legacy/src/main/kotlin/endpoints/ShortenedUrlResource.kt): `legacy/src/main/kotlin/endpoints/ShortenedUrlResource.kt`
- [Legacy URL service](https://github.com/jonasjore/url-shortener/blob/master/legacy/src/main/kotlin/service/UrlShortenerService.kt): `legacy/src/main/kotlin/service/UrlShortenerService.kt`
- [Legacy SQL repository](https://github.com/jonasjore/url-shortener/blob/master/legacy/src/main/kotlin/UrlShortenerRepository.kt): `legacy/src/main/kotlin/UrlShortenerRepository.kt`
- [Legacy URL model](https://github.com/jonasjore/url-shortener/blob/master/legacy/src/main/kotlin/domain/ShortenedUrl.kt): `legacy/src/main/kotlin/domain/ShortenedUrl.kt`
- **MySQL database**

### Other components

- **HTTP client**

## Connections

- HTTP client → URL controller: sends requests
- URL controller → URL input port: implements
- URL controller → URL service: invokes
- URL controller → DTO mapper: maps input
- URL controller → API DTOs: returns DTO
- URL service → URL use cases: implements
- URL service → Panache repository: calls
- URL service → Short URL model: handles
- Panache repository → Entity mapper: maps records
- Entity mapper → URL entity: converts
- Panache repository → PostgreSQL database: reads and writes
- HTTP client → Legacy REST resource: sends requests
- Legacy REST resource → Legacy URL service: invokes
- Legacy URL service → Legacy SQL repository: calls
- Legacy SQL repository → Legacy URL model: maps rows
- Legacy SQL repository → MySQL database: queries
