# ha-seungjun/pro_2 architecture

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

- Interactive diagram: https://gitdiagram.com/ha-seungjun/pro_2
- Repository: https://github.com/ha-seungjun/pro_2

## Overview

1. **Repository shape**
   - This is a two-app monorepo: `backend/` is a Spring Boot REST API, and `front/` is a React single-page application.
   - The product is a freight brokerage platform connecting shippers and carriers, with separate experiences for user roles like shipper, carrier, and admin.

2. **Top-level runtime boundaries**
   - The frontend is a browser client that renders pages, manages local auth state, and calls backend APIs through a centralized Axios layer.
   - The backend owns all business rules, persistence, authentication, authorization, and role-specific workflows.
   - The system is organized around HTTP request/response flows; there is no evidence of a separate message broker or microservice split.

3. **Frontend architecture**
   - `src/router` defines page-level route groups such as auth, estimate, order, mypage, admin, and service center.
   - `src/layout/component` contains most feature UIs, while `src/common` and `src/components` hold shared navigation, headers, footers, and reusable sections.
   - `src/api` is the main integration boundary to the backend, with one API module per domain area.
   - `src/store`, `src/slice`, and hooks like `useCustomLogin` indicate client-side auth/session state management, likely centered on JWT handling.

4. **Backend entry and cross-cutting concerns**
   - `BackendApplication` is the Spring Boot entrypoint.
   - Cross-cutting concerns are centralized in `config`, `security`, `aop`, and `common`.
   - `SecurityConfig`, `JwtAuthenticationFilter`, `JwtService`, and OAuth-related classes define authentication flows.
   - `RequirePermission` and `PermissionAspect` enforce method- or controller-level authorization beyond standard Spring Security checks.
   - Global error handling is split between `GlobalExceptionHandler`, `AppGlobalExceptionHandler`, and `ApiExceptionHandler`, with a shared `ErrorResponse` model.

5. **Backend layering**
   - The backend follows a classic controller/service/repository structure.
   - Controllers map HTTP endpoints for each domain.
   - Services contain business logic and orchestration.
   - Repositories encapsulate persistence queries against MariaDB via Spring Data/JPA-style access.
   - DTOs are used heavily between controller and service layers, keeping entities internal to the backend.

6. **Core domain subsystems**
   - **Auth and account management**: login, signup, password reset, social login, token auth, and user info endpoints.
   - **Cargo / estimate / matching**: shipper cargo registration, freight estimation, carrier acceptance validation, and matching state.
   - **Delivery**: delivery status and owner-facing delivery views.
   - **Order / payment**: order sheets, order completion, payment records, and settlement-related flows.
   - **Review / report / Q&A / notice**: post-delivery reviews, user reports, Q&A boards, and notice boards.
   - **Admin**: dashboard metrics, member management, cargo approval, delivery oversight, and sanctions.

7. **Primary business flow**
   - The main lifecycle appears to be: user signup/login → shipper registers cargo or quotation request → system computes estimate/fees and applies coupon or distance discounts → carrier reviews and accepts matching → delivery progresses through status states → payment completes → review/reporting becomes available.
   - This lifecycle is split across dedicated controllers and services rather than one large workflow service.

8. **Role- and permission-based access**
   - The README emphasizes shipper, carrier, and admin views, and the code reflects that with separate controller groups and frontend routers for admin and mypage.
   - Permission checking is not purely route-based; backend aspect-oriented authorization suggests business actions are guarded centrally.
   - The frontend also has auth guards such as `RequireAuth`, and admin-specific UI containers like `AdminLayout` and `AdminSidebar`.

9. **External integrations and infrastructure**
   - **OAuth providers**: Google, Naver, and Kakao are integrated for social login, with callback pages in the frontend and OAuth service/config classes in the backend.
   - **Email**: there is a dedicated email verification controller/service for account verification and likely password reset support.
   - **Cloudinary**: backend config and service classes indicate image upload/storage integration, used especially for user profiles or related media.
   - **Local file storage**: the repo also includes upload directories under `backend/uploads` and top-level `uploads`, suggesting some assets are stored on disk as well.

10. **Data model and persistence**
   - Entities are organized by domain package: member, cargo, delivery, estimate, matching, order, payment, review, report, qaboard, noboard, and oauth.
   - The database appears to be MariaDB from the README, with repositories such as `AdminDashboardRepository`, `PaymentRepository`, `ReviewRepository`, and `QAPostRepository`.
   - Several projection/row-style repository classes and DTOs indicate custom query views for dashboards and analytics.

