# kbtmpst/petcare architecture

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

- Interactive diagram: https://gitdiagram.com/kbtmpst/petcare
- Repository: https://github.com/kbtmpst/petcare

## Overview

This repository combines a grooming-shop management interface with an Express API. In the client, users navigate to operational pages, manage records, and view dashboard and analytics screens; the sampled appointment logic handles booking rules and related records. The client repositories currently keep data in memory. The server provides API, authentication, and database layers, but the excerpts do not establish how every client page connects to that API. Unsampled capabilities are represented where the tree supports them; edges are limited to relationships evidenced by excerpts or the source index.

Main entry points: [`client/src/business/services/appointmentService.js`](https://github.com/kbtmpst/petcare/blob/main/client/src/business/services/appointmentService.js) (Appointment rules), [`server/src/business/services/authService.js`](https://github.com/kbtmpst/petcare/blob/main/server/src/business/services/authService.js) (Authentication wiring), [`client/src/business/services/serviceService.js`](https://github.com/kbtmpst/petcare/blob/main/client/src/business/services/serviceService.js) (Service rules), [`client/src/presentation/App.jsx`](https://github.com/kbtmpst/petcare/blob/main/client/src/presentation/App.jsx) (Client routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client_ui["Client interface"]
  node_client_app["Client routes<br/>[App.jsx]"]
  node_svc_page["Service management<br/>[Services.jsx]"]
  node_other_pages["Shop pages"]
end

subgraph group_client_domain["Client operations"]
  node_appointments["Appointment rules"]
  node_services_logic["Service rules<br/>[serviceService.js]"]
  node_customer_logic["Customer operations<br/>[customerService.js]"]
  node_pet_logic["Pet operations<br/>[petService.js]"]
  node_transaction_logic["Transaction operations"]
  node_analytics_logic["Analytics"]
  node_service_validator["Service validation"]
  node_format["Date and currency formatting<br/>[format.js]"]
end

subgraph group_client_data["Client storage"]
  node_appointment_repo[("Appointments store")]
  node_customer_repo[("Customers store")]
  node_pet_repo[("Pets store<br/>[petRepository.js]")]
  node_service_repo[("Services store")]
  node_transaction_repo[("Transactions store")]
  node_client_id["ID generator<br/>[idGenerator.js]"]
end

subgraph group_server_api["Server API"]
  node_server_app["Express application<br/>[app.js]"]
  node_service_controller["Service controller"]
  node_auth_controller["Authentication controller<br/>[authController.js]"]
  node_routes["API routes<br/>[index.js]"]
end

subgraph group_server_core["Server business and data"]
  node_auth_wiring["Authentication wiring<br/>[authService.js]"]
  node_auth_logic["Authentication rules"]
  node_token_service["Token signing<br/>[tokenService.js]"]
  node_user_repo[("User repository<br/>[userRepository.js]")]
  node_db_pool[("Database pool<br/>[pool.js]")]
  node_server_config["Server configuration<br/>[env.js]"]
end

node_user(("Shop staff"))

node_user -->|"uses"| node_client_app
node_client_app -->|"routes to"| node_svc_page
node_client_app -->|"routes to"| node_other_pages
node_svc_page -->|"calls"| node_services_logic
node_services_logic -->|"reads and writes"| node_service_repo
node_services_logic -->|"validates with"| node_service_validator
node_appointments -->|"reads and writes"| node_appointment_repo
node_appointments -->|"reads"| node_pet_repo
node_appointments -->|"reads"| node_customer_repo
node_appointments -->|"reads"| node_service_repo
node_appointments -->|"writes"| node_transaction_repo
node_appointments -->|"formats with"| node_format
node_customer_repo -->|"generates IDs"| node_client_id
node_svc_page -->|"uses"| node_service_validator
node_server_app -->|"loads"| node_server_config
node_server_app -->|"mounts"| node_routes
node_service_controller -->|"calls"| node_services_logic
node_auth_controller -->|"calls"| node_auth_wiring
node_auth_wiring -->|"configures"| node_auth_logic
node_auth_wiring -->|"provides users"| node_user_repo
node_auth_wiring -->|"provides tokens"| node_token_service
node_auth_wiring -->|"reads settings"| node_server_config
node_auth_logic -->|"validates with"| node_server_config
node_user_repo -->|"uses"| node_db_pool

click node_client_app "https://github.com/kbtmpst/petcare/blob/main/client/src/presentation/App.jsx"
click node_svc_page "https://github.com/kbtmpst/petcare/blob/main/client/src/presentation/pages/Services.jsx"
click node_other_pages "https://github.com/kbtmpst/petcare/tree/main/client/src/presentation/pages"
click node_appointments "https://github.com/kbtmpst/petcare/blob/main/client/src/business/services/appointmentService.js"
click node_services_logic "https://github.com/kbtmpst/petcare/blob/main/client/src/business/services/serviceService.js"
click node_customer_logic "https://github.com/kbtmpst/petcare/blob/main/client/src/business/services/customerService.js"
click node_pet_logic "https://github.com/kbtmpst/petcare/blob/main/client/src/business/services/petService.js"
click node_transaction_logic "https://github.com/kbtmpst/petcare/blob/main/client/src/business/services/transactionService.js"
click node_analytics_logic "https://github.com/kbtmpst/petcare/blob/main/client/src/business/services/analyticsService.js"
click node_service_validator "https://github.com/kbtmpst/petcare/blob/main/client/src/business/validators/serviceValidator.js"
click node_format "https://github.com/kbtmpst/petcare/blob/main/client/src/business/utils/format.js"
click node_appointment_repo "https://github.com/kbtmpst/petcare/blob/main/client/src/data/repositories/appointmentRepository.js"
click node_customer_repo "https://github.com/kbtmpst/petcare/blob/main/client/src/data/repositories/customerRepository.js"
click node_pet_repo "https://github.com/kbtmpst/petcare/blob/main/client/src/data/repositories/petRepository.js"
click node_service_repo "https://github.com/kbtmpst/petcare/blob/main/client/src/data/repositories/serviceRepository.js"
click node_transaction_repo "https://github.com/kbtmpst/petcare/blob/main/client/src/data/repositories/transactionRepository.js"
click node_client_id "https://github.com/kbtmpst/petcare/blob/main/client/src/data/database/idGenerator.js"
click node_server_app "https://github.com/kbtmpst/petcare/blob/main/server/src/app.js"
click node_service_controller "https://github.com/kbtmpst/petcare/blob/main/server/src/controllers/serviceController.js"
click node_auth_controller "https://github.com/kbtmpst/petcare/blob/main/server/src/controllers/authController.js"
click node_auth_wiring "https://github.com/kbtmpst/petcare/blob/main/server/src/business/services/authService.js"
click node_auth_logic "https://github.com/kbtmpst/petcare/blob/main/server/src/business/services/createAuthService.js"
click node_token_service "https://github.com/kbtmpst/petcare/blob/main/server/src/business/security/tokenService.js"
click node_user_repo "https://github.com/kbtmpst/petcare/blob/main/server/src/data/repositories/userRepository.js"
click node_db_pool "https://github.com/kbtmpst/petcare/blob/main/server/src/data/database/pool.js"
click node_server_config "https://github.com/kbtmpst/petcare/blob/main/server/src/config/env.js"
click node_routes "https://github.com/kbtmpst/petcare/blob/main/server/src/routes/index.js"

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_client_app,node_svc_page,node_other_pages toneBlue
class node_appointments,node_services_logic,node_customer_logic,node_pet_logic,node_transaction_logic,node_analytics_logic,node_service_validator,node_format toneAmber
class node_appointment_repo,node_customer_repo,node_pet_repo,node_service_repo,node_transaction_repo,node_client_id toneMint
class node_server_app,node_service_controller,node_auth_controller,node_routes toneRose
class node_auth_wiring,node_auth_logic,node_token_service,node_user_repo,node_db_pool,node_server_config,node_user toneIndigo
```

## Components

### Client interface

- [Client routes](https://github.com/kbtmpst/petcare/blob/main/client/src/presentation/App.jsx): `client/src/presentation/App.jsx`
- [Service management](https://github.com/kbtmpst/petcare/blob/main/client/src/presentation/pages/Services.jsx): `client/src/presentation/pages/Services.jsx`
- [Shop pages](https://github.com/kbtmpst/petcare/tree/main/client/src/presentation/pages): `client/src/presentation/pages`

### Client operations

- [Appointment rules](https://github.com/kbtmpst/petcare/blob/main/client/src/business/services/appointmentService.js): `client/src/business/services/appointmentService.js`
- [Service rules](https://github.com/kbtmpst/petcare/blob/main/client/src/business/services/serviceService.js): `client/src/business/services/serviceService.js`
- [Customer operations](https://github.com/kbtmpst/petcare/blob/main/client/src/business/services/customerService.js): `client/src/business/services/customerService.js`
- [Pet operations](https://github.com/kbtmpst/petcare/blob/main/client/src/business/services/petService.js): `client/src/business/services/petService.js`
- [Transaction operations](https://github.com/kbtmpst/petcare/blob/main/client/src/business/services/transactionService.js): `client/src/business/services/transactionService.js`
- [Analytics](https://github.com/kbtmpst/petcare/blob/main/client/src/business/services/analyticsService.js): `client/src/business/services/analyticsService.js`
- [Service validation](https://github.com/kbtmpst/petcare/blob/main/client/src/business/validators/serviceValidator.js): `client/src/business/validators/serviceValidator.js`
- [Date and currency formatting](https://github.com/kbtmpst/petcare/blob/main/client/src/business/utils/format.js): `client/src/business/utils/format.js`

### Client storage

- [Appointments store](https://github.com/kbtmpst/petcare/blob/main/client/src/data/repositories/appointmentRepository.js): `client/src/data/repositories/appointmentRepository.js`
- [Customers store](https://github.com/kbtmpst/petcare/blob/main/client/src/data/repositories/customerRepository.js): `client/src/data/repositories/customerRepository.js`
- [Pets store](https://github.com/kbtmpst/petcare/blob/main/client/src/data/repositories/petRepository.js): `client/src/data/repositories/petRepository.js`
- [Services store](https://github.com/kbtmpst/petcare/blob/main/client/src/data/repositories/serviceRepository.js): `client/src/data/repositories/serviceRepository.js`
- [Transactions store](https://github.com/kbtmpst/petcare/blob/main/client/src/data/repositories/transactionRepository.js): `client/src/data/repositories/transactionRepository.js`
- [ID generator](https://github.com/kbtmpst/petcare/blob/main/client/src/data/database/idGenerator.js): `client/src/data/database/idGenerator.js`

### Server API

- [Express application](https://github.com/kbtmpst/petcare/blob/main/server/src/app.js): `server/src/app.js`
- [Service controller](https://github.com/kbtmpst/petcare/blob/main/server/src/controllers/serviceController.js): `server/src/controllers/serviceController.js`
- [Authentication controller](https://github.com/kbtmpst/petcare/blob/main/server/src/controllers/authController.js): `server/src/controllers/authController.js`
- [API routes](https://github.com/kbtmpst/petcare/blob/main/server/src/routes/index.js): `server/src/routes/index.js`

### Server business and data

- [Authentication wiring](https://github.com/kbtmpst/petcare/blob/main/server/src/business/services/authService.js): `server/src/business/services/authService.js`
- [Authentication rules](https://github.com/kbtmpst/petcare/blob/main/server/src/business/services/createAuthService.js): `server/src/business/services/createAuthService.js`
- [Token signing](https://github.com/kbtmpst/petcare/blob/main/server/src/business/security/tokenService.js): `server/src/business/security/tokenService.js`
- [User repository](https://github.com/kbtmpst/petcare/blob/main/server/src/data/repositories/userRepository.js): `server/src/data/repositories/userRepository.js`
- [Database pool](https://github.com/kbtmpst/petcare/blob/main/server/src/data/database/pool.js): `server/src/data/database/pool.js`
- [Server configuration](https://github.com/kbtmpst/petcare/blob/main/server/src/config/env.js): `server/src/config/env.js`

### Other components

- **Shop staff**

## Connections

- Shop staff → Client routes: uses
- Client routes → Service management: routes to (evidence: `client/src/presentation/App.jsx`)
- Client routes → Shop pages: routes to (evidence: `client/src/presentation/App.jsx`)
- Service management → Service rules: calls (evidence: `client/src/presentation/pages/Services.jsx`)
- Service rules → Services store: reads and writes (evidence: `client/src/business/services/serviceService.js`)
- Service rules → Service validation: validates with (evidence: `client/src/business/services/serviceService.js`)
- Appointment rules → Appointments store: reads and writes (evidence: `client/src/business/services/appointmentService.js`)
- Appointment rules → Pets store: reads (evidence: `client/src/business/services/appointmentService.js`)
- Appointment rules → Customers store: reads (evidence: `client/src/business/services/appointmentService.js`)
- Appointment rules → Services store: reads (evidence: `client/src/business/services/appointmentService.js`)
- Appointment rules → Transactions store: writes (evidence: `client/src/business/services/appointmentService.js`)
- Appointment rules → Date and currency formatting: formats with (evidence: `client/src/business/services/appointmentService.js`)
- Customers store → ID generator: generates IDs (evidence: `client/src/data/repositories/customerRepository.js`)
- Service management → Service validation: uses (evidence: `client/src/presentation/pages/Services.jsx`)
- Express application → Server configuration: loads (evidence: `server/src/app.js`)
- Express application → API routes: mounts (evidence: `server/src/app.js`)
- Service controller → Service rules: calls (evidence: `server/src/controllers/serviceController.js`)
- Authentication controller → Authentication wiring: calls (evidence: `server/src/controllers/authController.js`)
- Authentication wiring → Authentication rules: configures (evidence: `server/src/business/services/authService.js`)
- Authentication wiring → User repository: provides users (evidence: `server/src/business/services/authService.js`)
- Authentication wiring → Token signing: provides tokens (evidence: `server/src/business/services/authService.js`)
- Authentication wiring → Server configuration: reads settings (evidence: `server/src/business/services/authService.js`)
- Authentication rules → Server configuration: validates with (evidence: `server/src/business/services/createAuthService.js`)
- User repository → Database pool: uses (evidence: `server/src/data/repositories/userRepository.js`)
