How skyler01-collab/spring-boot-jwt-photo-album-api works
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: AlbumController.java Album controller · PhotoService.java Photo service · TokenService.java Token service · AuthController.java Auth controller
Components 21
Accounts and tokens
- Auth controller
src/main/java/com/example/springDemoWithRest/Controller/AuthController.java - Account service
src/main/java/com/example/springDemoWithRest/Service/AccountService.java - Auth DTOs
src/main/java/com/example/springDemoWithRest/Payload/auth - Token service
src/main/java/com/example/springDemoWithRest/Service/TokenService.java
Albums and photos
- Album controller
src/main/java/com/example/springDemoWithRest/Controller/AlbumController.java - Album service
src/main/java/com/example/springDemoWithRest/Service/AlbumService.java - Photo service
src/main/java/com/example/springDemoWithRest/Service/PhotoService.java - Album/photo DTOs
src/main/java/com/example/springDemoWithRest/Payload/auth/album - File and thumbnail helpers
src/main/java/com/example/springDemoWithRest/util/constants/AppUtils/AppUtil.java
Persistence
- Account repository
src/main/java/com/example/springDemoWithRest/Repository/AccountRepository.java - Account entity
src/main/java/com/example/springDemoWithRest/Model/Account.java - Album repository
src/main/java/com/example/springDemoWithRest/Repository/AlbumRepository.java - Album entity
src/main/java/com/example/springDemoWithRest/Model/Album.java - Photo repository
src/main/java/com/example/springDemoWithRest/Repository/PhotoRepository.java - Photo entity
src/main/java/com/example/springDemoWithRest/Model/Photo.java - H2 database
Security and API platform
- Security configuration
src/main/java/com/example/springDemoWithRest/Security/SecurityConfig.java - RSA and JWKS
src/main/java/com/example/springDemoWithRest/Security/Jwks.java - Seeded accounts
src/main/java/com/example/springDemoWithRest/config/SeedData.java - Swagger UI
Other components
- API client
Connections 22
- API client → Auth controller: submits credentials
README.md - Auth controller → Account service: loads account
README.md - Auth controller → Token service: requests token
README.md - Token service → API client: returns JWT
README.md - API client → Album controller: sends bearer token
README.md - Album controller → Security configuration: protected by
README.md - Security configuration → Token service: validates JWTs
README.md - Album controller → Album service: delegates requests
README.md - Album service → Album repository: uses repository layer
README.md - Album repository → Album entity: persists entities
README.md - Album controller → Photo service: handles photo endpoints
README.md - Photo service → Photo repository: uses repository layer
README.md - Photo repository → Photo entity: persists entities
README.md - Account service → Account repository: uses repository layer
README.md - Account repository → Account entity: persists entities
README.md - Account service → H2 database: stores accounts
README.md - Album service → H2 database: stores albums
README.md - Photo service → H2 database: stores photo records
README.md - Photo service → File and thumbnail helpers: supports uploads and thumbnails
README.md - Swagger UI → API client: documents API
README.md - Seeded accounts → Account repository: seeds demo accounts
- RSA and JWKS → Token service: provides signing keys