11. **Analytics, dashboards, and scheduled jobs**
   - Dashboard features are first-class: admin metrics, owner metrics, and likely shipper/carrier summaries are surfaced through dedicated service/controller pairs.
   - `CouponScheduler` indicates background scheduling for coupon lifecycle or periodic cleanup/updates.
   - Dashboard repositories and monthly DTOs suggest aggregate queries over orders, deliveries, revenue, and member growth.

12. **Frontend/backend API contract**
   - The frontend is structured around domain-specific API modules that mirror backend controllers, making the API boundary explicit and stable.
   - This symmetry is strongest in domains like admin, delivery, estimate, payment, qna, review, and user info.
   - The result is a coarse-grained REST integration model: UI components call feature APIs, APIs map to Spring controllers, and services perform the actual business operations.

13. **Static assets and UI delivery**
   - The backend includes `resources/static` and SQL seed files, but the deployed UI is primarily the React build in `front/build`.
   - The frontend build output shows the app is shipped as static assets, which can be hosted independently from the API server.
   - The backend likely serves only API responses and possibly uploaded/public assets, not the main SPA in production.

14. **What to draw in an architecture diagram**
   - Show a browser-based React SPA on the left, a Spring Boot API on the right, and MariaDB plus file/image storage beneath the backend.
   - Add external identity providers for social login, email service for verification/reset, and Cloudinary or file storage for profile/media uploads.
   - Group backend domains into auth/account, freight/matching, delivery/order/payment, review/report/Q&A/notice, and admin/analytics.
   - Indicate cross-cutting security via JWT filter + Spring Security + permission aspect, and separate frontend route guards and token storage.

