# soso4ok/flowersshop-repo architecture

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

- Interactive diagram: https://gitdiagram.com/soso4ok/flowersshop-repo
- Repository: https://github.com/soso4ok/flowersshop-repo

## Overview

1. **Repository shape**
   - This is a true monorepo with three operational subsystems:
     - `src/`: Spring Boot backend API
     - `frontend/`: React + Vite single-page app
     - `infra/`: Terraform for Azure deployment
   - `docker-compose.yml` ties the backend, frontend, and PostgreSQL together for local full-stack runs.

2. **Backend core architecture**
   - The backend is a layered Spring Boot application on Java 17.
   - Request flow is generally: **REST controller → service → repository → entity/database**.
   - DTOs and mapper classes sit between API contracts and persistence models, which keeps the REST surface decoupled from JPA entities.

3. **Backend domain boundaries**
   - The main business areas are clearly separated:
     - authentication and user management
     - products/flowers/bouquets
     - orders and checkout
     - blog content
     - slides/homepage content
     - addresses and user profile
     - admin operations and dashboard stats
   - Each area has its own controller(s), service(s), repository(ies), and DTOs.

4. **Persistence model**
   - PostgreSQL is the primary datastore.
   - JPA entities are organized by domain, for example:
     - `entity/user`
     - `entity/product`
     - `entity/order`
   - Repositories encapsulate DB access, and `ProductSpecification` suggests dynamic filtering/search on product listings.

5. **Authentication and authorization**
   - Security is JWT-based.
   - `JwtAuthFilter`, `JwtService`, and `SecurityConfig` define the request authentication boundary.
   - Auth-related endpoints live under `rest/auth`, with services handling login, registration, user verification, and password recovery.
   - There is a separate admin boundary enforced in the frontend and backend, with admin-specific controllers, routes, and properties.

6. **Email and recovery flow**
   - Mail is a first-class backend integration via `MailConfig` and email service/util classes.
   - The presence of confirmation tokens, password recovery services, and mail DTOs indicates flows for:
     - email verification
     - password reset / recovery
     - transactional user notifications

7. **Frontend application structure**
   - The frontend is a React SPA built with Vite.
   - It is organized around **pages** rather than a single feature folder, with supporting reusable UI/components, filters, animations, and edge-state handling.
   - `src/api/api.js` is the main frontend boundary to the backend API.

8. **Frontend state and data flow**
   - Redux is the central client-side state layer, with slices for cart, user, orders, favorites, filters, products, blogs, builder, addresses, and admin.
   - Typical frontend flow is:
     - page/component renders
     - slice or API helper fetches backend data
     - state updates through Redux
     - UI responds with skeletons, toasts, error boundaries, or empty states

9. **User-facing functional areas**
   - The frontend exposes major user journeys for:
     - browsing flowers/bouquets
     - filtering/sorting products
     - cart and checkout
     - login/registration/verification
     - wishlist/favorites
     - orders and profile management
     - blog reading
     - a builder/customization flow
   - Admin screens are separate pages under `frontend/src/pages/Admin`, with an `AdminRoute` and `AdminLayout` boundary.

10. **Reusable UI and UX support**
   - Cross-cutting frontend utilities include:
     - protected routes
     - scroll-to-top behavior
     - page transitions and fade/stagger animations
     - skeleton/loading/error/toast components
   - This indicates the app is designed as a polished SPA where asynchronous states are handled explicitly.

11. **Deployment and runtime boundaries**
   - Local and production deployment are different concerns:
     - backend packaged with Maven and Docker
     - frontend built by Vite and served via its own Docker/nginx setup
   - `Procfile`, `Dockerfile`, and GitHub Actions workflows suggest automated build/deploy pipelines.

12. **Infrastructure layer**
   - `infra/` defines Azure infrastructure with Terraform.
   - The key platform components are:
     - App Service for hosting
     - PostgreSQL
     - Container Registry
     - Key Vault
     - VNet/networking
   - Secrets and runtime configuration are intended to be externalized into environment variables / cloud configuration.

13. **External integration points**
   - The architecture depends on a small set of external services that matter structurally:
     - PostgreSQL for persistence
     - SMTP mail server for verification/recovery
     - Azure services for production hosting and secrets
   - The frontend only talks to the backend API; it does not appear to connect directly to external services.

14. **Diagramming summary**
   - A good architecture diagram would show:
     - React SPA at the edge
     - Spring Boot API as the application backend
     - PostgreSQL as the persistent store
     - SMTP as an outbound integration from the backend
     - JWT as the auth boundary between client and server
     - Terraform/Azure as the deployment platform surrounding the runtime

