# prashannraj/advocatepro architecture

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

- Interactive diagram: https://gitdiagram.com/prashannraj/advocatepro
- Repository: https://github.com/prashannraj/advocatepro

## Overview

Advocate Pro is a legal-practice management system for Nepalese firms, with a Next.js interface and Laravel REST API. The main workflow is client intake, case registration with a Nepali-format Case ID and client/lawyer/court assignments, then document and hearing tracking; dashboards and client case summaries support review and reporting. The tree and README document broader firm-management capabilities, but most controller wiring was not sampled, so uncertain API and subsystem links are omitted. MySQL is documented, although the supplied database configuration defaults to SQLite.

Main entry points: [`frontend/src/lib/api.ts`](https://github.com/prashannraj/advocatepro/blob/main/frontend/src/lib/api.ts) (API client), [`backend/app/Http/Controllers/CaseRecordController.php`](https://github.com/prashannraj/advocatepro/blob/main/backend/app/Http/Controllers/CaseRecordController.php) (Case API), [`backend/app/Http/Controllers/DashboardController.php`](https://github.com/prashannraj/advocatepro/blob/main/backend/app/Http/Controllers/DashboardController.php) (Dashboard API), [`frontend/src/app/dashboard/page.tsx`](https://github.com/prashannraj/advocatepro/blob/main/frontend/src/app/dashboard/page.tsx) (Dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_dashboard_ui["Dashboard<br/>[page.tsx]"]
  node_clients_ui["Clients<br/>[page.tsx]"]
  node_cases_ui["Cases<br/>[page.tsx]"]
  node_documents_ui["Documents<br/>[page.tsx]"]
  node_reports_ui["Reports<br/>[page.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
end

subgraph group_casework["Case management"]
  node_case_api["Case API"]
  node_case_data[("Case records<br/>[CaseRecord.php]")]
  node_client_api["Client API"]
  node_client_data[("Clients<br/>[Client.php]")]
  node_document_ui["Case details<br/>[page.tsx]"]
  node_hearing_api["Hearings API"]
  node_document_api["Documents API"]
end

subgraph group_practice["Practice operations"]
  node_schedule_ui["Scheduling<br/>[page.tsx]"]
  node_corporate_ui["Corporate matters<br/>[page.tsx]"]
  node_ipr_ui["IP management<br/>[page.tsx]"]
  node_people_ui["Firm operations<br/>[page.tsx]"]
  node_dashboard_api["Dashboard API"]
end

subgraph group_platform["Platform services"]
  node_auth_api["Authentication<br/>[AuthController.php]"]
  node_subscription_api["Licensing"]
end

node_staff(("Firm staff"))
node_mail{{"Email service"}}
node_database[("Relational database")]

node_staff -->|"manages clients"| node_clients_ui
node_staff -->|"registers cases"| node_cases_ui
node_staff -->|"reviews practice"| node_dashboard_ui
node_cases_ui -->|"requests case data"| node_api_client
node_clients_ui -->|"requests client data"| node_api_client
node_dashboard_ui -->|"requests overview"| node_api_client
node_document_ui -->|"requests case details"| node_api_client
node_api_client -->|"calls API"| node_case_api
node_api_client -->|"calls API"| node_client_api
node_api_client -->|"calls API"| node_dashboard_api
node_case_api -->|"creates and loads"| node_case_data
node_case_api -->|"loads client"| node_client_data
node_dashboard_api -->|"counts and reads"| node_case_data
node_dashboard_api -->|"queries practice data"| node_database
node_auth_api -->|"sends OTP"| node_mail
node_staff -->|"manages documents"| node_documents_ui
node_staff -->|"reviews summaries"| node_reports_ui
node_staff -->|"manages schedule"| node_schedule_ui
node_staff -->|"manages matters"| node_corporate_ui
node_staff -->|"manages IP"| node_ipr_ui
node_staff -->|"manages staff"| node_people_ui

click node_dashboard_ui "https://github.com/prashannraj/advocatepro/blob/main/frontend/src/app/dashboard/page.tsx"
click node_clients_ui "https://github.com/prashannraj/advocatepro/blob/main/frontend/src/app/clients/page.tsx"
click node_cases_ui "https://github.com/prashannraj/advocatepro/blob/main/frontend/src/app/cases/page.tsx"
click node_documents_ui "https://github.com/prashannraj/advocatepro/blob/main/frontend/src/app/documents/page.tsx"
click node_reports_ui "https://github.com/prashannraj/advocatepro/blob/main/frontend/src/app/reports/page.tsx"
click node_api_client "https://github.com/prashannraj/advocatepro/blob/main/frontend/src/lib/api.ts"
click node_case_api "https://github.com/prashannraj/advocatepro/blob/main/backend/app/Http/Controllers/CaseRecordController.php"
click node_case_data "https://github.com/prashannraj/advocatepro/blob/main/backend/app/Models/CaseRecord.php"
click node_client_api "https://github.com/prashannraj/advocatepro/blob/main/backend/app/Http/Controllers/ClientController.php"
click node_client_data "https://github.com/prashannraj/advocatepro/blob/main/backend/app/Models/Client.php"
click node_document_ui "https://github.com/prashannraj/advocatepro/blob/main/frontend/src/app/cases/%5Bid%5D/page.tsx"
click node_hearing_api "https://github.com/prashannraj/advocatepro/blob/main/backend/app/Http/Controllers/HearingController.php"
click node_document_api "https://github.com/prashannraj/advocatepro/blob/main/backend/app/Http/Controllers/DocumentController.php"
click node_schedule_ui "https://github.com/prashannraj/advocatepro/blob/main/frontend/src/app/schedule/page.tsx"
click node_corporate_ui "https://github.com/prashannraj/advocatepro/blob/main/frontend/src/app/corporate/page.tsx"
click node_ipr_ui "https://github.com/prashannraj/advocatepro/blob/main/frontend/src/app/ipr/page.tsx"
click node_people_ui "https://github.com/prashannraj/advocatepro/blob/main/frontend/src/app/payroll/page.tsx"
click node_dashboard_api "https://github.com/prashannraj/advocatepro/blob/main/backend/app/Http/Controllers/DashboardController.php"
click node_auth_api "https://github.com/prashannraj/advocatepro/blob/main/backend/app/Http/Controllers/AuthController.php"
click node_subscription_api "https://github.com/prashannraj/advocatepro/blob/main/backend/app/Http/Controllers/SubscriptionController.php"

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_dashboard_ui,node_clients_ui,node_cases_ui,node_documents_ui,node_reports_ui,node_api_client toneBlue
class node_case_api,node_case_data,node_client_api,node_client_data,node_document_ui,node_hearing_api,node_document_api,node_database toneAmber
class node_schedule_ui,node_corporate_ui,node_ipr_ui,node_people_ui,node_dashboard_api toneMint
class node_auth_api,node_subscription_api toneRose
class node_staff,node_mail toneIndigo
```

## Components

### User experience

- [Dashboard](https://github.com/prashannraj/advocatepro/blob/main/frontend/src/app/dashboard/page.tsx): `frontend/src/app/dashboard/page.tsx`
- [Clients](https://github.com/prashannraj/advocatepro/blob/main/frontend/src/app/clients/page.tsx): `frontend/src/app/clients/page.tsx`
- [Cases](https://github.com/prashannraj/advocatepro/blob/main/frontend/src/app/cases/page.tsx): `frontend/src/app/cases/page.tsx`
- [Documents](https://github.com/prashannraj/advocatepro/blob/main/frontend/src/app/documents/page.tsx): `frontend/src/app/documents/page.tsx`
- [Reports](https://github.com/prashannraj/advocatepro/blob/main/frontend/src/app/reports/page.tsx): `frontend/src/app/reports/page.tsx`
- [API client](https://github.com/prashannraj/advocatepro/blob/main/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`

### Case management

- [Case API](https://github.com/prashannraj/advocatepro/blob/main/backend/app/Http/Controllers/CaseRecordController.php): `backend/app/Http/Controllers/CaseRecordController.php`
- [Case records](https://github.com/prashannraj/advocatepro/blob/main/backend/app/Models/CaseRecord.php): `backend/app/Models/CaseRecord.php`
- [Client API](https://github.com/prashannraj/advocatepro/blob/main/backend/app/Http/Controllers/ClientController.php): `backend/app/Http/Controllers/ClientController.php`
- [Clients](https://github.com/prashannraj/advocatepro/blob/main/backend/app/Models/Client.php): `backend/app/Models/Client.php`
- [Case details](https://github.com/prashannraj/advocatepro/blob/main/frontend/src/app/cases/%5Bid%5D/page.tsx): `frontend/src/app/cases/[id]/page.tsx`
- [Hearings API](https://github.com/prashannraj/advocatepro/blob/main/backend/app/Http/Controllers/HearingController.php): `backend/app/Http/Controllers/HearingController.php`
- [Documents API](https://github.com/prashannraj/advocatepro/blob/main/backend/app/Http/Controllers/DocumentController.php): `backend/app/Http/Controllers/DocumentController.php`

### Practice operations

- [Scheduling](https://github.com/prashannraj/advocatepro/blob/main/frontend/src/app/schedule/page.tsx): `frontend/src/app/schedule/page.tsx`
- [Corporate matters](https://github.com/prashannraj/advocatepro/blob/main/frontend/src/app/corporate/page.tsx): `frontend/src/app/corporate/page.tsx`
- [IP management](https://github.com/prashannraj/advocatepro/blob/main/frontend/src/app/ipr/page.tsx): `frontend/src/app/ipr/page.tsx`
- [Firm operations](https://github.com/prashannraj/advocatepro/blob/main/frontend/src/app/payroll/page.tsx): `frontend/src/app/payroll/page.tsx`
- [Dashboard API](https://github.com/prashannraj/advocatepro/blob/main/backend/app/Http/Controllers/DashboardController.php): `backend/app/Http/Controllers/DashboardController.php`

### Platform services

- [Authentication](https://github.com/prashannraj/advocatepro/blob/main/backend/app/Http/Controllers/AuthController.php): `backend/app/Http/Controllers/AuthController.php`
- [Licensing](https://github.com/prashannraj/advocatepro/blob/main/backend/app/Http/Controllers/SubscriptionController.php): `backend/app/Http/Controllers/SubscriptionController.php`

### Other components

- **Firm staff**
- **Email service**
- **Relational database**

## Connections

- Firm staff → Clients: manages clients
- Firm staff → Cases: registers cases
- Firm staff → Dashboard: reviews practice
- Cases → API client: requests case data
- Clients → API client: requests client data
- Dashboard → API client: requests overview
- Case details → API client: requests case details
- API client → Case API: calls API
- API client → Client API: calls API
- API client → Dashboard API: calls API
- Case API → Case records: creates and loads
- Case API → Clients: loads client
- Dashboard API → Case records: counts and reads
- Dashboard API → Relational database: queries practice data
- Authentication → Email service: sends OTP
- Firm staff → Documents: manages documents
- Firm staff → Reports: reviews summaries
- Firm staff → Scheduling: manages schedule
- Firm staff → Corporate matters: manages matters
- Firm staff → IP management: manages IP
- Firm staff → Firm operations: manages staff
