# jsevilla-dev/taripa architecture

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

- Interactive diagram: https://gitdiagram.com/jsevilla-dev/taripa
- Repository: https://github.com/jsevilla-dev/taripa

## Overview

TARIPA is a rental and utility-billing system with an administrator interface and a tenant portal. The admin workflow covers room and tenant records, meter readings, utility rates, billing, and reports; the tenant portal provides account access and views of profile, readings, and bills. The backend routes requests, applies role-specific authentication, and queries a MySQL pool. Frontend-to-backend request edges are omitted because the excerpts do not show those calls; route and capability coverage also relies on the source index and partial excerpts.

Main entry points: [`backend/server.js`](https://github.com/jsevilla-dev/taripa/blob/master/backend/server.js) (API server), [`backend/config/db.js`](https://github.com/jsevilla-dev/taripa/blob/master/backend/config/db.js) (MySQL pool), [`backend/routes/adminAuth.js`](https://github.com/jsevilla-dev/taripa/blob/master/backend/routes/adminAuth.js) (Admin login), [`backend/routes/clientAuth.js`](https://github.com/jsevilla-dev/taripa/blob/master/backend/routes/clientAuth.js) (Tenant login)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interfaces"]
  node_entry["Frontend entry<br/>[main.jsx]"]
  node_admin_ui["Admin console<br/>[App.jsx]"]
  node_tenant_ui["Tenant portal<br/>[ClientApp.jsx]"]
end

subgraph group_api["API and access"]
  node_server["API server<br/>[server.js]"]
  node_admin_login["Admin login<br/>[adminAuth.js]"]
  node_admin_guard["Admin auth<br/>[adminAuth.js]"]
  node_client_login["Tenant login<br/>[clientAuth.js]"]
  node_client_guard["Tenant auth<br/>[clientAuth.js]"]
  node_client_portal["Tenant data<br/>[clientPortal.js]"]
end

subgraph group_operations["Rental operations"]
  node_rooms["Room management<br/>[rooms.js]"]
  node_tenants["Tenant management<br/>[tenants.js]"]
  node_readings["Meter readings<br/>[meterReadings.js]"]
  node_rates["Utility rates<br/>[utilityRates.js]"]
  node_billing["Billing records<br/>[billing.js]"]
end

subgraph group_persistence["Persistence"]
  node_db_pool["MySQL pool<br/>[db.js]"]
  node_database[("Rental database<br/>[schema.sql]")]
end

node_admin(("Administrator"))
node_tenant(("Tenant"))

node_entry -->|"selects default"| node_admin_ui
node_entry -->|"selects client routes"| node_tenant_ui
node_server -->|"mounts"| node_admin_login
node_server -->|"protects routes"| node_admin_guard
node_server -->|"mounts"| node_client_login
node_server -->|"protects portal"| node_client_guard
node_server -->|"mounts"| node_client_portal
node_server -->|"mounts"| node_rooms
node_server -->|"mounts"| node_tenants
node_server -->|"mounts"| node_readings
node_server -->|"mounts"| node_rates
node_server -->|"mounts"| node_billing
node_admin_login -->|"checks identity"| node_admin_guard
node_client_login -->|"uses middleware"| node_client_guard
node_admin_login -.-> node_db_pool
node_client_login -->|"queries accounts"| node_db_pool
node_client_portal -->|"queries tenant data"| node_db_pool
node_rooms -->|"queries records"| node_db_pool
node_tenants -->|"queries records"| node_db_pool
node_readings -->|"queries readings"| node_db_pool
node_rates -->|"queries rates"| node_db_pool
node_billing -->|"queries bills"| node_db_pool
node_db_pool -.->|"connects to"| node_database
node_admin -.->|"uses"| node_admin_ui
node_tenant -.->|"uses"| node_tenant_ui

click node_entry "https://github.com/jsevilla-dev/taripa/blob/master/frontend/src/main.jsx"
click node_admin_ui "https://github.com/jsevilla-dev/taripa/blob/master/frontend/src/App.jsx"
click node_tenant_ui "https://github.com/jsevilla-dev/taripa/blob/master/frontend/src/ClientApp.jsx"
click node_server "https://github.com/jsevilla-dev/taripa/blob/master/backend/server.js"
click node_admin_login "https://github.com/jsevilla-dev/taripa/blob/master/backend/routes/adminAuth.js"
click node_admin_guard "https://github.com/jsevilla-dev/taripa/blob/master/backend/middleware/adminAuth.js"
click node_client_login "https://github.com/jsevilla-dev/taripa/blob/master/backend/routes/clientAuth.js"
click node_client_guard "https://github.com/jsevilla-dev/taripa/blob/master/backend/middleware/clientAuth.js"
click node_client_portal "https://github.com/jsevilla-dev/taripa/blob/master/backend/routes/clientPortal.js"
click node_rooms "https://github.com/jsevilla-dev/taripa/blob/master/backend/routes/rooms.js"
click node_tenants "https://github.com/jsevilla-dev/taripa/blob/master/backend/routes/tenants.js"
click node_readings "https://github.com/jsevilla-dev/taripa/blob/master/backend/routes/meterReadings.js"
click node_rates "https://github.com/jsevilla-dev/taripa/blob/master/backend/routes/utilityRates.js"
click node_billing "https://github.com/jsevilla-dev/taripa/blob/master/backend/routes/billing.js"
click node_db_pool "https://github.com/jsevilla-dev/taripa/blob/master/backend/config/db.js"
click node_database "https://github.com/jsevilla-dev/taripa/blob/master/database/schema.sql"

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_entry,node_admin_ui,node_tenant_ui toneBlue
class node_server,node_admin_login,node_admin_guard,node_client_login,node_client_guard,node_client_portal toneAmber
class node_rooms,node_tenants,node_readings,node_rates,node_billing toneMint
class node_db_pool,node_database toneRose
class node_admin,node_tenant toneIndigo
```

## Components

### Web interfaces

- [Frontend entry](https://github.com/jsevilla-dev/taripa/blob/master/frontend/src/main.jsx): `frontend/src/main.jsx`
- [Admin console](https://github.com/jsevilla-dev/taripa/blob/master/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Tenant portal](https://github.com/jsevilla-dev/taripa/blob/master/frontend/src/ClientApp.jsx): `frontend/src/ClientApp.jsx`

### API and access

- [API server](https://github.com/jsevilla-dev/taripa/blob/master/backend/server.js): `backend/server.js`
- [Admin login](https://github.com/jsevilla-dev/taripa/blob/master/backend/routes/adminAuth.js): `backend/routes/adminAuth.js`
- [Admin auth](https://github.com/jsevilla-dev/taripa/blob/master/backend/middleware/adminAuth.js): `backend/middleware/adminAuth.js`
- [Tenant login](https://github.com/jsevilla-dev/taripa/blob/master/backend/routes/clientAuth.js): `backend/routes/clientAuth.js`
- [Tenant auth](https://github.com/jsevilla-dev/taripa/blob/master/backend/middleware/clientAuth.js): `backend/middleware/clientAuth.js`
- [Tenant data](https://github.com/jsevilla-dev/taripa/blob/master/backend/routes/clientPortal.js): `backend/routes/clientPortal.js`

### Rental operations

- [Room management](https://github.com/jsevilla-dev/taripa/blob/master/backend/routes/rooms.js): `backend/routes/rooms.js`
- [Tenant management](https://github.com/jsevilla-dev/taripa/blob/master/backend/routes/tenants.js): `backend/routes/tenants.js`
- [Meter readings](https://github.com/jsevilla-dev/taripa/blob/master/backend/routes/meterReadings.js): `backend/routes/meterReadings.js`
- [Utility rates](https://github.com/jsevilla-dev/taripa/blob/master/backend/routes/utilityRates.js): `backend/routes/utilityRates.js`
- [Billing records](https://github.com/jsevilla-dev/taripa/blob/master/backend/routes/billing.js): `backend/routes/billing.js`

### Persistence

- [MySQL pool](https://github.com/jsevilla-dev/taripa/blob/master/backend/config/db.js): `backend/config/db.js`
- [Rental database](https://github.com/jsevilla-dev/taripa/blob/master/database/schema.sql): `database/schema.sql`

### Other components

- **Administrator**
- **Tenant**

## Connections

- Frontend entry → Admin console: selects default (evidence: `frontend/src/main.jsx`)
- Frontend entry → Tenant portal: selects client routes (evidence: `frontend/src/main.jsx`)
- API server → Admin login: mounts (evidence: `backend/server.js`)
- API server → Admin auth: protects routes (evidence: `backend/server.js`)
- API server → Tenant login: mounts (evidence: `backend/server.js`)
- API server → Tenant auth: protects portal (evidence: `backend/server.js`)
- API server → Tenant data: mounts (evidence: `backend/server.js`)
- API server → Room management: mounts (evidence: `backend/server.js`)
- API server → Tenant management: mounts (evidence: `backend/server.js`)
- API server → Meter readings: mounts (evidence: `backend/server.js`)
- API server → Utility rates: mounts (evidence: `backend/server.js`)
- API server → Billing records: mounts (evidence: `backend/server.js`)
- Admin login → Admin auth: checks identity (evidence: `backend/routes/adminAuth.js`)
- Tenant login → Tenant auth: uses middleware (evidence: `backend/routes/clientAuth.js`)
- Admin login → MySQL pool
- Tenant login → MySQL pool: queries accounts (evidence: `backend/routes/clientAuth.js`)
- Tenant data → MySQL pool: queries tenant data (evidence: `backend/routes/clientPortal.js`)
- Room management → MySQL pool: queries records (evidence: `backend/routes/rooms.js`)
- Tenant management → MySQL pool: queries records (evidence: `backend/routes/tenants.js`)
- Meter readings → MySQL pool: queries readings (evidence: `backend/routes/meterReadings.js`)
- Utility rates → MySQL pool: queries rates (evidence: `backend/routes/utilityRates.js`)
- Billing records → MySQL pool: queries bills (evidence: `backend/routes/billing.js`)
- MySQL pool → Rental database: connects to
- Administrator → Admin console: uses
- Tenant → Tenant portal: uses
