# skyler01-collab/spring-boot-jwt-photo-album-api architecture

> Architecture diagram of the GitHub repository skyler01-collab/spring-boot-jwt-photo-album-api, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/skyler01-collab/spring-boot-jwt-photo-album-api
- Repository: https://github.com/skyler01-collab/spring-boot-jwt-photo-album-api

## Overview

This is a stateless Spring Boot photo-album REST API. Clients register or authenticate, receive a signed JWT, then use it on protected endpoints to manage albums and photos; authorization includes role checks and album ownership. The documented architecture separates controllers, services, repositories, and JPA entities, with DTOs at the API boundary. README documents these capabilities and broad layer relationships, but no source excerpts were supplied, so finer call ownership and implementation details are not represented.

Main entry points: [`src/main/java/com/example/springDemoWithRest/Controller/AlbumController.java`](https://github.com/skyler01-collab/spring-boot-jwt-photo-album-api/blob/main/src/main/java/com/example/springDemoWithRest/Controller/AlbumController.java) (Album controller), [`src/main/java/com/example/springDemoWithRest/Service/PhotoService.java`](https://github.com/skyler01-collab/spring-boot-jwt-photo-album-api/blob/main/src/main/java/com/example/springDemoWithRest/Service/PhotoService.java) (Photo service), [`src/main/java/com/example/springDemoWithRest/Service/TokenService.java`](https://github.com/skyler01-collab/spring-boot-jwt-photo-album-api/blob/main/src/main/java/com/example/springDemoWithRest/Service/TokenService.java) (Token service), [`src/main/java/com/example/springDemoWithRest/Controller/AuthController.java`](https://github.com/skyler01-collab/spring-boot-jwt-photo-album-api/blob/main/src/main/java/com/example/springDemoWithRest/Controller/AuthController.java) (Auth controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_auth["Accounts and tokens"]
  node_auth_controller["Auth controller"]
  node_account_service["Account service"]
  node_auth_dtos["Auth DTOs"]
  node_token_service["Token service<br/>[TokenService.java]"]
end

subgraph group_albums["Albums and photos"]
  node_album_controller["Album controller"]
  node_album_service["Album service<br/>[AlbumService.java]"]
  node_photo_service["Photo service<br/>[PhotoService.java]"]
  node_album_dtos["Album/photo DTOs"]
  node_file_helpers["File and thumbnail helpers<br/>[AppUtil.java]"]
end

subgraph group_persistence["Persistence"]
  node_account_repository["Account repository"]
  node_account_entity["Account entity<br/>[Account.java]"]
  node_album_repository["Album repository"]
  node_album_entity["Album entity<br/>[Album.java]"]
  node_photo_repository["Photo repository"]
  node_photo_entity["Photo entity<br/>[Photo.java]"]
  node_h2[("H2 database")]
end

subgraph group_platform["Security and API platform"]
  node_security_config["Security configuration"]
  node_rsa_keys["RSA and JWKS<br/>[Jwks.java]"]
  node_seed_data["Seeded accounts<br/>[SeedData.java]"]
  node_swagger["Swagger UI"]
end

node_client(("API client"))

node_client -->|"submits credentials"| node_auth_controller
node_auth_controller -->|"loads account"| node_account_service
node_auth_controller -->|"requests token"| node_token_service
node_token_service -->|"returns JWT"| node_client
node_client -->|"sends bearer token"| node_album_controller
node_album_controller -->|"protected by"| node_security_config
node_security_config -->|"validates JWTs"| node_token_service
node_album_controller -->|"delegates requests"| node_album_service
node_album_service -->|"uses repository layer"| node_album_repository
node_album_repository -->|"persists entities"| node_album_entity
node_album_controller -->|"handles photo endpoints"| node_photo_service
node_photo_service -->|"uses repository layer"| node_photo_repository
node_photo_repository -->|"persists entities"| node_photo_entity
node_account_service -->|"uses repository layer"| node_account_repository
node_account_repository -->|"persists entities"| node_account_entity
node_account_service -->|"stores accounts"| node_h2
node_album_service -->|"stores albums"| node_h2
node_photo_service -->|"stores photo records"| node_h2
node_photo_service -->|"supports uploads and thumbnails"| node_file_helpers
node_swagger -->|"documents API"| node_client
node_seed_data -.->|"seeds demo accounts"| node_account_repository
node_rsa_keys -.->|"provides signing keys"| node_token_service

click node_auth_controller "https://github.com/skyler01-collab/spring-boot-jwt-photo-album-api/blob/main/src/main/java/com/example/springDemoWithRest/Controller/AuthController.java"
click node_account_service "https://github.com/skyler01-collab/spring-boot-jwt-photo-album-api/blob/main/src/main/java/com/example/springDemoWithRest/Service/AccountService.java"
click node_account_repository "https://github.com/skyler01-collab/spring-boot-jwt-photo-album-api/blob/main/src/main/java/com/example/springDemoWithRest/Repository/AccountRepository.java"
click node_account_entity "https://github.com/skyler01-collab/spring-boot-jwt-photo-album-api/blob/main/src/main/java/com/example/springDemoWithRest/Model/Account.java"
click node_auth_dtos "https://github.com/skyler01-collab/spring-boot-jwt-photo-album-api/tree/main/src/main/java/com/example/springDemoWithRest/Payload/auth"
click node_token_service "https://github.com/skyler01-collab/spring-boot-jwt-photo-album-api/blob/main/src/main/java/com/example/springDemoWithRest/Service/TokenService.java"
click node_album_controller "https://github.com/skyler01-collab/spring-boot-jwt-photo-album-api/blob/main/src/main/java/com/example/springDemoWithRest/Controller/AlbumController.java"
click node_album_service "https://github.com/skyler01-collab/spring-boot-jwt-photo-album-api/blob/main/src/main/java/com/example/springDemoWithRest/Service/AlbumService.java"
click node_album_repository "https://github.com/skyler01-collab/spring-boot-jwt-photo-album-api/blob/main/src/main/java/com/example/springDemoWithRest/Repository/AlbumRepository.java"
click node_album_entity "https://github.com/skyler01-collab/spring-boot-jwt-photo-album-api/blob/main/src/main/java/com/example/springDemoWithRest/Model/Album.java"
click node_photo_service "https://github.com/skyler01-collab/spring-boot-jwt-photo-album-api/blob/main/src/main/java/com/example/springDemoWithRest/Service/PhotoService.java"
click node_photo_repository "https://github.com/skyler01-collab/spring-boot-jwt-photo-album-api/blob/main/src/main/java/com/example/springDemoWithRest/Repository/PhotoRepository.java"
click node_photo_entity "https://github.com/skyler01-collab/spring-boot-jwt-photo-album-api/blob/main/src/main/java/com/example/springDemoWithRest/Model/Photo.java"
click node_album_dtos "https://github.com/skyler01-collab/spring-boot-jwt-photo-album-api/tree/main/src/main/java/com/example/springDemoWithRest/Payload/auth/album"
click node_file_helpers "https://github.com/skyler01-collab/spring-boot-jwt-photo-album-api/blob/main/src/main/java/com/example/springDemoWithRest/util/constants/AppUtils/AppUtil.java"
click node_security_config "https://github.com/skyler01-collab/spring-boot-jwt-photo-album-api/blob/main/src/main/java/com/example/springDemoWithRest/Security/SecurityConfig.java"
click node_rsa_keys "https://github.com/skyler01-collab/spring-boot-jwt-photo-album-api/blob/main/src/main/java/com/example/springDemoWithRest/Security/Jwks.java"
click node_seed_data "https://github.com/skyler01-collab/spring-boot-jwt-photo-album-api/blob/main/src/main/java/com/example/springDemoWithRest/config/SeedData.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_auth_controller,node_account_service,node_auth_dtos,node_token_service,node_client toneBlue
class node_album_controller,node_album_service,node_photo_service,node_album_dtos,node_file_helpers toneAmber
class node_account_repository,node_account_entity,node_album_repository,node_album_entity,node_photo_repository,node_photo_entity,node_h2 toneMint
class node_security_config,node_rsa_keys,node_seed_data,node_swagger toneRose
```

## Components

### Accounts and tokens

- [Auth controller](https://github.com/skyler01-collab/spring-boot-jwt-photo-album-api/blob/main/src/main/java/com/example/springDemoWithRest/Controller/AuthController.java): `src/main/java/com/example/springDemoWithRest/Controller/AuthController.java`
- [Account service](https://github.com/skyler01-collab/spring-boot-jwt-photo-album-api/blob/main/src/main/java/com/example/springDemoWithRest/Service/AccountService.java): `src/main/java/com/example/springDemoWithRest/Service/AccountService.java`
- [Auth DTOs](https://github.com/skyler01-collab/spring-boot-jwt-photo-album-api/tree/main/src/main/java/com/example/springDemoWithRest/Payload/auth): `src/main/java/com/example/springDemoWithRest/Payload/auth`
- [Token service](https://github.com/skyler01-collab/spring-boot-jwt-photo-album-api/blob/main/src/main/java/com/example/springDemoWithRest/Service/TokenService.java): `src/main/java/com/example/springDemoWithRest/Service/TokenService.java`

### Albums and photos

- [Album controller](https://github.com/skyler01-collab/spring-boot-jwt-photo-album-api/blob/main/src/main/java/com/example/springDemoWithRest/Controller/AlbumController.java): `src/main/java/com/example/springDemoWithRest/Controller/AlbumController.java`
- [Album service](https://github.com/skyler01-collab/spring-boot-jwt-photo-album-api/blob/main/src/main/java/com/example/springDemoWithRest/Service/AlbumService.java): `src/main/java/com/example/springDemoWithRest/Service/AlbumService.java`
- [Photo service](https://github.com/skyler01-collab/spring-boot-jwt-photo-album-api/blob/main/src/main/java/com/example/springDemoWithRest/Service/PhotoService.java): `src/main/java/com/example/springDemoWithRest/Service/PhotoService.java`
- [Album/photo DTOs](https://github.com/skyler01-collab/spring-boot-jwt-photo-album-api/tree/main/src/main/java/com/example/springDemoWithRest/Payload/auth/album): `src/main/java/com/example/springDemoWithRest/Payload/auth/album`
- [File and thumbnail helpers](https://github.com/skyler01-collab/spring-boot-jwt-photo-album-api/blob/main/src/main/java/com/example/springDemoWithRest/util/constants/AppUtils/AppUtil.java): `src/main/java/com/example/springDemoWithRest/util/constants/AppUtils/AppUtil.java`

### Persistence

- [Account repository](https://github.com/skyler01-collab/spring-boot-jwt-photo-album-api/blob/main/src/main/java/com/example/springDemoWithRest/Repository/AccountRepository.java): `src/main/java/com/example/springDemoWithRest/Repository/AccountRepository.java`
- [Account entity](https://github.com/skyler01-collab/spring-boot-jwt-photo-album-api/blob/main/src/main/java/com/example/springDemoWithRest/Model/Account.java): `src/main/java/com/example/springDemoWithRest/Model/Account.java`
- [Album repository](https://github.com/skyler01-collab/spring-boot-jwt-photo-album-api/blob/main/src/main/java/com/example/springDemoWithRest/Repository/AlbumRepository.java): `src/main/java/com/example/springDemoWithRest/Repository/AlbumRepository.java`
- [Album entity](https://github.com/skyler01-collab/spring-boot-jwt-photo-album-api/blob/main/src/main/java/com/example/springDemoWithRest/Model/Album.java): `src/main/java/com/example/springDemoWithRest/Model/Album.java`
- [Photo repository](https://github.com/skyler01-collab/spring-boot-jwt-photo-album-api/blob/main/src/main/java/com/example/springDemoWithRest/Repository/PhotoRepository.java): `src/main/java/com/example/springDemoWithRest/Repository/PhotoRepository.java`
- [Photo entity](https://github.com/skyler01-collab/spring-boot-jwt-photo-album-api/blob/main/src/main/java/com/example/springDemoWithRest/Model/Photo.java): `src/main/java/com/example/springDemoWithRest/Model/Photo.java`
- **H2 database**

### Security and API platform

- [Security configuration](https://github.com/skyler01-collab/spring-boot-jwt-photo-album-api/blob/main/src/main/java/com/example/springDemoWithRest/Security/SecurityConfig.java): `src/main/java/com/example/springDemoWithRest/Security/SecurityConfig.java`
- [RSA and JWKS](https://github.com/skyler01-collab/spring-boot-jwt-photo-album-api/blob/main/src/main/java/com/example/springDemoWithRest/Security/Jwks.java): `src/main/java/com/example/springDemoWithRest/Security/Jwks.java`
- [Seeded accounts](https://github.com/skyler01-collab/spring-boot-jwt-photo-album-api/blob/main/src/main/java/com/example/springDemoWithRest/config/SeedData.java): `src/main/java/com/example/springDemoWithRest/config/SeedData.java`
- **Swagger UI**

### Other components

- **API client**

## Connections

- API client → Auth controller: submits credentials (evidence: `README.md`)
- Auth controller → Account service: loads account (evidence: `README.md`)
- Auth controller → Token service: requests token (evidence: `README.md`)
- Token service → API client: returns JWT (evidence: `README.md`)
- API client → Album controller: sends bearer token (evidence: `README.md`)
- Album controller → Security configuration: protected by (evidence: `README.md`)
- Security configuration → Token service: validates JWTs (evidence: `README.md`)
- Album controller → Album service: delegates requests (evidence: `README.md`)
- Album service → Album repository: uses repository layer (evidence: `README.md`)
- Album repository → Album entity: persists entities (evidence: `README.md`)
- Album controller → Photo service: handles photo endpoints (evidence: `README.md`)
- Photo service → Photo repository: uses repository layer (evidence: `README.md`)
- Photo repository → Photo entity: persists entities (evidence: `README.md`)
- Account service → Account repository: uses repository layer (evidence: `README.md`)
- Account repository → Account entity: persists entities (evidence: `README.md`)
- Account service → H2 database: stores accounts (evidence: `README.md`)
- Album service → H2 database: stores albums (evidence: `README.md`)
- Photo service → H2 database: stores photo records (evidence: `README.md`)
- Photo service → File and thumbnail helpers: supports uploads and thumbnails (evidence: `README.md`)
- Swagger UI → API client: documents API (evidence: `README.md`)
- Seeded accounts → Account repository: seeds demo accounts
- RSA and JWKS → Token service: provides signing keys
