# twilight2368/pet-care-system-software architecture

> Architecture diagram of the GitHub repository twilight2368/pet-care-system-software, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/twilight2368/pet-care-system-software
- Repository: https://github.com/twilight2368/pet-care-system-software

## Overview

##### Project type and purpose
- This is a full-stack web application (“Pet Care Center Management System”) with a React-based frontend and a Spring Boot RESTful backend.
- It provides pet profile management, appointment booking, grooming, boarding services, notifications, and role-based access for owners, staff, vets, and admins.

##### File structure
- Top-level directories:
- frontend/client (React + Vite + Redux + Tailwind)
- backend/PawPalServer (Spring Boot, Maven, JPA/Hibernate)
- documents/REQUIREMENT.md
- Frontend details:
- src/app/store (Redux slices)
- src/apis/api.js (API client)
- src/pages/... & src/components/... (UI views and reusable components)
- Backend details:
- src/main/java/.../controllers (REST controllers)
- services/interfaces & services/implement (business logic)
- repositories (JPA repositories)
- domains/entities & domains/dtos (data models)
- configs (security, web, mapping, OpenAPI)
- filters (JWT auth, request logging)
- jobs (scheduled tasks)
- utils (JWT, encryption helpers)
- application.yml/properties (DB, server, mail, etc.)

##### Extract architecture insights from README
- Layered architecture following MVC / service-repository pattern
- Uses JWT for stateless auth, scheduled jobs for reminders
- Exposes REST endpoints for CRUD on pets, appointments, grooming, boarding, diet, medical records, notifications
- React SPA consumes these endpoints, manages global state via Redux