Main entry points: [`infra/main.tf`](https://github.com/soso4ok/flowersshop-repo/blob/main/infra/main.tf) (Terraform), [`src/main/java/com/example/flowersproject/rest`](https://github.com/soso4ok/flowersshop-repo/tree/main/src/main/java/com/example/flowersproject/rest) (REST API), [`docker-compose.yml`](https://github.com/soso4ok/flowersshop-repo/blob/main/docker-compose.yml) (Runtime Stack), [`frontend/src/main.jsx`](https://github.com/soso4ok/flowersshop-repo/blob/main/frontend/src/main.jsx) (React SPA)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_backend["Backend"]
  node_backend_app["Spring API<br/>spring-boot app"]
  node_backend_api["REST API<br/>controllers"]
  node_backend_auth["Auth Flow<br/>security/auth"]
  node_backend_services["Services<br/>service layer"]
  node_backend_mappers["DTO Mappers<br/>mapping layer"]
  node_backend_entities[("Entities<br/>domain model")]
  node_backend_repos["Repositories<br/>persistence"]
  node_backend_security["JWT Security<br/>security boundary"]
  node_backend_mail["Mail Integration<br/>email service<br/>[MailConfig.java]"]
  node_backend_config["Config"]
  node_backend_errors["Errors<br/>exception handling"]
end

subgraph group_frontend["Frontend"]
  node_frontend_app["React SPA<br/>vite app<br/>[main.jsx]"]
  node_frontend_api["API Client<br/>frontend boundary<br/>[api.js]"]
  node_frontend_pages["Pages<br/>route views"]
  node_frontend_state["Redux Store<br/>state layer<br/>[store.js]"]
  node_frontend_ui["UI System<br/>components"]
end

subgraph group_infra["Infra"]
  node_infra_tf["Terraform<br/>infrastructure as code<br/>[main.tf]"]
  node_infra_runtime["Runtime Stack<br/>deployment<br/>[docker-compose.yml]"]
  node_infra_ci["CI/CD<br/>pipelines<br/>[ci.yml]"]
end

node_monorepo{{"Monorepo<br/>workspace"}}
node_postgres[("PostgreSQL<br/>database")]
node_smtp["SMTP<br/>external mail"]
node_azure{{"Azure<br/>cloud platform"}}

node_monorepo -->|"contains"| node_backend_app
node_monorepo -->|"contains"| node_frontend_app
node_monorepo -->|"contains"| node_infra_tf
node_backend_app -->|"exposes"| node_backend_api
node_backend_api -->|"delegates to"| node_backend_services
node_backend_auth -->|"uses"| node_backend_security
node_backend_services -->|"maps via"| node_backend_mappers
node_backend_services -->|"persists via"| node_backend_repos
node_backend_mappers -->|"translates"| node_backend_entities
node_backend_repos -->|"reads/writes"| node_backend_entities
node_backend_repos -->|"stores in"| node_postgres
node_backend_security -->|"guards"| node_backend_api
node_backend_auth -->|"sends"| node_backend_mail
node_backend_mail -->|"delivers via"| node_smtp
node_backend_config -->|"configures"| node_backend_security
node_backend_errors -->|"normalizes"| node_backend_api
node_frontend_app -->|"renders"| node_frontend_pages
node_frontend_app -->|"composes"| node_frontend_ui
node_frontend_pages -->|"reads/writes"| node_frontend_state
node_frontend_pages -->|"fetches through"| node_frontend_api
node_frontend_ui -->|"reflects"| node_frontend_state
node_frontend_api -->|"calls"| node_backend_api
node_frontend_state -->|"loads from"| node_frontend_api
node_frontend_state -->|"drives"| node_frontend_pages
node_infra_runtime -->|"runs"| node_backend_app
node_infra_runtime -->|"runs"| node_frontend_app
node_infra_runtime -->|"includes"| node_postgres
node_infra_tf -->|"provisions for"| node_azure
node_infra_tf -->|"provisions"| node_postgres
node_infra_tf -->|"hosts"| node_backend_app
node_infra_tf -->|"externalizes secrets for"| node_backend_mail
node_infra_ci -->|"builds"| node_infra_runtime
node_infra_ci -->|"deploys"| node_infra_tf

click node_backend_app "https://github.com/soso4ok/flowersshop-repo/blob/main/src/main/java/com/example/flowersproject/FlowersProjectApplication.java"
click node_backend_api "https://github.com/soso4ok/flowersshop-repo/tree/main/src/main/java/com/example/flowersproject/rest"
click node_backend_auth "https://github.com/soso4ok/flowersshop-repo/tree/main/src/main/java/com/example/flowersproject/rest/auth"
click node_backend_services "https://github.com/soso4ok/flowersshop-repo/tree/main/src/main/java/com/example/flowersproject/services"
click node_backend_mappers "https://github.com/soso4ok/flowersshop-repo/tree/main/src/main/java/com/example/flowersproject/services/mappers"
click node_backend_entities "https://github.com/soso4ok/flowersshop-repo/tree/main/src/main/java/com/example/flowersproject/entity"
click node_backend_repos "https://github.com/soso4ok/flowersshop-repo/tree/main/src/main/java/com/example/flowersproject/repository"
click node_backend_security "https://github.com/soso4ok/flowersshop-repo/tree/main/src/main/java/com/example/flowersproject/security"
click node_backend_mail "https://github.com/soso4ok/flowersshop-repo/blob/main/src/main/java/com/example/flowersproject/config/MailConfig.java"
click node_backend_config "https://github.com/soso4ok/flowersshop-repo/tree/main/src/main/java/com/example/flowersproject/config"
click node_backend_errors "https://github.com/soso4ok/flowersshop-repo/tree/main/src/main/java/com/example/flowersproject/exceptions"
click node_frontend_app "https://github.com/soso4ok/flowersshop-repo/blob/main/frontend/src/main.jsx"
click node_frontend_api "https://github.com/soso4ok/flowersshop-repo/blob/main/frontend/src/api/api.js"
click node_frontend_pages "https://github.com/soso4ok/flowersshop-repo/tree/main/frontend/src/pages"
click node_frontend_state "https://github.com/soso4ok/flowersshop-repo/blob/main/frontend/src/redux/store.js"
click node_frontend_ui "https://github.com/soso4ok/flowersshop-repo/tree/main/frontend/src/components"
click node_infra_tf "https://github.com/soso4ok/flowersshop-repo/blob/main/infra/main.tf"
click node_infra_runtime "https://github.com/soso4ok/flowersshop-repo/blob/main/docker-compose.yml"
click node_infra_ci "https://github.com/soso4ok/flowersshop-repo/blob/main/.github/workflows/ci.yml"

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_backend_app,node_backend_api,node_backend_auth,node_backend_services,node_backend_mappers,node_backend_entities,node_backend_repos,node_backend_security,node_backend_mail,node_backend_config,node_backend_errors toneBlue
class node_frontend_app,node_frontend_api,node_frontend_pages,node_frontend_state,node_frontend_ui toneAmber
class node_infra_tf,node_infra_runtime,node_infra_ci toneMint
class node_monorepo,node_postgres,node_smtp,node_azure toneNeutral
```

## Components

### Backend

Spring Boot API with layered domain services and persistence

- [Spring API](https://github.com/soso4ok/flowersshop-repo/blob/main/src/main/java/com/example/flowersproject/FlowersProjectApplication.java): spring-boot app · Java 17 backend application entrypoint and request boundary · `src/main/java/com/example/flowersproject/FlowersProjectApplication.java`
- [REST API](https://github.com/soso4ok/flowersshop-repo/tree/main/src/main/java/com/example/flowersproject/rest): controllers · HTTP endpoints for auth, users, products, orders, blogs, slides, images, and admin · `src/main/java/com/example/flowersproject/rest`
- [Auth Flow](https://github.com/soso4ok/flowersshop-repo/tree/main/src/main/java/com/example/flowersproject/rest/auth): security/auth · JWT authentication, login, registration, verification, and password recovery · `src/main/java/com/example/flowersproject/rest/auth`
- [Services](https://github.com/soso4ok/flowersshop-repo/tree/main/src/main/java/com/example/flowersproject/services): service layer · Domain orchestration, transactions, and use-case coordination · `src/main/java/com/example/flowersproject/services`
- [DTO Mappers](https://github.com/soso4ok/flowersshop-repo/tree/main/src/main/java/com/example/flowersproject/services/mappers): mapping layer · Translates between API DTOs and persistence entities · `src/main/java/com/example/flowersproject/services/mappers`
- [Entities](https://github.com/soso4ok/flowersshop-repo/tree/main/src/main/java/com/example/flowersproject/entity): domain model · JPA entities for users, products, orders, blog, slides, and tokens · `src/main/java/com/example/flowersproject/entity`
- [Repositories](https://github.com/soso4ok/flowersshop-repo/tree/main/src/main/java/com/example/flowersproject/repository): persistence · Spring Data repositories and product specifications · `src/main/java/com/example/flowersproject/repository`
- [JWT Security](https://github.com/soso4ok/flowersshop-repo/tree/main/src/main/java/com/example/flowersproject/security): security boundary · JWT filter, token service, and Spring Security configuration · `src/main/java/com/example/flowersproject/security`
- [Mail Integration](https://github.com/soso4ok/flowersshop-repo/blob/main/src/main/java/com/example/flowersproject/config/MailConfig.java): email service · SMTP-backed mail config, email service, and recovery notifications · `src/main/java/com/example/flowersproject/config/MailConfig.java`
- [Config](https://github.com/soso4ok/flowersshop-repo/tree/main/src/main/java/com/example/flowersproject/config): application config · CORS, admin properties, logout handling, and general application wiring · `src/main/java/com/example/flowersproject/config`
- [Errors](https://github.com/soso4ok/flowersshop-repo/tree/main/src/main/java/com/example/flowersproject/exceptions): exception handling · API exceptions and global error translation · `src/main/java/com/example/flowersproject/exceptions`

### Frontend

React SPA with pages, Redux state, and API boundary

- [React SPA](https://github.com/soso4ok/flowersshop-repo/blob/main/frontend/src/main.jsx): vite app · Frontend application shell and browser entrypoint · `frontend/src/main.jsx`
- [API Client](https://github.com/soso4ok/flowersshop-repo/blob/main/frontend/src/api/api.js): frontend boundary · Main client-side bridge to the backend API · `frontend/src/api/api.js`
- [Pages](https://github.com/soso4ok/flowersshop-repo/tree/main/frontend/src/pages): route views · User-facing screens for shopping, account, blog, and admin experiences · `frontend/src/pages`
- [Redux Store](https://github.com/soso4ok/flowersshop-repo/blob/main/frontend/src/redux/store.js): state layer · Central client state for cart, user, orders, products, blogs, filters, addresses, favorites, builder, and admin · `frontend/src/redux/store.js`
- [UI System](https://github.com/soso4ok/flowersshop-repo/tree/main/frontend/src/components): components · Reusable layout, filters, edge states, animations, and route guards · `frontend/src/components`

### Infra

Terraform and deployment assets for Azure and local runtime

- [Terraform](https://github.com/soso4ok/flowersshop-repo/blob/main/infra/main.tf): infrastructure as code · Azure infrastructure definition for app hosting, registry, database, secrets, and networking · `infra/main.tf`
- [Runtime Stack](https://github.com/soso4ok/flowersshop-repo/blob/main/docker-compose.yml): deployment · Compose and container runtime for local and packaged deployments · `docker-compose.yml`
- [CI/CD](https://github.com/soso4ok/flowersshop-repo/blob/main/.github/workflows/ci.yml): pipelines · GitHub Actions and deployment workflow assets · `.github/workflows/ci.yml`

### Other components

- **Monorepo**: workspace · Full-stack repository containing backend, frontend, and infrastructure
- **PostgreSQL**: database · Primary persistence store for application data
- **SMTP**: external mail · Outbound email service used for verification and recovery
- **Azure**: cloud platform · Production hosting and managed services target

## Connections

- Monorepo → Spring API: contains · Repository includes backend application
- Monorepo → React SPA: contains · Repository includes frontend application
- Monorepo → Terraform: contains · Repository includes infrastructure code
- Spring API → REST API: exposes · Application serves REST endpoints
- REST API → Services: delegates to · Controllers forward use cases to services
- Auth Flow → JWT Security: uses · Authentication endpoints rely on JWT security boundary
- Services → DTO Mappers: maps via · Services convert between DTOs and entities
- Services → Repositories: persists via · Services load and save through repositories
- DTO Mappers → Entities: translates · Mapper layer shapes persistence models
- Repositories → Entities: reads/writes · Repositories manage entity persistence
- Repositories → PostgreSQL: stores in · Primary data store is PostgreSQL
- JWT Security → REST API: guards · Security config and JWT filter protect API requests
- Auth Flow → Mail Integration: sends · Verification and recovery flows dispatch email
- Mail Integration → SMTP: delivers via · Email integration depends on SMTP server
- Config → JWT Security: configures · Application wiring includes security and CORS
- Errors → REST API: normalizes · Global exception handling shapes API failures
- React SPA → Pages: renders · SPA is organized primarily around pages
- React SPA → UI System: composes · Pages reuse shared UI and edge-state components
- Pages → Redux Store: reads/writes · Screens interact with Redux state
- Pages → API Client: fetches through · Client-side data access goes through API helper
- UI System → Redux Store: reflects · Loading, empty, error, and toast states respond to store changes
- API Client → REST API: calls · Frontend communicates only with backend API
- Redux Store → API Client: loads from · Slices fetch backend data via API helper
- Redux Store → Pages: drives · Store updates drive page rendering
- Runtime Stack → Spring API: runs · Docker and compose package the backend runtime
- Runtime Stack → React SPA: runs · Containerized frontend build serves the SPA
- Runtime Stack → PostgreSQL: includes · Local compose ties in PostgreSQL
- Terraform → Azure: provisions for · Terraform targets Azure services
- Terraform → PostgreSQL: provisions · Cloud database is defined as infrastructure
- Terraform → Spring API: hosts · App Service hosts backend runtime
- Terraform → Mail Integration: externalizes secrets for · Runtime settings and secrets are managed outside code
- CI/CD → Runtime Stack: builds · Pipelines package and publish container/runtime artifacts
- CI/CD → Terraform: deploys · Workflows support infrastructure rollout
