# nxvxrloseee/coursework architecture

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

- Interactive diagram: https://gitdiagram.com/nxvxrloseee/coursework
- Repository: https://github.com/nxvxrloseee/coursework

## Overview

1. This repository is a multi-client repair-service platform with one shared backend and two user-facing clients. The backend is the system of record; the React web app is for master/admin workflows, and the Flutter app is for customers.

2. The backend lives in `RD/` and is a Spring Boot 3.5 application on JDK 17. It uses PostgreSQL with JPA/Hibernate as the main persistence layer, and `ddl-auto=update` indicates the schema is managed from entities rather than migrations. The backend is containerized and meant to run with its supporting services through `docker-compose.yml`.

3. The backend’s core domain is ticket-centric. The main entities model users, roles, ticket categories, tickets, ticket services, status history, ticket messages, media attachments, services/price items, and notifications. That gives the architecture a clear transactional boundary around “repair ticket lifecycle” plus supporting catalog and communication data.

4. The request boundary is REST controllers in `controller/`, backed by service-layer orchestration in `service/` and repository access in `repository/`. The important services are `TicketManagementService`, `ChatService`, `DashboardService`, `NotificationService`, `UserService`, `AuthService`, `FileService`, and `PriceListService`, which map closely to the business areas exposed by the clients.

5. Authentication and authorization are centralized in `security/` with JWT-based auth (`JwtProvider`, `JwtFilter`) and `SecurityConfig`. The README notes refresh handling via httpOnly cookie and bcrypt password hashing, so the auth boundary is stateful at the browser/app edge but stateless in the main request pipeline.

6. Real-time communication is a separate subsystem. `WebSocketConfig` and the chat DTOs/controllers indicate STOMP-based WebSocket messaging for ticket chat and live updates. This sits alongside REST, not inside it, so chat is likely a mixed model: REST for history/state, WS for live message delivery.

7. Async/infrastructure integrations are first-class in the backend config: `RabbitConfig`, `RedisConfig`, and `MinioConfig`. RabbitMQ and Redis support cross-cutting concerns such as notifications and transient state/caching, while MinIO handles file/object storage for ticket media and uploaded artifacts. `FileController` and `FileService` are the boundary for that object-storage flow.

8. `NotificationController`, `NotificationService`, and the notification DTOs/entities form a dedicated notification pipeline. The mobile client also has a `push_service`, so the system likely combines backend-generated notification events with device push delivery on the customer side.

9. The dashboard subsystem is isolated around `DashboardController`/`DashboardService` and returns analytics DTOs such as revenue points and summary responses. This implies a reporting/read-optimized path separate from the transactional ticket CRUD path, which is important for diagramming read vs write responsibilities.

10. `DataSeeder` indicates the backend bootstraps initial reference data, likely roles/categories/services, so some parts of the domain are initialized automatically at startup. `GlobalExceptionHandler` and `ApiException` define the error boundary and consistent API failure responses.

11. `rd-master/` is the operator UI built with React, Vite, and TypeScript. It consumes the backend through dedicated API modules (`src/api/*`), uses a client wrapper, maintains auth and notification state in stores, and includes a WebSocket hook for live ticket/chat updates. Its pages map directly to backend domains: dashboard, tickets, history, notifications, services, profile, login, and ticket detail.

12. `rd-customer/` is the customer-facing Flutter app targeting Android/iOS and other Flutter platforms. It has its own API layer and screens for login/register, ticket creation, ticket history/details, notifications, profile, and guest access. This client is narrower than the web app and focuses on self-service ticket submission and chat follow-up.

13. Operationally, the system is packaged for local/container deployment. `RD/docker-compose.yml` brings up the backend plus PostgreSQL, Redis, RabbitMQ, MinIO, and the web frontend, while `backup.sh` supports PostgreSQL dump/restore workflows. That makes the deployment topology a small service stack centered on the Spring backend rather than a distributed microservice mesh.

