# cjc0623/real_pro architecture

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

- Interactive diagram: https://gitdiagram.com/cjc0623/real_pro
- Repository: https://github.com/cjc0623/real_pro

## Overview

1. **Repository shape**
   - This is a **full-stack monorepo** with two major applications: `backend/` in **Spring Boot + Java** and `front/` in **React**.
   - The backend exposes a REST API for the frontend SPA, and the frontend is built as a client-side application with routed pages and feature-specific components.

2. **Backend layering**
   - The backend follows a classic **controller → service → repository → entity** structure.
   - Controllers are split by business domain (`member`, `cargo`, `delivery`, `payment`, `review`, `admin`, `qaboard`, etc.).
   - Services contain the business rules and orchestrate persistence, validation, and external calls.
   - Repositories provide database access, mostly through Spring Data-style persistence, with some query-specific repositories for dashboard/reporting views.
   - DTOs are used heavily to keep API contracts separate from entities.

3. **Core business domains**
   - The central domain is a **cargo transport matching platform** connecting **shippers/owners** and **drivers/carriers**.
   - Main flows include:
     - member signup/login and profile management
     - cargo registration and verification
     - estimate creation and matching/direct request handling
     - delivery lifecycle tracking
     - order and payment processing
     - review, report, and trust/score management
   - Admin functionality is a first-class domain rather than an afterthought.

4. **Authentication and authorization boundary**
   - Security is built around **JWT-based authentication** with a custom `JwtAuthenticationFilter`, `JwtService`, and token utility classes.
   - There is also **OAuth2 login/signup support** for social providers, with dedicated services and success handling.
   - Authorization is enforced through a combination of Spring Security config and a custom `@RequirePermission` annotation backed by an AOP aspect.
   - Token revocation/blacklisting is supported through dedicated persistence and service components, which matters for logout and password reset flows.

5. **External identity and communication services**
   - The backend integrates with **Google/Naver OAuth** for social login.
   - Email verification is handled as a separate service/controller boundary.
   - Payment verification integrates with an external payment provider via a dedicated verification service.
   - There is also a map/proxy layer and AI/chat-related controllers/services, indicating some requests are mediated through the backend rather than calling third-party APIs directly from the browser.

6. **Cargo, estimate, matching, and delivery flow**
   - The logistics pipeline is: **cargo registration → estimate/matching → order/payment → delivery tracking**.
   - `estimate` and `matching` packages handle the quote and acceptance logic, while `delivery` manages delivery status and owner-specific delivery views.
   - Separate controllers for owner and admin views suggest different projections over the same core delivery data.
   - `directrequest` indicates an alternate path where requests can be sent directly rather than through the standard matching flow.

7. **Payment, fees, and coupon processing**
   - Payment is a separate subsystem with its own entities, repository, controller, and service layer.
   - Fee calculation is split into basic and extra fee domains, with configurable business logic in the backend.
   - Coupons are modeled explicitly and include a scheduler, so some discount logic is time-based or periodically updated.
   - This subsystem is tightly coupled to order and delivery state, since payment completion likely gates later lifecycle steps.

8. **Member, profile, and trust features**
   - Member management includes signup/login, profile editing, password reset, and social account linkage.
   - The system also stores carrier/driver-specific profile data and trust-related DTOs such as review summaries and profile cards.
   - Profile photo uploads are supported via backend-managed upload folders and static resources.
   - Identity verification for carriers is modeled as a dedicated cargo-owner verification subsystem.

9. **Review, report, and community subsystems**
   - Reviews are a full CRUD domain with images and replies, not just a simple rating table.
   - Reports are separate from reviews and are used for user moderation and admin review.
   - Notice boards, Q&A boards, and personal inquiry flows are split into distinct modules, with admin response handling where appropriate.
   - Notification support exists as a standalone domain, suggesting asynchronous or summary-style user alerts.