Main entry points: [`backend/src/main/java/com/giproject/service`](https://github.com/ha-seungjun/pro_2/tree/main/backend/src/main/java/com/giproject/service) (Domain Services), [`front/src`](https://github.com/ha-seungjun/pro_2/tree/main/front/src) (Browser App), [`backend/src/main/java/com/giproject/security`](https://github.com/ha-seungjun/pro_2/tree/main/backend/src/main/java/com/giproject/security) (Security Core), [`backend/src/main/java/com/giproject/controller`](https://github.com/ha-seungjun/pro_2/tree/main/backend/src/main/java/com/giproject/controller) (Auth & Account)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend SPA"]
  node_browser["Browser App<br/>react spa"]
  node_router["Route Map<br/>page router"]
  node_ui_shell["UI Shell<br/>shared layout"]
  node_api_client["API Layer<br/>axios clients"]
  node_auth_state["Auth State<br/>client auth"]
end

subgraph group_backend["Backend API"]
  node_entry(("Boot App<br/>spring boot"))
  node_security["Security Core<br/>jwt/security"]
  node_crosscutting["Cross-Cutting<br/>config/error"]
  node_auth_account["Auth & Account<br/>auth/member"]
  node_freight["Freight Flow<br/>cargo/estimate/matching"]
  node_delivery_order["Ops Flow<br/>delivery/order/payment"]
  node_community["Community<br/>review/qna/notice/report"]
  node_admin["Admin Ops<br/>admin/analytics"]
  node_services["Domain Services<br/>business logic"]
  node_repos[("Repositories<br/>persistence")]
  node_models["Domain Models<br/>entities/dtos"]
end

subgraph group_external["External Systems"]
  node_db[("MariaDB<br/>database")]
  node_oauth(("OAuth Providers<br/>google/naver/kakao"))
  node_email(("Email Service<br/>verification mail"))
  node_storage[("File Storage<br/>uploads/cloudinary")]
end

node_browser -->|"navigates"| node_router
node_browser -->|"composes"| node_ui_shell
node_browser -->|"calls"| node_api_client
node_browser -->|"stores session"| node_auth_state
node_router -->|"mounts"| node_ui_shell
node_auth_state -->|"attaches token"| node_api_client
node_entry -->|"boots with"| node_security
node_entry -->|"loads"| node_crosscutting
node_security -->|"protects"| node_auth_account
node_security -->|"delegates social auth"| node_oauth
node_security -.->|"authorizes uploads"| node_storage
node_auth_account -->|"orchestrates"| node_services
node_freight -->|"orchestrates"| node_services
node_delivery_order -->|"orchestrates"| node_services
node_community -->|"orchestrates"| node_services
node_admin -->|"orchestrates"| node_services
node_services -->|"queries"| node_repos
node_repos -->|"stores"| node_db
node_services -->|"maps data"| node_models
node_models -.->|"backed by"| node_repos
node_auth_account -->|"verifies"| node_email
node_auth_account -->|"social login"| node_oauth
node_freight -->|"uploads media"| node_storage
node_admin -.->|"reads metrics"| node_db

click node_browser "https://github.com/ha-seungjun/pro_2/tree/main/front/src"
click node_router "https://github.com/ha-seungjun/pro_2/tree/main/front/src/router"
click node_ui_shell "https://github.com/ha-seungjun/pro_2/tree/main/front/src/layout/component"
click node_api_client "https://github.com/ha-seungjun/pro_2/tree/main/front/src/api"
click node_auth_state "https://github.com/ha-seungjun/pro_2/tree/main/front/src/store"
click node_entry "https://github.com/ha-seungjun/pro_2/blob/main/backend/src/main/java/com/giproject/BackendApplication.java"
click node_security "https://github.com/ha-seungjun/pro_2/tree/main/backend/src/main/java/com/giproject/security"
click node_crosscutting "https://github.com/ha-seungjun/pro_2/tree/main/backend/src/main/java/com/giproject/config"
click node_auth_account "https://github.com/ha-seungjun/pro_2/tree/main/backend/src/main/java/com/giproject/controller"
click node_freight "https://github.com/ha-seungjun/pro_2/tree/main/backend/src/main/java/com/giproject/controller"
click node_delivery_order "https://github.com/ha-seungjun/pro_2/tree/main/backend/src/main/java/com/giproject/controller"
click node_community "https://github.com/ha-seungjun/pro_2/tree/main/backend/src/main/java/com/giproject/controller"
click node_admin "https://github.com/ha-seungjun/pro_2/tree/main/backend/src/main/java/com/giproject/controller/admin"
click node_services "https://github.com/ha-seungjun/pro_2/tree/main/backend/src/main/java/com/giproject/service"
click node_repos "https://github.com/ha-seungjun/pro_2/tree/main/backend/src/main/java/com/giproject/repository"
click node_models "https://github.com/ha-seungjun/pro_2/tree/main/backend/src/main/java/com/giproject/entity"

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_browser,node_router,node_ui_shell,node_api_client,node_auth_state toneBlue
class node_entry,node_security,node_crosscutting,node_auth_account,node_freight,node_delivery_order,node_community,node_admin,node_services,node_repos,node_models toneAmber
class node_db,node_oauth,node_email,node_storage toneMint
```

## Components

### Frontend SPA

React client-side application and its feature composition.

- [Browser App](https://github.com/ha-seungjun/pro_2/tree/main/front/src): react spa · Client-side freight brokerage UI rendered in the browser. · `front/src`
- [Route Map](https://github.com/ha-seungjun/pro_2/tree/main/front/src/router): page router · Page-level route groups for auth, estimate, order, mypage, admin, and service center. · `front/src/router`
- [UI Shell](https://github.com/ha-seungjun/pro_2/tree/main/front/src/layout/component): shared layout · Shared headers, nav, layouts, and reusable feature components. · `front/src/layout/component`
- [API Layer](https://github.com/ha-seungjun/pro_2/tree/main/front/src/api): axios clients · Centralized domain API modules that call the backend. · `front/src/api`
- [Auth State](https://github.com/ha-seungjun/pro_2/tree/main/front/src/store): client auth · Local login/session state, token storage, and route guards. · `front/src/store`

### Backend API

Spring Boot REST API, business logic, and persistence.

- [Boot App](https://github.com/ha-seungjun/pro_2/blob/main/backend/src/main/java/com/giproject/BackendApplication.java): spring boot · Backend application entrypoint and startup wiring. · `backend/src/main/java/com/giproject/BackendApplication.java`
- [Security Core](https://github.com/ha-seungjun/pro_2/tree/main/backend/src/main/java/com/giproject/security): jwt/security · Spring Security, JWT filters/services, OAuth success handling, and permission aspect enforcement. · `backend/src/main/java/com/giproject/security`
- [Cross-Cutting](https://github.com/ha-seungjun/pro_2/tree/main/backend/src/main/java/com/giproject/config): config/error · CORS, OAuth clients, Cloudinary, exception handling, and shared app configuration. · `backend/src/main/java/com/giproject/config`
- [Auth & Account](https://github.com/ha-seungjun/pro_2/tree/main/backend/src/main/java/com/giproject/controller): auth/member · Login, signup, password reset, social auth, email verification, and user info. · `backend/src/main/java/com/giproject/controller`
- [Freight Flow](https://github.com/ha-seungjun/pro_2/tree/main/backend/src/main/java/com/giproject/controller): cargo/estimate/matching · Cargo registration, estimate calculation, fees, verification, and matching workflow. · `backend/src/main/java/com/giproject/controller`
- [Ops Flow](https://github.com/ha-seungjun/pro_2/tree/main/backend/src/main/java/com/giproject/controller): delivery/order/payment · Delivery status, order sheets, payment completion, and owner-facing views. · `backend/src/main/java/com/giproject/controller`
- [Community](https://github.com/ha-seungjun/pro_2/tree/main/backend/src/main/java/com/giproject/controller): review/qna/notice/report · Reviews, reports, Q&A boards, and notice board content. · `backend/src/main/java/com/giproject/controller`
- [Admin Ops](https://github.com/ha-seungjun/pro_2/tree/main/backend/src/main/java/com/giproject/controller/admin): admin/analytics · Admin dashboards, member controls, cargo approval, delivery oversight, sanctions, and metrics. · `backend/src/main/java/com/giproject/controller/admin`
- [Domain Services](https://github.com/ha-seungjun/pro_2/tree/main/backend/src/main/java/com/giproject/service): business logic · Orchestration layer implementing business rules across domains. · `backend/src/main/java/com/giproject/service`
- [Repositories](https://github.com/ha-seungjun/pro_2/tree/main/backend/src/main/java/com/giproject/repository): persistence · Spring Data/JPA repositories and custom query projections against MariaDB. · `backend/src/main/java/com/giproject/repository`
- [Domain Models](https://github.com/ha-seungjun/pro_2/tree/main/backend/src/main/java/com/giproject/entity): entities/dtos · Entities and DTOs for members, cargo, delivery, orders, payment, reviews, and boards. · `backend/src/main/java/com/giproject/entity`

### External Systems

Outside services and storage used by the platform.

- **MariaDB**: database · Primary relational datastore for the platform.
- **OAuth Providers**: google/naver/kakao · External identity providers for social login.
- **Email Service**: verification mail · Email verification and reset-related outbound mail delivery.
- **File Storage**: uploads/cloudinary · Cloudinary and local upload storage for profile and media assets.

## Connections

- Browser App → Route Map: navigates · The SPA renders page flows through route groups.
- Browser App → UI Shell: composes · Pages are assembled from shared shells and reusable components.
- Browser App → API Layer: calls · Feature UI talks to backend through centralized API modules.
- Browser App → Auth State: stores session · Client maintains login state and JWT-related guards.
- Route Map → UI Shell: mounts · Route groups load the relevant page layouts and feature containers.
- Auth State → API Layer: attaches token · Authenticated requests use stored token and auth helpers.
- Boot App → Security Core: boots with · Application startup wires security and auth infrastructure.
- Boot App → Cross-Cutting: loads · Bootstraps config, CORS, OAuth clients, and error handling.
- Security Core → Auth & Account: protects · JWT and permission checks guard account endpoints and workflows.
- Security Core → OAuth Providers: delegates social auth · OAuth login flows rely on external providers.
- Security Core → File Storage: authorizes uploads · Media/profile flows are secured alongside storage integration.
- Auth & Account → Domain Services: orchestrates · Controllers delegate auth and account business logic to services.
- Freight Flow → Domain Services: orchestrates · Cargo, estimate, fees, verification, and matching are handled in services.
- Ops Flow → Domain Services: orchestrates · Delivery, order, and payment controllers call service layer workflows.
- Community → Domain Services: orchestrates · Boards and moderation features are implemented via services.
- Admin Ops → Domain Services: orchestrates · Admin metrics and operations are service-driven.
- Domain Services → Repositories: queries · Services persist and read via repositories.
- Repositories → MariaDB: stores · Repositories access the MariaDB-backed persistence layer.
- Domain Services → Domain Models: maps data · Business logic exchanges entities and DTOs across layers.
- Domain Models → Repositories: backed by · Entities and projections shape repository access patterns.
- Auth & Account → Email Service: verifies · Email verification and password reset use outbound mail.
- Auth & Account → OAuth Providers: social login · Social signup/login integrates Google, Naver, and Kakao.
- Freight Flow → File Storage: uploads media · Cargo or user-related images can flow to Cloudinary/local storage.
- Admin Ops → MariaDB: reads metrics · Dashboard and moderation views aggregate stored operational data.