a. Main components
- Client (React SPA)
- API Gateway / Web Server (serving the SPA and forwarding API calls)
- Backend (Spring Boot application)
- Relational Database (e.g., MySQL/PostgreSQL or H2 for dev)
- External services:
- Email/SMS service for notifications
- Possibly cloud storage for pet photos
b. Relationships & data flows
- User → Browser → React SPA
- SPA → HTTP/HTTPS → Spring Boot Controllers
- Controllers → Services → Repositories → Database
- Services → Utils (JWT generation/validation) & Filters (auth)
- Scheduled Job → Services → Database & Notification service
- DB → Entities ↔ DTOs ↔ REST responses
c. Architectural patterns & principles
- Layered separation: Presentation (React), API (Controllers), Business (Services), Data (Repositories)
- Stateless authentication with JWT
- DTO mapping via MapperConfig and custom mappers
- Configuration classes centralize CORS, security, and OpenAPI docs
- Scheduled tasks handle periodic notifications
d. Key technologies/frameworks
- Frontend: React, Vite, Redux Toolkit, Tailwind CSS
- Backend: Spring Boot, Spring Security (JWT), Spring Data JPA, Maven
- Database: Relational (configured in application.yml)
- Build/Deployment: Maven wrapper, Vite, environment files (.env, .example.env)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Frontend Layer
    subgraph "Frontend"
        direction TB
        HTML["HTML Template"]:::frontend
        React["React SPA"]:::frontend
        Store["Redux Store"]:::frontend
        UserSlice["UserSlice"]:::frontend
        APIClient["API Client Module"]:::frontend
        Pages["UI Pages"]:::frontend
        Components["Reusable Components"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend"
        direction TB
        App["PawPalServerApplication"]:::backend
        Filters["JWT & Logging Filters"]:::backend
        Controllers["REST Controllers"]:::backend
        
        subgraph "Business Layer"
            direction TB
            Interfaces["Service Interfaces"]:::backend
            Impl["Service Implementations"]:::backend
            MappersInt["Mapper Interfaces"]:::backend
            MappersImpl["Mapper Implementations"]:::backend
        end
        
        subgraph "Data Layer"
            direction TB
            Repos["JPA Repositories"]:::backend
            Entities["Domain Entities"]:::backend
            DTOs["DTOs"]:::backend
        end
        
        Cross["Configuration Classes"]:::backend
        SecurityComp["Security Components"]:::backend
        Utils["Utility Classes"]:::backend
        Jobs["Scheduled Job"]:::backend
        AppConfig["Application Config"]:::backend
    end

    %% External Services and Database
    Database[(Database)]:::db
    Notification["Email/SMS Service"]:::external
    Storage["Cloud Storage"]:::external

    %% Connections - Frontend
    HTML --> React
    React --> Store
    Store --> UserSlice
    React --> APIClient
    React --> Pages
    React --> Components
    React --> Controllers

    %% Connections - Backend
    App --> Filters
    Filters --> Controllers
    Controllers --> Interfaces
    Interfaces --> Impl
    Impl --> Repos
    Repos --> Database
    Interfaces --> MappersInt
    MappersInt --> MappersImpl
    MappersImpl --> DTOs
    DTOs --> Entities
    Entities --> Repos

    %% Cross-cutting Concerns
    Cross --> Controllers
    Cross --> Filters
    Cross --> Interfaces
    Cross --> Impl
    SecurityComp --> Filters
    Utils --> Impl
    Jobs --> Impl
    Jobs --> Notification
    AppConfig --> App
    AppConfig --> Filters
    AppConfig --> Controllers

    %% External Connections
    Impl --> Notification
    Impl --> Storage

    %% Click Events - Frontend
    click React "https://github.com/twilight2368/pet-care-system-software/blob/main/frontend/client/src/main.jsx"
    click HTML "https://github.com/twilight2368/pet-care-system-software/blob/main/frontend/client/index.html"
    click Store "https://github.com/twilight2368/pet-care-system-software/blob/main/frontend/client/src/app/store.js"
    click UserSlice "https://github.com/twilight2368/pet-care-system-software/blob/main/frontend/client/src/app/store/UserSlice.js"
    click APIClient "https://github.com/twilight2368/pet-care-system-software/blob/main/frontend/client/src/apis/api.js"
    click Pages "https://github.com/twilight2368/pet-care-system-software/tree/main/frontend/client/src/pages"
    click Components "https://github.com/twilight2368/pet-care-system-software/tree/main/frontend/client/src/components"

    %% Click Events - Backend
    click App "https://github.com/twilight2368/pet-care-system-software/blob/main/backend/PawPalServer/src/main/java/com/example/PawPalServer/PawPalServerApplication.java"
    click Controllers "https://github.com/twilight2368/pet-care-system-software/tree/main/backend/PawPalServer/src/main/java/com/example/PawPalServer/controllers"
    click Filters "https://github.com/twilight2368/pet-care-system-software/tree/main/backend/PawPalServer/src/main/java/com/example/PawPalServer/filters"
    click Interfaces "https://github.com/twilight2368/pet-care-system-software/tree/main/backend/PawPalServer/src/main/java/com/example/PawPalServer/services/interfaces"
    click Impl "https://github.com/twilight2368/pet-care-system-software/tree/main/backend/PawPalServer/src/main/java/com/example/PawPalServer/services/implement"
    click Repos "https://github.com/twilight2368/pet-care-system-software/tree/main/backend/PawPalServer/src/main/java/com/example/PawPalServer/repositories"
    click Entities "https://github.com/twilight2368/pet-care-system-software/tree/main/backend/PawPalServer/src/main/java/com/example/PawPalServer/domains/entities"
    click DTOs "https://github.com/twilight2368/pet-care-system-software/tree/main/backend/PawPalServer/src/main/java/com/example/PawPalServer/domains/dtos"
    click Cross "https://github.com/twilight2368/pet-care-system-software/tree/main/backend/PawPalServer/src/main/java/com/example/PawPalServer/configs"
    click SecurityComp "https://github.com/twilight2368/pet-care-system-software/tree/main/backend/PawPalServer/src/main/java/com/example/PawPalServer/security"
    click Utils "https://github.com/twilight2368/pet-care-system-software/tree/main/backend/PawPalServer/src/main/java/com/example/PawPalServer/utils"
    click Jobs "https://github.com/twilight2368/pet-care-system-software/blob/main/backend/PawPalServer/src/main/java/com/example/PawPalServer/jobs/CheckSurviceScheduleJob.java"
    click MappersInt "https://github.com/twilight2368/pet-care-system-software/tree/main/backend/PawPalServer/src/main/java/com/example/PawPalServer/mappers/interfaces"
    click MappersImpl "https://github.com/twilight2368/pet-care-system-software/tree/main/backend/PawPalServer/src/main/java/com/example/PawPalServer/mappers/implement"
    click AppConfig "https://github.com/twilight2368/pet-care-system-software/blob/main/backend/PawPalServer/src/main/resources/application.yml"

    %% Styles
    classDef frontend fill:#DAE8FC,stroke:#6C8EBF,color:#1A1A1A;
    classDef backend fill:#E2F0D9,stroke:#82B366,color:#1A1A1A;
    classDef db fill:#FFF2CC,stroke:#D6B656,color:#1A1A1A;
    classDef external fill:#F8CECC,stroke:#B85450,color:#1A1A1A;
```