10. **Admin and analytics boundary**
   - Admin pages aggregate data across members, cargo, delivery, reports, notices, fees, and sanctions.
   - Dashboard DTOs and query rows indicate **read-optimized reporting paths** separate from transactional entities.
   - Admin services are grouped by function: member management, delivery management, dashboard analytics, and sanctions.
   - This domain is important for diagramming because it crosses many other bounded contexts rather than owning one of its own.

11. **Frontend architecture**
   - The React app is organized by **pages, layouts, route groups, feature components, and API clients**.
   - `src/router` defines route boundaries, while `src/layout` contains domain-specific UI shells such as admin, mypage, order, estimate, and auth flows.
   - `src/api` mirrors backend domains with dedicated API modules, which makes the frontend a thin orchestration layer over the backend REST API.
   - State is managed with Redux slices for login/auth, plus custom hooks for auth and navigation.

12. **Frontend–backend data flow**
   - User actions in React call domain-specific API modules, which use an axios setup layer for shared headers and token handling.
   - JWT access state is persisted in a client-side token store and reused across protected routes.
   - The frontend uses route guards for authenticated pages and role-based UI for admin/member separation.
   - This makes the browser the presentation layer while the Spring backend remains the source of truth for authorization and business state.

13. **Persistence and schema model**
   - The backend stores most business objects as entities in a relational database, consistent with the repo’s MariaDB target.
   - There are separate entity packages for account/auth, cargo, delivery, estimate, fees, matching, member, payment, Q&A, review, report, and notice domains.
   - Some query-only models and row projections are used where the UI needs aggregated or dashboard-shaped data.
   - Seed SQL files in resources suggest initial board/content data is loaded on startup or during setup.

14. **Operational concerns and file handling**
   - File uploads are part of the architecture, with dedicated folders for user profiles and cargo-related assets.
   - Static resources and frontend build artifacts are present, indicating the app can serve branded assets and packaged UI output.
   - Global exception handling is centralized, so domain errors are normalized before reaching the client.
   - There is also a scheduler and data loader, implying some business processes run outside request/response traffic.

15. **What to show in an architecture diagram**
   - Draw the system as **React SPA → Spring REST API → MariaDB**, with side connections to **OAuth providers**, **email service**, **payment verification**, **AI/chat**, and **map/proxy services**.
   - Inside the backend, group the API by business domains, and show **security/auth** as a cross-cutting layer in front of all protected endpoints.
   - Highlight the main end-to-end flows: **signup/login**, **cargo/estimate/matching**, **payment/delivery**, **reviews/reports**, and **admin analytics/moderation**.

