How soso4ok/flowersshop-repo works
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: main.tf Terraform · rest REST API · docker-compose.yml Runtime Stack · main.jsx React SPA
Components 23
Backend
Spring Boot API with layered domain services and persistence
- Spring API · Java 17 backend application entrypoint and request boundary
src/main/java/com/example/flowersproject/FlowersProjectApplication.java - REST API · HTTP endpoints for auth, users, products, orders, blogs, slides, images, and admin
src/main/java/com/example/flowersproject/rest - Auth Flow · JWT authentication, login, registration, verification, and password recovery
src/main/java/com/example/flowersproject/rest/auth - Services · Domain orchestration, transactions, and use-case coordination
src/main/java/com/example/flowersproject/services - DTO Mappers · Translates between API DTOs and persistence entities
src/main/java/com/example/flowersproject/services/mappers - Entities · JPA entities for users, products, orders, blog, slides, and tokens
src/main/java/com/example/flowersproject/entity - Repositories · Spring Data repositories and product specifications
src/main/java/com/example/flowersproject/repository - JWT Security · JWT filter, token service, and Spring Security configuration
src/main/java/com/example/flowersproject/security - Mail Integration · SMTP-backed mail config, email service, and recovery notifications
src/main/java/com/example/flowersproject/config/MailConfig.java - Config · CORS, admin properties, logout handling, and general application wiring
src/main/java/com/example/flowersproject/config - Errors · 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 · Frontend application shell and browser entrypoint
frontend/src/main.jsx - API Client · Main client-side bridge to the backend API
frontend/src/api/api.js - Pages · User-facing screens for shopping, account, blog, and admin experiences
frontend/src/pages - Redux Store · Central client state for cart, user, orders, products, blogs, filters, addresses, favorites, builder, and admin
frontend/src/redux/store.js - UI System · Reusable layout, filters, edge states, animations, and route guards
frontend/src/components
Infra
Terraform and deployment assets for Azure and local runtime
- Terraform · Azure infrastructure definition for app hosting, registry, database, secrets, and networking
infra/main.tf - Runtime Stack · Compose and container runtime for local and packaged deployments
docker-compose.yml - CI/CD · GitHub Actions and deployment workflow assets
.github/workflows/ci.yml
Other components
- Monorepo · Full-stack repository containing backend, frontend, and infrastructure
- PostgreSQL · Primary persistence store for application data
- SMTP · Outbound email service used for verification and recovery
- Azure · Production hosting and managed services target
Connections 33
- 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