# jakubdziem/wadrobe-api architecture

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

- Interactive diagram: https://gitdiagram.com/jakubdziem/wadrobe-api
- Repository: https://github.com/jakubdziem/wadrobe-api

## Overview

ClothesARServer is a JWT-secured REST backend for a wardrobe-management mobile app. Its principal workflow is an authenticated client request to browse wardrobe previews or create, inspect, and update clothing records; separate endpoints manage favorites and wear counts. Authentication handles registration, login, token issuance, logout, and the current user. The tree and README establish the broader security, persistence, and API-documentation subsystems, but sampled implementation is limited, so uncertain service-to-repository and security-filter wiring is not shown.

Main entry points: [`src/main/java/org/dziem/clothesarserver/service/AuthServiceImpl.java`](https://github.com/jakubdziem/wadrobe-api/blob/main/src/main/java/org/dziem/clothesarserver/service/AuthServiceImpl.java) (Auth Service), [`src/main/java/org/dziem/clothesarserver/controller/AuthController.java`](https://github.com/jakubdziem/wadrobe-api/blob/main/src/main/java/org/dziem/clothesarserver/controller/AuthController.java) (Auth Controller), [`src/main/java/org/dziem/clothesarserver/controller/PieceOfClothingController.java`](https://github.com/jakubdziem/wadrobe-api/blob/main/src/main/java/org/dziem/clothesarserver/controller/PieceOfClothingController.java) (Clothing Controller), [`src/main/java/org/dziem/clothesarserver/controller/WardrobeController.java`](https://github.com/jakubdziem/wadrobe-api/blob/main/src/main/java/org/dziem/clothesarserver/controller/WardrobeController.java) (Wardrobe Controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["REST API"]
  node_auth_controller["Auth Controller"]
  node_clothing_controller["Clothing Controller"]
  node_wardrobe_controller["Wardrobe Controller"]
  node_exception_handler["Exception Handler"]
end

subgraph group_domain["Wardrobe Services"]
  node_clothing_service["Clothing Service"]
  node_wardrobe_service["Wardrobe Service"]
end

subgraph group_security["Identity Security"]
  node_auth_service["Auth Service"]
  node_user_service["User Service"]
  node_jwt_provider["JWT Provider<br/>[JwtProvider.java]"]
  node_jwt_filter["JWT Filter<br/>[JwtAuthFilter.java]"]
  node_security_config["Security Config"]
end

subgraph group_persistence["Persistence"]
  node_clothing_repository["Clothing Repository"]
  node_user_repository["User Repository"]
  node_reference_repositories["Reference Repositories"]
end

subgraph group_api_docs["API Exploration"]
  node_openapi_config["OpenAPI Config<br/>[OpenApiConfig.java]"]
end

node_mobile_client(("Mobile Client"))
node_password_encoder["Password Encoder"]
node_token_store[("Redis Token Store")]
node_postgres[("PostgreSQL")]

node_mobile_client -->|"auth requests"| node_auth_controller
node_mobile_client -->|"clothing requests"| node_clothing_controller
node_mobile_client -->|"wardrobe requests"| node_wardrobe_controller
node_auth_controller -->|"delegates auth"| node_auth_service
node_clothing_controller -->|"delegates clothing"| node_clothing_service
node_wardrobe_controller -->|"requests preview"| node_wardrobe_service
node_auth_service -->|"reads and saves users"| node_user_repository
node_auth_service -->|"checks user"| node_user_service
node_auth_service -->|"generates token"| node_jwt_provider
node_auth_service -->|"checks passwords"| node_password_encoder
node_auth_service -->|"stores or deletes tokens"| node_token_store
node_jwt_filter -.->|"validates token"| node_jwt_provider
node_clothing_repository -->|"persists entities"| node_postgres
node_user_repository -->|"persists users"| node_postgres
node_reference_repositories -.->|"JPA persistence"| node_postgres
node_mobile_client -.->|"explores API"| node_openapi_config

click node_auth_controller "https://github.com/jakubdziem/wadrobe-api/blob/main/src/main/java/org/dziem/clothesarserver/controller/AuthController.java"
click node_clothing_controller "https://github.com/jakubdziem/wadrobe-api/blob/main/src/main/java/org/dziem/clothesarserver/controller/PieceOfClothingController.java"
click node_wardrobe_controller "https://github.com/jakubdziem/wadrobe-api/blob/main/src/main/java/org/dziem/clothesarserver/controller/WardrobeController.java"
click node_auth_service "https://github.com/jakubdziem/wadrobe-api/blob/main/src/main/java/org/dziem/clothesarserver/service/AuthServiceImpl.java"
click node_user_service "https://github.com/jakubdziem/wadrobe-api/blob/main/src/main/java/org/dziem/clothesarserver/service/UserServiceImpl.java"
click node_jwt_provider "https://github.com/jakubdziem/wadrobe-api/blob/main/src/main/java/org/dziem/clothesarserver/security/JwtProvider.java"
click node_jwt_filter "https://github.com/jakubdziem/wadrobe-api/blob/main/src/main/java/org/dziem/clothesarserver/security/JwtAuthFilter.java"
click node_security_config "https://github.com/jakubdziem/wadrobe-api/blob/main/src/main/java/org/dziem/clothesarserver/security/SecurityConfig.java"
click node_clothing_service "https://github.com/jakubdziem/wadrobe-api/blob/main/src/main/java/org/dziem/clothesarserver/service/PieceOfClothingServiceImpl.java"
click node_wardrobe_service "https://github.com/jakubdziem/wadrobe-api/blob/main/src/main/java/org/dziem/clothesarserver/service/WardrobeServiceImpl.java"
click node_clothing_repository "https://github.com/jakubdziem/wadrobe-api/blob/main/src/main/java/org/dziem/clothesarserver/repository/PieceOfClothingRepository.java"
click node_user_repository "https://github.com/jakubdziem/wadrobe-api/blob/main/src/main/java/org/dziem/clothesarserver/repository/UserRepository.java"
click node_reference_repositories "https://github.com/jakubdziem/wadrobe-api/tree/main/src/main/java/org/dziem/clothesarserver/repository"
click node_openapi_config "https://github.com/jakubdziem/wadrobe-api/blob/main/src/main/java/org/dziem/clothesarserver/config/OpenApiConfig.java"
click node_exception_handler "https://github.com/jakubdziem/wadrobe-api/blob/main/src/main/java/org/dziem/clothesarserver/exception/GlobalExceptionHandler.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_clothing_controller,node_wardrobe_controller,node_exception_handler,node_mobile_client toneBlue
class node_clothing_service,node_wardrobe_service,node_token_store,node_postgres toneAmber
class node_auth_service,node_user_service,node_jwt_provider,node_jwt_filter,node_security_config toneMint
class node_clothing_repository,node_user_repository,node_reference_repositories toneRose
class node_openapi_config,node_password_encoder toneIndigo
```

## Components

### REST API

- [Auth Controller](https://github.com/jakubdziem/wadrobe-api/blob/main/src/main/java/org/dziem/clothesarserver/controller/AuthController.java): `src/main/java/org/dziem/clothesarserver/controller/AuthController.java`
- [Clothing Controller](https://github.com/jakubdziem/wadrobe-api/blob/main/src/main/java/org/dziem/clothesarserver/controller/PieceOfClothingController.java): `src/main/java/org/dziem/clothesarserver/controller/PieceOfClothingController.java`
- [Wardrobe Controller](https://github.com/jakubdziem/wadrobe-api/blob/main/src/main/java/org/dziem/clothesarserver/controller/WardrobeController.java): `src/main/java/org/dziem/clothesarserver/controller/WardrobeController.java`
- [Exception Handler](https://github.com/jakubdziem/wadrobe-api/blob/main/src/main/java/org/dziem/clothesarserver/exception/GlobalExceptionHandler.java): `src/main/java/org/dziem/clothesarserver/exception/GlobalExceptionHandler.java`

### Wardrobe Services

- [Clothing Service](https://github.com/jakubdziem/wadrobe-api/blob/main/src/main/java/org/dziem/clothesarserver/service/PieceOfClothingServiceImpl.java): `src/main/java/org/dziem/clothesarserver/service/PieceOfClothingServiceImpl.java`
- [Wardrobe Service](https://github.com/jakubdziem/wadrobe-api/blob/main/src/main/java/org/dziem/clothesarserver/service/WardrobeServiceImpl.java): `src/main/java/org/dziem/clothesarserver/service/WardrobeServiceImpl.java`

### Identity Security

- [Auth Service](https://github.com/jakubdziem/wadrobe-api/blob/main/src/main/java/org/dziem/clothesarserver/service/AuthServiceImpl.java): `src/main/java/org/dziem/clothesarserver/service/AuthServiceImpl.java`
- [User Service](https://github.com/jakubdziem/wadrobe-api/blob/main/src/main/java/org/dziem/clothesarserver/service/UserServiceImpl.java): `src/main/java/org/dziem/clothesarserver/service/UserServiceImpl.java`
- [JWT Provider](https://github.com/jakubdziem/wadrobe-api/blob/main/src/main/java/org/dziem/clothesarserver/security/JwtProvider.java): `src/main/java/org/dziem/clothesarserver/security/JwtProvider.java`
- [JWT Filter](https://github.com/jakubdziem/wadrobe-api/blob/main/src/main/java/org/dziem/clothesarserver/security/JwtAuthFilter.java): `src/main/java/org/dziem/clothesarserver/security/JwtAuthFilter.java`
- [Security Config](https://github.com/jakubdziem/wadrobe-api/blob/main/src/main/java/org/dziem/clothesarserver/security/SecurityConfig.java): `src/main/java/org/dziem/clothesarserver/security/SecurityConfig.java`

### Persistence

- [Clothing Repository](https://github.com/jakubdziem/wadrobe-api/blob/main/src/main/java/org/dziem/clothesarserver/repository/PieceOfClothingRepository.java): `src/main/java/org/dziem/clothesarserver/repository/PieceOfClothingRepository.java`
- [User Repository](https://github.com/jakubdziem/wadrobe-api/blob/main/src/main/java/org/dziem/clothesarserver/repository/UserRepository.java): `src/main/java/org/dziem/clothesarserver/repository/UserRepository.java`
- [Reference Repositories](https://github.com/jakubdziem/wadrobe-api/tree/main/src/main/java/org/dziem/clothesarserver/repository): `src/main/java/org/dziem/clothesarserver/repository`

### API Exploration

- [OpenAPI Config](https://github.com/jakubdziem/wadrobe-api/blob/main/src/main/java/org/dziem/clothesarserver/config/OpenApiConfig.java): `src/main/java/org/dziem/clothesarserver/config/OpenApiConfig.java`

### Other components

- **Mobile Client**
- **Password Encoder**
- **Redis Token Store**
- **PostgreSQL**

## Connections

- Mobile Client → Auth Controller: auth requests
- Mobile Client → Clothing Controller: clothing requests
- Mobile Client → Wardrobe Controller: wardrobe requests
- Auth Controller → Auth Service: delegates auth
- Clothing Controller → Clothing Service: delegates clothing
- Wardrobe Controller → Wardrobe Service: requests preview
- Auth Service → User Repository: reads and saves users
- Auth Service → User Service: checks user
- Auth Service → JWT Provider: generates token
- Auth Service → Password Encoder: checks passwords
- Auth Service → Redis Token Store: stores or deletes tokens
- JWT Filter → JWT Provider: validates token
- Clothing Repository → PostgreSQL: persists entities
- User Repository → PostgreSQL: persists users
- Reference Repositories → PostgreSQL: JPA persistence
- Mobile Client → OpenAPI Config: explores API
