# pollyvaughn/legalis architecture

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

- Interactive diagram: https://gitdiagram.com/pollyvaughn/legalis
- Repository: https://github.com/pollyvaughn/legalis

## Overview

Legalis System is a web application for managing a legal and accounting practice. A user signs in, navigates protected screens, and manages clients and their cases, advisory work, deadlines, documents, and fees; browser requests reach an Express REST API whose services use Prisma and PostgreSQL. The README identifies the route–controller–service backend structure, while sampled frontend code shows protected routing and centralized authenticated API requests. Several feature areas are documented or present in the tree but were not sampled, so their internal connections are left out where evidence is unavailable.

Main entry points: [`frontend/src/api/axios.js`](https://github.com/pollyvaughn/legalis/blob/main/frontend/src/api/axios.js) (Authenticated API client), [`frontend/src/App.jsx`](https://github.com/pollyvaughn/legalis/blob/main/frontend/src/App.jsx) (Protected navigation), [`backend/src/config/database.js`](https://github.com/pollyvaughn/legalis/blob/main/backend/src/config/database.js) (Prisma client), [`frontend/src/pages/clientes`](https://github.com/pollyvaughn/legalis/tree/main/frontend/src/pages/clientes) (Client management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web application"]
  node_router["Protected navigation<br/>[App.jsx]"]
  node_authui["Session context<br/>[AuthContext.jsx]"]
  node_clientui["Client management"]
  node_caseui["Case management"]
  node_advisoryui["Advisories and filings"]
  node_calendarui["Deadlines calendar"]
  node_feeui["Fees and accounts"]
  node_libraryui["Document templates"]
  node_adminui["Audit and users"]
  node_api["Authenticated API client<br/>[axios.js]"]
end

subgraph group_backend["API and domain"]
  node_auth["Authentication"]
  node_clients["Clients"]
  node_cases["Cases and reports"]
  node_advisories["Advisories and obligations"]
  node_calendar["Deadlines and calendars"]
  node_fees["Fees and account ledger"]
  node_documents["Documents and templates"]
  node_audit["Audit records"]
end

subgraph group_state["Persistence"]
  node_database["Prisma client<br/>[database.js]"]
  node_postgres[("PostgreSQL")]
end

node_user(("Practice user"))

node_user -->|"uses"| node_router
node_router -.->|"loads session"| node_authui
node_router -->|"routes to"| node_clientui
node_router -->|"routes to"| node_caseui
node_router -->|"routes to"| node_advisoryui
node_router -->|"routes to"| node_calendarui
node_router -->|"routes to"| node_feeui
node_router -->|"routes to"| node_libraryui
node_router -.->|"routes to"| node_adminui
node_authui -->|"logs in via"| node_api
node_clientui -->|"requests data"| node_api
node_clientui -->|"renders section"| node_advisoryui
node_advisoryui -->|"requests data"| node_api
node_api -->|"calls REST API"| node_auth
node_api -->|"calls REST API"| node_clients
node_api -->|"calls REST API"| node_cases
node_api -->|"calls REST API"| node_advisories
node_api -->|"calls REST API"| node_calendar
node_api -->|"calls REST API"| node_fees
node_api -->|"calls REST API"| node_documents
node_api -->|"calls REST API"| node_audit
node_cases -->|"uses deadline service"| node_calendar
node_clients -->|"queries via"| node_database
node_cases -->|"queries via"| node_database
node_advisories -.->|"queries via"| node_database
node_calendar -->|"queries via"| node_database
node_database -->|"connects to"| node_postgres

click node_router "https://github.com/pollyvaughn/legalis/blob/main/frontend/src/App.jsx"
click node_authui "https://github.com/pollyvaughn/legalis/blob/main/frontend/src/context/AuthContext.jsx"
click node_clientui "https://github.com/pollyvaughn/legalis/tree/main/frontend/src/pages/clientes"
click node_caseui "https://github.com/pollyvaughn/legalis/tree/main/frontend/src/pages/expedientes"
click node_advisoryui "https://github.com/pollyvaughn/legalis/tree/main/frontend/src/pages/asesorias"
click node_calendarui "https://github.com/pollyvaughn/legalis/tree/main/frontend/src/pages/calendario"
click node_feeui "https://github.com/pollyvaughn/legalis/tree/main/frontend/src/pages/honorarios"
click node_libraryui "https://github.com/pollyvaughn/legalis/tree/main/frontend/src/pages/plantillas"
click node_adminui "https://github.com/pollyvaughn/legalis/tree/main/frontend/src/pages/auditoria"
click node_api "https://github.com/pollyvaughn/legalis/blob/main/frontend/src/api/axios.js"
click node_auth "https://github.com/pollyvaughn/legalis/tree/main/backend/src/modules/auth"
click node_clients "https://github.com/pollyvaughn/legalis/tree/main/backend/src/modules/clientes"
click node_cases "https://github.com/pollyvaughn/legalis/tree/main/backend/src/modules/expedientes"
click node_advisories "https://github.com/pollyvaughn/legalis/tree/main/backend/src/modules/tramites"
click node_calendar "https://github.com/pollyvaughn/legalis/tree/main/backend/src/modules/plazos"
click node_fees "https://github.com/pollyvaughn/legalis/tree/main/backend/src/modules/cuenta-corriente"
click node_documents "https://github.com/pollyvaughn/legalis/tree/main/backend/src/modules/plantillas"
click node_audit "https://github.com/pollyvaughn/legalis/tree/main/backend/src/modules/auditoria"
click node_database "https://github.com/pollyvaughn/legalis/blob/main/backend/src/config/database.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_router,node_authui,node_clientui,node_caseui,node_advisoryui,node_calendarui,node_feeui,node_libraryui,node_adminui,node_api,node_user toneBlue
class node_auth,node_clients,node_cases,node_advisories,node_calendar,node_fees,node_documents,node_audit toneAmber
class node_database,node_postgres toneMint
```

## Components

### Web application

- [Protected navigation](https://github.com/pollyvaughn/legalis/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Session context](https://github.com/pollyvaughn/legalis/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [Client management](https://github.com/pollyvaughn/legalis/tree/main/frontend/src/pages/clientes): `frontend/src/pages/clientes`
- [Case management](https://github.com/pollyvaughn/legalis/tree/main/frontend/src/pages/expedientes): `frontend/src/pages/expedientes`
- [Advisories and filings](https://github.com/pollyvaughn/legalis/tree/main/frontend/src/pages/asesorias): `frontend/src/pages/asesorias`
- [Deadlines calendar](https://github.com/pollyvaughn/legalis/tree/main/frontend/src/pages/calendario): `frontend/src/pages/calendario`
- [Fees and accounts](https://github.com/pollyvaughn/legalis/tree/main/frontend/src/pages/honorarios): `frontend/src/pages/honorarios`
- [Document templates](https://github.com/pollyvaughn/legalis/tree/main/frontend/src/pages/plantillas): `frontend/src/pages/plantillas`
- [Audit and users](https://github.com/pollyvaughn/legalis/tree/main/frontend/src/pages/auditoria): `frontend/src/pages/auditoria`
- [Authenticated API client](https://github.com/pollyvaughn/legalis/blob/main/frontend/src/api/axios.js): `frontend/src/api/axios.js`

### API and domain

- [Authentication](https://github.com/pollyvaughn/legalis/tree/main/backend/src/modules/auth): `backend/src/modules/auth`
- [Clients](https://github.com/pollyvaughn/legalis/tree/main/backend/src/modules/clientes): `backend/src/modules/clientes`
- [Cases and reports](https://github.com/pollyvaughn/legalis/tree/main/backend/src/modules/expedientes): `backend/src/modules/expedientes`
- [Advisories and obligations](https://github.com/pollyvaughn/legalis/tree/main/backend/src/modules/tramites): `backend/src/modules/tramites`
- [Deadlines and calendars](https://github.com/pollyvaughn/legalis/tree/main/backend/src/modules/plazos): `backend/src/modules/plazos`
- [Fees and account ledger](https://github.com/pollyvaughn/legalis/tree/main/backend/src/modules/cuenta-corriente): `backend/src/modules/cuenta-corriente`
- [Documents and templates](https://github.com/pollyvaughn/legalis/tree/main/backend/src/modules/plantillas): `backend/src/modules/plantillas`
- [Audit records](https://github.com/pollyvaughn/legalis/tree/main/backend/src/modules/auditoria): `backend/src/modules/auditoria`

### Persistence

- [Prisma client](https://github.com/pollyvaughn/legalis/blob/main/backend/src/config/database.js): `backend/src/config/database.js`
- **PostgreSQL**

### Other components

- **Practice user**

## Connections

- Practice user → Protected navigation: uses (evidence: `frontend/src/App.jsx`)
- Protected navigation → Session context: loads session
- Protected navigation → Client management: routes to (evidence: `frontend/src/App.jsx`)
- Protected navigation → Case management: routes to (evidence: `frontend/src/App.jsx`)
- Protected navigation → Advisories and filings: routes to (evidence: `frontend/src/App.jsx`)
- Protected navigation → Deadlines calendar: routes to (evidence: `frontend/src/App.jsx`)
- Protected navigation → Fees and accounts: routes to (evidence: `frontend/src/App.jsx`)
- Protected navigation → Document templates: routes to (evidence: `frontend/src/App.jsx`)
- Protected navigation → Audit and users: routes to (evidence: `frontend/src/App.jsx`)
- Session context → Authenticated API client: logs in via (evidence: `frontend/src/context/AuthContext.jsx`)
- Client management → Authenticated API client: requests data (evidence: `frontend/src/pages/clientes/ClienteDetailPage.jsx`)
- Client management → Advisories and filings: renders section (evidence: `frontend/src/pages/clientes/ClienteDetailPage.jsx`)
- Advisories and filings → Authenticated API client: requests data (evidence: `frontend/src/pages/asesorias/AsesoriasPage.jsx`)
- Authenticated API client → Authentication: calls REST API (evidence: `README.md`)
- Authenticated API client → Clients: calls REST API (evidence: `README.md`)
- Authenticated API client → Cases and reports: calls REST API (evidence: `README.md`)
- Authenticated API client → Advisories and obligations: calls REST API (evidence: `README.md`)
- Authenticated API client → Deadlines and calendars: calls REST API (evidence: `README.md`)
- Authenticated API client → Fees and account ledger: calls REST API (evidence: `README.md`)
- Authenticated API client → Documents and templates: calls REST API (evidence: `README.md`)
- Authenticated API client → Audit records: calls REST API (evidence: `README.md`)
- Cases and reports → Deadlines and calendars: uses deadline service (evidence: `backend/src/modules/expedientes/expedientes.reporte.service.js`)
- Clients → Prisma client: queries via (evidence: `backend/src/modules/clientes/clientes.service.js`)
- Cases and reports → Prisma client: queries via (evidence: `backend/src/modules/expedientes/expedientes.reporte.service.js`)
- Advisories and obligations → Prisma client: queries via
- Deadlines and calendars → Prisma client: queries via
- Prisma client → PostgreSQL: connects to (evidence: `backend/src/config/database.js`)
