# se-itmo-labs/nosql-sem5-lab1 architecture

> Architecture diagram of the GitHub repository se-itmo-labs/nosql-sem5-lab1, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/se-itmo-labs/nosql-sem5-lab1
- Repository: https://github.com/se-itmo-labs/nosql-sem5-lab1

## Overview

This is a cinema-themed customer account application whose main workflow creates notifications and retrieves them by ID or customer. The Spring backend stores notification JSON, per-customer sorted-set indexes, and an ID sequence in Redis. Separate features provide temporary resource blocks, Redisson distributed locks, and a category-cache abstraction; the category cache’s miss source is explicitly not implemented. The Nuxt frontend and its API composable are shown as product components, but their request wiring was not sampled, so no frontend-to-backend calls are asserted.

Main entry points: [`src/main/java/org/seitmolabs/service/CategoryService.java`](https://github.com/se-itmo-labs/nosql-sem5-lab1/blob/main/src/main/java/org/seitmolabs/service/CategoryService.java) (Category service), [`src/main/java/org/seitmolabs/service/NotificationService.java`](https://github.com/se-itmo-labs/nosql-sem5-lab1/blob/main/src/main/java/org/seitmolabs/service/NotificationService.java) (Notification service), [`src/main/java/org/seitmolabs/service/BlockService.java`](https://github.com/se-itmo-labs/nosql-sem5-lab1/blob/main/src/main/java/org/seitmolabs/service/BlockService.java) (Temporary block service), [`src/main/java/org/seitmolabs/service/DistributedLockService.java`](https://github.com/se-itmo-labs/nosql-sem5-lab1/blob/main/src/main/java/org/seitmolabs/service/DistributedLockService.java) (Distributed lock service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Nuxt frontend"]
  node_pages["Account pages"]
  node_api_client["API composable<br/>[useApi.ts]"]
  node_auth["Demo auth<br/>[useAuth.ts]"]
end

subgraph group_api["Spring API"]
  node_notification_api["Notification API"]
  node_block_api["Temporary block API"]
  node_lock_api["Lock test API"]
  node_hello_api["Hello cache API"]
end

subgraph group_domain["Domain services"]
  node_notification_service["Notification service"]
  node_category_service["Category service"]
  node_block_service["Temporary block service<br/>[BlockService.java]"]
  node_lock_service["Distributed lock service"]
end

subgraph group_storage["Redis storage"]
  node_notification_repo["Notification repository"]
  node_category_cache["Category cache"]
  node_block_repo["Block repository"]
end

node_customer(("Customer"))
node_redis[("Redis")]
node_redisson["Redisson client"]
node_category_source[("Category source")]

node_customer -->|"uses"| node_pages
node_notification_api -->|"delegates"| node_notification_service
node_notification_service -->|"creates and reads"| node_notification_repo
node_notification_repo -->|"stores and queries"| node_redis
node_block_api -->|"delegates"| node_block_service
node_block_service -->|"attempts save"| node_block_repo
node_block_repo -->|"stores with TTL"| node_redis
node_lock_api -->|"executes under lock"| node_lock_service
node_lock_service -->|"acquires and releases"| node_redisson
node_redisson -->|"uses"| node_redis
node_category_service -->|"reads and writes"| node_category_cache
node_category_cache -->|"caches categories"| node_redis
node_category_service -.->|"loads on miss"| node_category_source
node_hello_api -->|"reads and caches"| node_redis

click node_pages "https://github.com/se-itmo-labs/nosql-sem5-lab1/tree/main/nosql-sem5-lab1-frontend/app/pages"
click node_api_client "https://github.com/se-itmo-labs/nosql-sem5-lab1/blob/main/nosql-sem5-lab1-frontend/app/composables/useApi.ts"
click node_auth "https://github.com/se-itmo-labs/nosql-sem5-lab1/blob/main/nosql-sem5-lab1-frontend/app/composables/useAuth.ts"
click node_notification_api "https://github.com/se-itmo-labs/nosql-sem5-lab1/blob/main/src/main/java/org/seitmolabs/controller/NotificationController.java"
click node_block_api "https://github.com/se-itmo-labs/nosql-sem5-lab1/blob/main/src/main/java/org/seitmolabs/controller/BlockController.java"
click node_lock_api "https://github.com/se-itmo-labs/nosql-sem5-lab1/blob/main/src/main/java/org/seitmolabs/controller/LockController.java"
click node_hello_api "https://github.com/se-itmo-labs/nosql-sem5-lab1/blob/main/src/main/java/org/seitmolabs/HelloController.java"
click node_notification_service "https://github.com/se-itmo-labs/nosql-sem5-lab1/blob/main/src/main/java/org/seitmolabs/service/NotificationService.java"
click node_category_service "https://github.com/se-itmo-labs/nosql-sem5-lab1/blob/main/src/main/java/org/seitmolabs/service/CategoryService.java"
click node_block_service "https://github.com/se-itmo-labs/nosql-sem5-lab1/blob/main/src/main/java/org/seitmolabs/service/BlockService.java"
click node_lock_service "https://github.com/se-itmo-labs/nosql-sem5-lab1/blob/main/src/main/java/org/seitmolabs/service/DistributedLockService.java"
click node_notification_repo "https://github.com/se-itmo-labs/nosql-sem5-lab1/blob/main/src/main/java/org/seitmolabs/repository/NotificationRepository.java"
click node_category_cache "https://github.com/se-itmo-labs/nosql-sem5-lab1/blob/main/src/main/java/org/seitmolabs/repository/CategoryCacheRepository.java"
click node_block_repo "https://github.com/se-itmo-labs/nosql-sem5-lab1/blob/main/src/main/java/org/seitmolabs/repository/BlockRepository.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_pages,node_api_client,node_auth toneBlue
class node_notification_api,node_block_api,node_lock_api,node_hello_api,node_redis,node_redisson,node_category_source toneAmber
class node_notification_service,node_category_service,node_block_service,node_lock_service toneMint
class node_notification_repo,node_category_cache,node_block_repo toneRose
class node_customer toneIndigo
```

## Components

### Nuxt frontend

- [Account pages](https://github.com/se-itmo-labs/nosql-sem5-lab1/tree/main/nosql-sem5-lab1-frontend/app/pages): `nosql-sem5-lab1-frontend/app/pages`
- [API composable](https://github.com/se-itmo-labs/nosql-sem5-lab1/blob/main/nosql-sem5-lab1-frontend/app/composables/useApi.ts): `nosql-sem5-lab1-frontend/app/composables/useApi.ts`
- [Demo auth](https://github.com/se-itmo-labs/nosql-sem5-lab1/blob/main/nosql-sem5-lab1-frontend/app/composables/useAuth.ts): `nosql-sem5-lab1-frontend/app/composables/useAuth.ts`

### Spring API

- [Notification API](https://github.com/se-itmo-labs/nosql-sem5-lab1/blob/main/src/main/java/org/seitmolabs/controller/NotificationController.java): `src/main/java/org/seitmolabs/controller/NotificationController.java`
- [Temporary block API](https://github.com/se-itmo-labs/nosql-sem5-lab1/blob/main/src/main/java/org/seitmolabs/controller/BlockController.java): `src/main/java/org/seitmolabs/controller/BlockController.java`
- [Lock test API](https://github.com/se-itmo-labs/nosql-sem5-lab1/blob/main/src/main/java/org/seitmolabs/controller/LockController.java): `src/main/java/org/seitmolabs/controller/LockController.java`
- [Hello cache API](https://github.com/se-itmo-labs/nosql-sem5-lab1/blob/main/src/main/java/org/seitmolabs/HelloController.java): `src/main/java/org/seitmolabs/HelloController.java`

### Domain services

- [Notification service](https://github.com/se-itmo-labs/nosql-sem5-lab1/blob/main/src/main/java/org/seitmolabs/service/NotificationService.java): `src/main/java/org/seitmolabs/service/NotificationService.java`
- [Category service](https://github.com/se-itmo-labs/nosql-sem5-lab1/blob/main/src/main/java/org/seitmolabs/service/CategoryService.java): `src/main/java/org/seitmolabs/service/CategoryService.java`
- [Temporary block service](https://github.com/se-itmo-labs/nosql-sem5-lab1/blob/main/src/main/java/org/seitmolabs/service/BlockService.java): `src/main/java/org/seitmolabs/service/BlockService.java`
- [Distributed lock service](https://github.com/se-itmo-labs/nosql-sem5-lab1/blob/main/src/main/java/org/seitmolabs/service/DistributedLockService.java): `src/main/java/org/seitmolabs/service/DistributedLockService.java`

### Redis storage

- [Notification repository](https://github.com/se-itmo-labs/nosql-sem5-lab1/blob/main/src/main/java/org/seitmolabs/repository/NotificationRepository.java): `src/main/java/org/seitmolabs/repository/NotificationRepository.java`
- [Category cache](https://github.com/se-itmo-labs/nosql-sem5-lab1/blob/main/src/main/java/org/seitmolabs/repository/CategoryCacheRepository.java): `src/main/java/org/seitmolabs/repository/CategoryCacheRepository.java`
- [Block repository](https://github.com/se-itmo-labs/nosql-sem5-lab1/blob/main/src/main/java/org/seitmolabs/repository/BlockRepository.java): `src/main/java/org/seitmolabs/repository/BlockRepository.java`

### Other components

- **Customer**
- **Redis**
- **Redisson client**
- **Category source**

## Connections

- Customer → Account pages: uses
- Notification API → Notification service: delegates
- Notification service → Notification repository: creates and reads
- Notification repository → Redis: stores and queries
- Temporary block API → Temporary block service: delegates
- Temporary block service → Block repository: attempts save
- Block repository → Redis: stores with TTL
- Lock test API → Distributed lock service: executes under lock
- Distributed lock service → Redisson client: acquires and releases
- Redisson client → Redis: uses
- Category service → Category cache: reads and writes
- Category cache → Redis: caches categories
- Category service → Category source: loads on miss
- Hello cache API → Redis: reads and caches