Main entry points: [`RD/src/main/java/com/cw/rd/controller`](https://github.com/nxvxrloseee/coursework/tree/master/RD/src/main/java/com/cw/rd/controller) (REST API), [`rd-customer/lib/main.dart`](https://github.com/nxvxrloseee/coursework/blob/master/rd-customer/lib/main.dart) (Flutter app), [`RD/src/main/java/com/cw/rd/config`](https://github.com/nxvxrloseee/coursework/tree/master/RD/src/main/java/com/cw/rd/config) (Config), [`RD/src/main/java/com/cw/rd/RdApplication.java`](https://github.com/nxvxrloseee/coursework/blob/master/RD/src/main/java/com/cw/rd/RdApplication.java) (RD app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_backend["Spring backend"]
  node_rdapp(("RD app<br/>Spring Boot 3.5<br/>[RdApplication.java]"))
  node_config["Config<br/>boot wiring"]
  node_controllers["REST API<br/>HTTP controllers"]
  node_ws(("WebSocket<br/>STOMP realtime"))
  node_services["Services<br/>business layer"]
  node_domain[("Domain model<br/>JPA entities")]
  node_repos["Repositories"]
  node_security(("Security<br/>JWT auth"))
  node_dtos["API models<br/>DTOs"]
  node_infra["Infra config<br/>integration config"]
  node_errors(("Errors<br/>exception handling"))
end

subgraph group_admin["Admin web"]
  node_masterapp(("Master UI<br/>React Vite app<br/>[App.tsx]"))
  node_masterapi["Web API<br/>frontend clients"]
  node_masterstate["Web state<br/>stores/hooks"]
  node_masterpages["Web pages<br/>views"]
end

subgraph group_customer["Customer app"]
  node_customerapp(("Flutter app<br/>mobile client<br/>[main.dart]"))
  node_customerapi["App API<br/>client layer"]
  node_customerscreens["App screens<br/>UI views"]
  node_push(("Push service<br/>device notifications<br/>[push_service.dart]"))
end

subgraph group_ops["Deployment"]
  node_compose["Compose stack<br/>docker compose<br/>[docker-compose.yml]"]
  node_backup["Backup script<br/>postgres backup<br/>[backup.sh]"]
end

node_rdapp -->|"bootstraps"| node_config
node_rdapp -->|"serves"| node_controllers
node_rdapp -->|"uses"| node_services
node_config -->|"enables"| node_security
node_config -->|"enables"| node_ws
node_config -->|"wires"| node_infra
node_controllers -->|"maps"| node_dtos
node_controllers -->|"delegates"| node_services
node_services -->|"reads/writes"| node_domain
node_services -->|"persists"| node_repos
node_repos -->|"stores"| node_domain
node_security -->|"guards"| node_controllers
node_errors -->|"handles"| node_controllers
node_controllers -.->|"publishes"| node_ws
node_masterapp -->|"calls"| node_masterapi
node_masterapp -->|"uses"| node_masterstate
node_masterapp -->|"renders"| node_masterpages
node_masterapi -->|"consumes"| node_controllers
node_masterstate -.->|"subscribes"| node_ws
node_customerapp -->|"calls"| node_customerapi
node_customerapp -->|"renders"| node_customerscreens
node_customerapp -.->|"receives"| node_push
node_customerapi -->|"consumes"| node_controllers
node_customerapp -.->|"listens"| node_ws
node_compose -->|"runs"| node_rdapp
node_compose -->|"provisions"| node_infra
node_backup -.->|"supports"| node_compose

click node_rdapp "https://github.com/nxvxrloseee/coursework/blob/master/RD/src/main/java/com/cw/rd/RdApplication.java"
click node_config "https://github.com/nxvxrloseee/coursework/tree/master/RD/src/main/java/com/cw/rd/config"
click node_controllers "https://github.com/nxvxrloseee/coursework/tree/master/RD/src/main/java/com/cw/rd/controller"
click node_ws "https://github.com/nxvxrloseee/coursework/blob/master/RD/src/main/java/com/cw/rd/config/WebSocketConfig.java"
click node_services "https://github.com/nxvxrloseee/coursework/tree/master/RD/src/main/java/com/cw/rd/service"
click node_domain "https://github.com/nxvxrloseee/coursework/tree/master/RD/src/main/java/com/cw/rd/entity"
click node_repos "https://github.com/nxvxrloseee/coursework/tree/master/RD/src/main/java/com/cw/rd/repository"
click node_security "https://github.com/nxvxrloseee/coursework/tree/master/RD/src/main/java/com/cw/rd/security"
click node_dtos "https://github.com/nxvxrloseee/coursework/tree/master/RD/src/main/java/com/cw/rd/dto"
click node_infra "https://github.com/nxvxrloseee/coursework/tree/master/RD/src/main/java/com/cw/rd/config"
click node_errors "https://github.com/nxvxrloseee/coursework/tree/master/RD/src/main/java/com/cw/rd/exception"
click node_masterapp "https://github.com/nxvxrloseee/coursework/blob/master/rd-master/src/App.tsx"
click node_masterapi "https://github.com/nxvxrloseee/coursework/tree/master/rd-master/src/api"
click node_masterstate "https://github.com/nxvxrloseee/coursework/tree/master/rd-master/src/store"
click node_masterpages "https://github.com/nxvxrloseee/coursework/tree/master/rd-master/src/pages"
click node_customerapp "https://github.com/nxvxrloseee/coursework/blob/master/rd-customer/lib/main.dart"
click node_customerapi "https://github.com/nxvxrloseee/coursework/tree/master/rd-customer/lib/api"
click node_customerscreens "https://github.com/nxvxrloseee/coursework/tree/master/rd-customer/lib/screens"
click node_push "https://github.com/nxvxrloseee/coursework/blob/master/rd-customer/lib/services/push_service.dart"
click node_compose "https://github.com/nxvxrloseee/coursework/blob/master/RD/docker-compose.yml"
click node_backup "https://github.com/nxvxrloseee/coursework/blob/master/RD/backup.sh"

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_rdapp,node_config,node_controllers,node_ws,node_services,node_domain,node_repos,node_security,node_dtos,node_infra,node_errors toneBlue
class node_masterapp,node_masterapi,node_masterstate,node_masterpages toneAmber
class node_customerapp,node_customerapi,node_customerscreens,node_push toneMint
class node_compose,node_backup toneRose
```

## Components

### Spring backend

Shared system of record for tickets, users, chat, notifications, and reporting.

- [RD app](https://github.com/nxvxrloseee/coursework/blob/master/RD/src/main/java/com/cw/rd/RdApplication.java): Spring Boot 3.5 · Backend application entrypoint and composition root. · `RD/src/main/java/com/cw/rd/RdApplication.java`
- [Config](https://github.com/nxvxrloseee/coursework/tree/master/RD/src/main/java/com/cw/rd/config): boot wiring · Application bootstrap, storage, messaging, security, and realtime configuration. · `RD/src/main/java/com/cw/rd/config`
- [REST API](https://github.com/nxvxrloseee/coursework/tree/master/RD/src/main/java/com/cw/rd/controller): HTTP controllers · REST boundary for auth, tickets, users, catalog, files, notifications, and dashboard. · `RD/src/main/java/com/cw/rd/controller`
- [WebSocket](https://github.com/nxvxrloseee/coursework/blob/master/RD/src/main/java/com/cw/rd/config/WebSocketConfig.java): STOMP realtime · Live chat and update channel alongside REST. · `RD/src/main/java/com/cw/rd/config/WebSocketConfig.java`
- [Services](https://github.com/nxvxrloseee/coursework/tree/master/RD/src/main/java/com/cw/rd/service): business layer · Core orchestration for tickets, chat, auth, users, files, notifications, pricing, and dashboard. · `RD/src/main/java/com/cw/rd/service`
- [Domain model](https://github.com/nxvxrloseee/coursework/tree/master/RD/src/main/java/com/cw/rd/entity): JPA entities · Users, roles, tickets, ticket lifecycle, catalog items, messages, media, and notifications. · `RD/src/main/java/com/cw/rd/entity`
- [Repositories](https://github.com/nxvxrloseee/coursework/tree/master/RD/src/main/java/com/cw/rd/repository): JPA repositories · Persistence access for ticketing, users, catalog, messages, status history, and notifications. · `RD/src/main/java/com/cw/rd/repository`
- [Security](https://github.com/nxvxrloseee/coursework/tree/master/RD/src/main/java/com/cw/rd/security): JWT auth · JWT filters, token provider, and Spring security configuration. · `RD/src/main/java/com/cw/rd/security`
- [API models](https://github.com/nxvxrloseee/coursework/tree/master/RD/src/main/java/com/cw/rd/dto): DTOs · Request and response payloads for auth, tickets, chat, dashboard, services, notifications, and users. · `RD/src/main/java/com/cw/rd/dto`
- [Infra config](https://github.com/nxvxrloseee/coursework/tree/master/RD/src/main/java/com/cw/rd/config): integration config · Redis, RabbitMQ, MinIO, seeding, and storage wiring. · `RD/src/main/java/com/cw/rd/config`
- [Errors](https://github.com/nxvxrloseee/coursework/tree/master/RD/src/main/java/com/cw/rd/exception): exception handling · API exception types and global response handling. · `RD/src/main/java/com/cw/rd/exception`

### Admin web

React operator console for master workflows and live support.

- [Master UI](https://github.com/nxvxrloseee/coursework/blob/master/rd-master/src/App.tsx): React Vite app · Operator web client for administration and live support. · `rd-master/src/App.tsx`
- [Web API](https://github.com/nxvxrloseee/coursework/tree/master/rd-master/src/api): frontend clients · Typed API wrappers for backend domains. · `rd-master/src/api`
- [Web state](https://github.com/nxvxrloseee/coursework/tree/master/rd-master/src/store): stores/hooks · Auth, notification, and websocket state management. · `rd-master/src/store`
- [Web pages](https://github.com/nxvxrloseee/coursework/tree/master/rd-master/src/pages): views · Dashboard, tickets, history, notifications, services, profile, login, and detail screens. · `rd-master/src/pages`

### Customer app

Flutter self-service client for customers.

- [Flutter app](https://github.com/nxvxrloseee/coursework/blob/master/rd-customer/lib/main.dart): mobile client · Customer-facing self-service application. · `rd-customer/lib/main.dart`
- [App API](https://github.com/nxvxrloseee/coursework/tree/master/rd-customer/lib/api): client layer · Customer app HTTP clients for auth, tickets, chat, notifications, services, categories, and users. · `rd-customer/lib/api`
- [App screens](https://github.com/nxvxrloseee/coursework/tree/master/rd-customer/lib/screens): UI views · Login, register, ticket creation, ticket history/detail, notifications, profile, guest access, and tickets. · `rd-customer/lib/screens`
- [Push service](https://github.com/nxvxrloseee/coursework/blob/master/rd-customer/lib/services/push_service.dart): device notifications · Customer-side push notification integration. · `rd-customer/lib/services/push_service.dart`

### Deployment

Containerized local/runtime stack and supporting services.

- [Compose stack](https://github.com/nxvxrloseee/coursework/blob/master/RD/docker-compose.yml): docker compose · Local deployment stack for backend and support services. · `RD/docker-compose.yml`
- [Backup script](https://github.com/nxvxrloseee/coursework/blob/master/RD/backup.sh): postgres backup · Database dump and restore helper. · `RD/backup.sh`

## Connections

- RD app → Config: bootstraps · Main application loads infrastructure and feature wiring.
- RD app → REST API: serves · Application exposes REST endpoints through controllers.
- RD app → Services: uses · Business workflows are implemented in service layer.
- Config → Security: enables · Security is configured as part of application setup.
- Config → WebSocket: enables · WebSocket/STOMP messaging is configured centrally.
- Config → Infra config: wires · Messaging, cache, object storage, and seeding are initialized here.
- REST API → API models: maps · Controllers exchange typed request and response models.
- REST API → Services: delegates · HTTP handlers orchestrate through business services.
- Services → Domain model: reads/writes · Services operate on ticket, user, message, notification, and catalog entities.
- Services → Repositories: persists · Services use repositories for database access.
- Repositories → Domain model: stores · Repositories manage the JPA entity model.
- Security → REST API: guards · JWT-based auth protects request handling.
- Errors → REST API: handles · Global exception handling shapes API failures.
- REST API → WebSocket: publishes · Chat and live updates are exposed through realtime endpoints.
- Master UI → Web API: calls · React UI uses dedicated API modules.
- Master UI → Web state: uses · Web auth, notification, and websocket state live in stores and hooks.
- Master UI → Web pages: renders · Operator workflows are organized as route pages.
- Web API → REST API: consumes · Frontend API client targets backend REST controllers.
- Web state → WebSocket: subscribes · Web client listens for live chat and update events.
- Flutter app → App API: calls · Flutter UI uses client API wrappers.
- Flutter app → App screens: renders · Customer journeys are implemented as screens.
- Flutter app → Push service: receives · Mobile app integrates device push notifications.
- App API → REST API: consumes · Customer API layer talks to backend REST endpoints.
- Flutter app → WebSocket: listens · Customer chat flow can use realtime updates where available.
- Compose stack → RD app: runs · Docker compose brings up the backend service.
- Compose stack → Infra config: provisions · Compose stack includes PostgreSQL, Redis, RabbitMQ, and MinIO.
- Backup script → Compose stack: supports · Backup script complements the deployed database stack.
