# ghost-cypher28/lexpay-backend-demo-spring architecture

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

- Interactive diagram: https://gitdiagram.com/ghost-cypher28/lexpay-backend-demo-spring
- Repository: https://github.com/ghost-cypher28/lexpay-backend-demo-spring

## Overview

LexPay is a law-firm billing and practice-management API. A user enters through authentication, then API controllers delegate work to services, which apply domain rules and use repositories to persist or retrieve records; responses are mapped to DTOs. The graph preserves the major billing, payment, client, firm, user, calendar, dashboard, lawyer, and task-scale areas indicated by the source tree. Evidence is limited to the provided excerpts and SOURCE INDEX; links for unsampled controller/service pairs are marked unverified rather than asserted.

Main entry points: [`src/main/java/com/lexpay/api/service/AuthService.java`](https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/service/AuthService.java) (Authentication), [`src/main/java/com/lexpay/api/service/TransactionService.java`](https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/service/TransactionService.java) (Payment transactions), [`src/main/java/com/lexpay/api/service/UserService.java`](https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/service/UserService.java) (User management), [`src/main/java/com/lexpay/api/repository/UserRepository.java`](https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/repository/UserRepository.java) (User repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Identity and access"]
  node_auth_api["Authentication API"]
  node_auth_service["Authentication<br/>[AuthService.java]"]
  node_jwt["JWT security<br/>[JwtService.java]"]
  node_user_api["User API"]
  node_user_service["User management<br/>[UserService.java]"]
end

subgraph group_practice["Practice administration"]
  node_firm_api["Law firm API"]
  node_firm_service["Law firm management"]
  node_client_api["Client API"]
  node_client_service["Client management<br/>[ClientService.java]"]
  node_lawyer_api["Lawyer API"]
  node_lawyer_service["Lawyer management<br/>[LawyerService.java]"]
end

subgraph group_finance["Billing and finance"]
  node_bill_api["Bill API"]
  node_bill_service["Billing rules<br/>[BillService.java]"]
  node_transaction_api["Transaction API"]
  node_transaction_service["Payment transactions"]
end

subgraph group_operations["Practice operations"]
  node_calendar_api["Calendar API"]
  node_calendar_service["Calendar management"]
  node_dashboard_api["Dashboard API"]
  node_dashboard_service["Dashboard summaries"]
  node_taskscale_api["Task scale API"]
  node_taskscale_service["Task scale management"]
end

subgraph group_persistence["Persistence and mapping"]
  node_mapper["DTO mapping<br/>[DtoMapper.java]"]
  node_user_repo["User repository"]
  node_client_repo["Client repository"]
  node_bill_repo["Bill repository"]
  node_transaction_repo["Transaction repository"]
end

node_user(("API user"))
node_database[("Relational database")]

node_user -.->|"submits credentials"| node_auth_api
node_auth_api -.->|"delegates"| node_auth_service
node_auth_service -->|"reads and writes"| node_user_repo
node_auth_service -->|"generates token"| node_jwt
node_auth_service -->|"maps user"| node_mapper
node_user_api -->|"delegates"| node_user_service
node_user_service -->|"reads and writes"| node_user_repo
node_user_service -->|"maps responses"| node_mapper
node_firm_api -.->|"delegates"| node_firm_service
node_client_api -->|"delegates"| node_client_service
node_client_service -->|"reads and writes"| node_client_repo
node_lawyer_api -.->|"delegates"| node_lawyer_service
node_bill_api -->|"delegates"| node_bill_service
node_bill_service -->|"queries bills"| node_bill_repo
node_transaction_api -.->|"delegates"| node_transaction_service
node_transaction_service -->|"reads bills"| node_bill_repo
node_transaction_service -->|"reads and writes"| node_transaction_repo
node_transaction_service -->|"maps responses"| node_mapper
node_calendar_api -.->|"delegates"| node_calendar_service
node_dashboard_api -.->|"delegates"| node_dashboard_service
node_taskscale_api -.->|"delegates"| node_taskscale_service
node_user_repo -->|"persists users"| node_database
node_client_repo -.->|"persists clients"| node_database
node_bill_repo -->|"queries and stores"| node_database
node_transaction_repo -.->|"persists transactions"| node_database

click node_auth_api "https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/controller/AuthController.java"
click node_auth_service "https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/service/AuthService.java"
click node_jwt "https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/security/JwtService.java"
click node_user_api "https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/controller/UserController.java"
click node_user_service "https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/service/UserService.java"
click node_firm_api "https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/controller/LawFirmController.java"
click node_firm_service "https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/service/LawFirmService.java"
click node_client_api "https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/controller/ClientController.java"
click node_client_service "https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/service/ClientService.java"
click node_lawyer_api "https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/controller/LawyerController.java"
click node_lawyer_service "https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/service/LawyerService.java"
click node_bill_api "https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/controller/BillController.java"
click node_bill_service "https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/service/BillService.java"
click node_transaction_api "https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/controller/TransactionController.java"
click node_transaction_service "https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/service/TransactionService.java"
click node_calendar_api "https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/controller/CalendarController.java"
click node_calendar_service "https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/service/CalendarService.java"
click node_dashboard_api "https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/controller/DashboardController.java"
click node_dashboard_service "https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/service/DashboardService.java"
click node_taskscale_api "https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/controller/TaskScaleController.java"
click node_taskscale_service "https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/service/TaskScaleService.java"
click node_mapper "https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/service/DtoMapper.java"
click node_user_repo "https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/repository/UserRepository.java"
click node_client_repo "https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/repository/ClientRepository.java"
click node_bill_repo "https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/repository/BillRepository.java"
click node_transaction_repo "https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/repository/TransactionRepository.java"

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_auth_api,node_auth_service,node_jwt,node_user_api,node_user_service,node_user toneBlue
class node_firm_api,node_firm_service,node_client_api,node_client_service,node_lawyer_api,node_lawyer_service,node_database toneAmber
class node_bill_api,node_bill_service,node_transaction_api,node_transaction_service toneMint
class node_calendar_api,node_calendar_service,node_dashboard_api,node_dashboard_service,node_taskscale_api,node_taskscale_service toneRose
class node_mapper,node_user_repo,node_client_repo,node_bill_repo,node_transaction_repo toneIndigo
```

## Components

### Identity and access

- [Authentication API](https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/controller/AuthController.java): `src/main/java/com/lexpay/api/controller/AuthController.java`
- [Authentication](https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/service/AuthService.java): `src/main/java/com/lexpay/api/service/AuthService.java`
- [JWT security](https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/security/JwtService.java): `src/main/java/com/lexpay/api/security/JwtService.java`
- [User API](https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/controller/UserController.java): `src/main/java/com/lexpay/api/controller/UserController.java`
- [User management](https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/service/UserService.java): `src/main/java/com/lexpay/api/service/UserService.java`

### Practice administration

- [Law firm API](https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/controller/LawFirmController.java): `src/main/java/com/lexpay/api/controller/LawFirmController.java`
- [Law firm management](https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/service/LawFirmService.java): `src/main/java/com/lexpay/api/service/LawFirmService.java`
- [Client API](https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/controller/ClientController.java): `src/main/java/com/lexpay/api/controller/ClientController.java`
- [Client management](https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/service/ClientService.java): `src/main/java/com/lexpay/api/service/ClientService.java`
- [Lawyer API](https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/controller/LawyerController.java): `src/main/java/com/lexpay/api/controller/LawyerController.java`
- [Lawyer management](https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/service/LawyerService.java): `src/main/java/com/lexpay/api/service/LawyerService.java`

### Billing and finance

- [Bill API](https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/controller/BillController.java): `src/main/java/com/lexpay/api/controller/BillController.java`
- [Billing rules](https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/service/BillService.java): `src/main/java/com/lexpay/api/service/BillService.java`
- [Transaction API](https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/controller/TransactionController.java): `src/main/java/com/lexpay/api/controller/TransactionController.java`
- [Payment transactions](https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/service/TransactionService.java): `src/main/java/com/lexpay/api/service/TransactionService.java`

### Practice operations

- [Calendar API](https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/controller/CalendarController.java): `src/main/java/com/lexpay/api/controller/CalendarController.java`
- [Calendar management](https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/service/CalendarService.java): `src/main/java/com/lexpay/api/service/CalendarService.java`
- [Dashboard API](https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/controller/DashboardController.java): `src/main/java/com/lexpay/api/controller/DashboardController.java`
- [Dashboard summaries](https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/service/DashboardService.java): `src/main/java/com/lexpay/api/service/DashboardService.java`
- [Task scale API](https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/controller/TaskScaleController.java): `src/main/java/com/lexpay/api/controller/TaskScaleController.java`
- [Task scale management](https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/service/TaskScaleService.java): `src/main/java/com/lexpay/api/service/TaskScaleService.java`

### Persistence and mapping

- [DTO mapping](https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/service/DtoMapper.java): `src/main/java/com/lexpay/api/service/DtoMapper.java`
- [User repository](https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/repository/UserRepository.java): `src/main/java/com/lexpay/api/repository/UserRepository.java`
- [Client repository](https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/repository/ClientRepository.java): `src/main/java/com/lexpay/api/repository/ClientRepository.java`
- [Bill repository](https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/repository/BillRepository.java): `src/main/java/com/lexpay/api/repository/BillRepository.java`
- [Transaction repository](https://github.com/ghost-cypher28/lexpay-backend-demo-spring/blob/main/src/main/java/com/lexpay/api/repository/TransactionRepository.java): `src/main/java/com/lexpay/api/repository/TransactionRepository.java`

### Other components

- **API user**
- **Relational database**

## Connections

- API user → Authentication API: submits credentials
- Authentication API → Authentication: delegates (evidence: `src/main/java/com/lexpay/api/controller/AuthController.java`)
- Authentication → User repository: reads and writes (evidence: `src/main/java/com/lexpay/api/service/AuthService.java`)
- Authentication → JWT security: generates token (evidence: `src/main/java/com/lexpay/api/service/AuthService.java`)
- Authentication → DTO mapping: maps user (evidence: `src/main/java/com/lexpay/api/service/AuthService.java`)
- User API → User management: delegates (evidence: `src/main/java/com/lexpay/api/controller/UserController.java`)
- User management → User repository: reads and writes (evidence: `src/main/java/com/lexpay/api/service/UserService.java`)
- User management → DTO mapping: maps responses (evidence: `src/main/java/com/lexpay/api/service/UserService.java`)
- Law firm API → Law firm management: delegates
- Client API → Client management: delegates (evidence: `src/main/java/com/lexpay/api/controller/ClientController.java`)
- Client management → Client repository: reads and writes (evidence: `src/main/java/com/lexpay/api/service/ClientService.java`)
- Lawyer API → Lawyer management: delegates
- Bill API → Billing rules: delegates (evidence: `src/main/java/com/lexpay/api/controller/BillController.java`)
- Billing rules → Bill repository: queries bills (evidence: `src/main/java/com/lexpay/api/service/BillService.java`)
- Transaction API → Payment transactions: delegates (evidence: `src/main/java/com/lexpay/api/controller/TransactionController.java`)
- Payment transactions → Bill repository: reads bills (evidence: `src/main/java/com/lexpay/api/service/TransactionService.java`)
- Payment transactions → Transaction repository: reads and writes (evidence: `src/main/java/com/lexpay/api/service/TransactionService.java`)
- Payment transactions → DTO mapping: maps responses (evidence: `src/main/java/com/lexpay/api/service/TransactionService.java`)
- Calendar API → Calendar management: delegates
- Dashboard API → Dashboard summaries: delegates
- Task scale API → Task scale management: delegates
- User repository → Relational database: persists users
- Client repository → Relational database: persists clients
- Bill repository → Relational database: queries and stores (evidence: `src/main/java/com/lexpay/api/repository/BillRepository.java`)
- Transaction repository → Relational database: persists transactions