Main entry points: [`backend/src/main/java/com/giproject/BackendApplication.java`](https://github.com/cjc0623/real_pro/blob/master/backend/src/main/java/com/giproject/BackendApplication.java) (REST API), [`backend/src/main/java/com/giproject/repository`](https://github.com/cjc0623/real_pro/tree/master/backend/src/main/java/com/giproject/repository) (Persistence), [`front/src/router`](https://github.com/cjc0623/real_pro/tree/master/front/src/router) (Routes), [`backend/src/main/java/com/giproject/security`](https://github.com/cjc0623/real_pro/tree/master/backend/src/main/java/com/giproject/security) (Security)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["React SPA"]
  node_spa["React app<br/>frontend shell"]
  node_router["Routes<br/>route config"]
  node_api_clients["API clients<br/>axios modules"]
  node_auth_ui["Auth UI<br/>login flows"]
  node_business_ui["Feature UI<br/>domain pages"]
  node_admin_ui["Admin UI<br/>admin console"]
end

subgraph group_backend["Spring API"]
  node_backend_api["REST API<br/>spring boot app"]
  node_security{{"Security<br/>jwt + oauth"}}
  node_auth_domain["Auth & members<br/>identity domain"]
  node_cargo_flow["Cargo flow<br/>logistics domain"]
  node_delivery_flow["Delivery flow<br/>fulfillment domain"]
  node_order_payment["Order & payment<br/>commerce domain"]
  node_trust_comms["Trust & comms<br/>engagement domain"]
  node_admin_ops["Admin ops<br/>backoffice domain"]
  node_persistence[("Persistence<br/>jpa repositories")]
  node_scheduler_loader(("Scheduler & seed<br/>ops support"))
end

subgraph group_external["External systems"]
  node_oauth_providers(("OAuth providers<br/>google/naver"))
  node_mail_provider(("Mail service<br/>email gateway"))
  node_payment_provider(("Payment gateway<br/>verification api"))
  node_map_ai_services(("Map & AI<br/>proxied services"))
  node_database[("MariaDB<br/>relational db")]
end

node_spa -->|"navigates"| node_router
node_router -->|"public/protected"| node_auth_ui
node_router -->|"feature pages"| node_business_ui
node_router -->|"admin pages"| node_admin_ui
node_auth_ui -->|"auth calls"| node_api_clients
node_business_ui -->|"domain calls"| node_api_clients
node_admin_ui -->|"admin calls"| node_api_clients
node_api_clients -->|"REST"| node_backend_api
node_backend_api -->|"protected by"| node_security
node_security -->|"establishes identity"| node_auth_domain
node_security -->|"authorizes"| node_admin_ops
node_backend_api -->|"member APIs"| node_auth_domain
node_backend_api -->|"cargo APIs"| node_cargo_flow
node_backend_api -->|"delivery APIs"| node_delivery_flow
node_backend_api -->|"order/payment APIs"| node_order_payment
node_backend_api -->|"community APIs"| node_trust_comms
node_backend_api -->|"admin APIs"| node_admin_ops
node_auth_domain -->|"stores"| node_persistence
node_cargo_flow -->|"stores"| node_persistence
node_delivery_flow -->|"stores"| node_persistence
node_order_payment -->|"stores"| node_persistence
node_trust_comms -->|"stores"| node_persistence
node_admin_ops -->|"reads/writes"| node_persistence
node_scheduler_loader -->|"seed/update"| node_persistence
node_security -->|"oauth2 login"| node_oauth_providers
node_trust_comms -->|"verify email"| node_mail_provider
node_order_payment -->|"verify payment"| node_payment_provider
node_trust_comms -->|"proxy calls"| node_map_ai_services
node_persistence -->|"MariaDB"| node_database

click node_spa "https://github.com/cjc0623/real_pro/tree/master/front/src"
click node_router "https://github.com/cjc0623/real_pro/tree/master/front/src/router"
click node_api_clients "https://github.com/cjc0623/real_pro/tree/master/front/src/api"
click node_auth_ui "https://github.com/cjc0623/real_pro/tree/master/front/src/layout/component/users"
click node_business_ui "https://github.com/cjc0623/real_pro/tree/master/front/src/layout/component"
click node_admin_ui "https://github.com/cjc0623/real_pro/tree/master/front/src/layout/component/admin"
click node_backend_api "https://github.com/cjc0623/real_pro/blob/master/backend/src/main/java/com/giproject/BackendApplication.java"
click node_security "https://github.com/cjc0623/real_pro/tree/master/backend/src/main/java/com/giproject/security"
click node_auth_domain "https://github.com/cjc0623/real_pro/tree/master/backend/src/main/java/com/giproject/service/auth"
click node_cargo_flow "https://github.com/cjc0623/real_pro/tree/master/backend/src/main/java/com/giproject/service/estimate"
click node_delivery_flow "https://github.com/cjc0623/real_pro/tree/master/backend/src/main/java/com/giproject/service/delivery"
click node_order_payment "https://github.com/cjc0623/real_pro/tree/master/backend/src/main/java/com/giproject/service/payment"
click node_trust_comms "https://github.com/cjc0623/real_pro/tree/master/backend/src/main/java/com/giproject/service/review"
click node_admin_ops "https://github.com/cjc0623/real_pro/tree/master/backend/src/main/java/com/giproject/service/admin"
click node_persistence "https://github.com/cjc0623/real_pro/tree/master/backend/src/main/java/com/giproject/repository"
click node_scheduler_loader "https://github.com/cjc0623/real_pro/tree/master/backend/src/main/java/com/giproject/config"

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_spa,node_router,node_api_clients,node_auth_ui,node_business_ui,node_admin_ui toneBlue
class node_backend_api,node_security,node_auth_domain,node_cargo_flow,node_delivery_flow,node_order_payment,node_trust_comms,node_admin_ops,node_persistence,node_scheduler_loader toneAmber
class node_oauth_providers,node_mail_provider,node_payment_provider,node_map_ai_services,node_database toneMint
```

## Components

### React SPA

Client-side presentation layer and route-driven feature UI.

- [React app](https://github.com/cjc0623/real_pro/tree/master/front/src): frontend shell · Route-based SPA that renders pages, layouts, and feature components. · `front/src`
- [Routes](https://github.com/cjc0623/real_pro/tree/master/front/src/router): route config · Defines public, protected, admin, and feature route boundaries. · `front/src/router`
- [API clients](https://github.com/cjc0623/real_pro/tree/master/front/src/api): axios modules · Domain-specific REST clients wrapping shared axios/token handling. · `front/src/api`
- [Auth UI](https://github.com/cjc0623/real_pro/tree/master/front/src/layout/component/users): login flows · Login, signup, OAuth callback, password reset, and route guards. · `front/src/layout/component/users`
- [Feature UI](https://github.com/cjc0623/real_pro/tree/master/front/src/layout/component): domain pages · Order, estimate, delivery, review, Q&A, notification, and mypage components. · `front/src/layout/component`
- [Admin UI](https://github.com/cjc0623/real_pro/tree/master/front/src/layout/component/admin): admin console · Admin pages for members, cargo approval, delivery, fees, reports, and notices. · `front/src/layout/component/admin`

### Spring API

REST backend with business domains, security, persistence, and integrations.

- [REST API](https://github.com/cjc0623/real_pro/blob/master/backend/src/main/java/com/giproject/BackendApplication.java): spring boot app · Main application entry and HTTP API surface. · `backend/src/main/java/com/giproject/BackendApplication.java`
- [Security](https://github.com/cjc0623/real_pro/tree/master/backend/src/main/java/com/giproject/security): jwt + oauth · JWT filter/service, OAuth2 success handling, permission aspect, and token blacklist. · `backend/src/main/java/com/giproject/security`
- [Auth & members](https://github.com/cjc0623/real_pro/tree/master/backend/src/main/java/com/giproject/service/auth): identity domain · Signup, login, password reset, social auth, member profile, and coupon linkage. · `backend/src/main/java/com/giproject/service/auth`
- [Cargo flow](https://github.com/cjc0623/real_pro/tree/master/backend/src/main/java/com/giproject/service/estimate): logistics domain · Cargo registration, owner verification, estimates, matching, and direct requests. · `backend/src/main/java/com/giproject/service/estimate`
- [Delivery flow](https://github.com/cjc0623/real_pro/tree/master/backend/src/main/java/com/giproject/service/delivery): fulfillment domain · Delivery lifecycle, owner delivery views, and delivery state projections. · `backend/src/main/java/com/giproject/service/delivery`
- [Order & payment](https://github.com/cjc0623/real_pro/tree/master/backend/src/main/java/com/giproject/service/payment): commerce domain · Order sheets, payment completion, fee calculation, coupon usage, and provider verification. · `backend/src/main/java/com/giproject/service/payment`
- [Trust & comms](https://github.com/cjc0623/real_pro/tree/master/backend/src/main/java/com/giproject/service/review): engagement domain · Reviews, reports, notices, Q&A, notifications, email verification, and AI/chat/map mediation. · `backend/src/main/java/com/giproject/service/review`
- [Admin ops](https://github.com/cjc0623/real_pro/tree/master/backend/src/main/java/com/giproject/service/admin): backoffice domain · Dashboard analytics, member moderation, delivery oversight, sanctions, and reporting views. · `backend/src/main/java/com/giproject/service/admin`
- [Persistence](https://github.com/cjc0623/real_pro/tree/master/backend/src/main/java/com/giproject/repository): jpa repositories · Entity and repository layer for MariaDB-backed domain state and query projections. · `backend/src/main/java/com/giproject/repository`
- [Scheduler & seed](https://github.com/cjc0623/real_pro/tree/master/backend/src/main/java/com/giproject/config): ops support · Coupon scheduler, data loader, and startup seed content. · `backend/src/main/java/com/giproject/config`

### External systems

Third-party providers and outbound service boundaries.

- **OAuth providers**: google/naver · External social identity providers used for login and signup.
- **Mail service**: email gateway · Outbound email verification and account communication channel.
- **Payment gateway**: verification api · External payment verification service used during payment completion.
- **Map & AI**: proxied services · Map proxy and AI/chat-related external request targets mediated by the backend.
- **MariaDB**: relational db · Primary relational store for members, cargo, delivery, payment, reviews, and admin projections.

## Connections

- React app → Routes: navigates · Application pages are selected through route definitions.
- Routes → Auth UI: public/protected · Routes split into authentication and account flows.
- Routes → Feature UI: feature pages · Routes mount logistics, order, review, Q&A, and profile screens.
- Routes → Admin UI: admin pages · Routes expose backoffice views for privileged users.
- Auth UI → API clients: auth calls · Login, signup, reset, and social callback screens call backend APIs.
- Feature UI → API clients: domain calls · Feature components invoke domain REST clients.
- Admin UI → API clients: admin calls · Admin screens consume reporting and moderation APIs.
- API clients → REST API: REST · Frontend clients send requests to the Spring backend.
- REST API → Security: protected by · Most endpoints are guarded by JWT, OAuth2, and permission checks.
- Security → Auth & members: establishes identity · Security components authenticate and authorize member sessions.
- Security → Admin ops: authorizes · Admin and role-based permissions are enforced before backoffice access.
- REST API → Auth & members: member APIs · Authentication, profile, password reset, social signup, and coupons.
- REST API → Cargo flow: cargo APIs · Cargo registration, verification, estimate, matching, and direct request endpoints.
- REST API → Delivery flow: delivery APIs · Delivery lifecycle and owner-specific delivery views.
- REST API → Order & payment: order/payment APIs · Order sheet creation, payment processing, fee logic, and coupon application.
- REST API → Trust & comms: community APIs · Reviews, reports, notices, Q&A, notifications, email, AI, and map proxy.
- REST API → Admin ops: admin APIs · Admin controllers aggregate members, cargo, delivery, sanctions, and dashboards.
- Auth & members → Persistence: stores · Member, social account, revoked token, and coupon state persists in repositories.
- Cargo flow → Persistence: stores · Cargo, estimate, matching, and verification data are persisted.
- Delivery flow → Persistence: stores · Delivery entities and owner query rows are persisted and read back.
- Order & payment → Persistence: stores · Orders, payments, fees, and coupons use repository-backed state.
- Trust & comms → Persistence: stores · Reviews, reports, boards, notifications, and chat messages persist through repositories.
- Admin ops → Persistence: reads/writes · Admin workflows use transactional entities and dashboard projections.
- Scheduler & seed → Persistence: seed/update · Scheduled coupon work and startup loading touch persisted data.
- Security → OAuth providers: oauth2 login · Social authentication is delegated to Google and Naver.
- Trust & comms → Mail service: verify email · Email verification sends outbound mail through a dedicated service.
- Order & payment → Payment gateway: verify payment · Payment completion is confirmed against an external provider.
- Trust & comms → Map & AI: proxy calls · Map and AI/chat interactions are mediated through backend services.
- Persistence → MariaDB: MariaDB · Repository layer stores the domain model in the relational database.
