# maduna2000/recycleprox architecture

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

- Interactive diagram: https://gitdiagram.com/maduna2000/recycleprox
- Repository: https://github.com/maduna2000/recycleprox

## Overview

Renovo Pro is a multi-tenant business operations system, with desktop and mobile clients plus dedicated guard and scale-station applications. A typical operator workflow signs in, records customers and purchases or sales, then manages stock, payments, cash-up and financial reporting. Separate workflows cover gate visitor registration, police records and scale orders. The tree documents these product areas, while sampled routes show tenant-scoped API calls into domain services and persistence. UI-to-API wiring and unsampled service internals are not asserted here.

Main entry points: [`src/lib/db/prisma.ts`](https://github.com/maduna2000/recycleprox/blob/master/src/lib/db/prisma.ts) (Tenant database), [`src/lib/db/tenantContext.ts`](https://github.com/maduna2000/recycleprox/blob/master/src/lib/db/tenantContext.ts) (Tenant context), [`src/app/api/customers/route.ts`](https://github.com/maduna2000/recycleprox/blob/master/src/app/api/customers/route.ts) (Customer records), [`mobile/app/(operator)/index.tsx`](https://github.com/maduna2000/recycleprox/blob/master/mobile/app/(operator)/index.tsx) (Mobile clients)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Clients"]
  node_web["Web workspace<br/>[layout.tsx]"]
  node_mobile["Mobile clients<br/>[index.tsx]"]
  node_guardclient["Guard client<br/>[index.tsx]"]
  node_scaleworkspace["Scale workspace<br/>[page.tsx]"]
end

subgraph group_commerce["Commerce"]
  node_customers["Customer records<br/>[route.ts]"]
  node_purchases["Purchases<br/>[route.ts]"]
  node_sales["Sales<br/>[route.ts]"]
end

subgraph group_finance["Finance and stock"]
  node_cashup["Cash-up<br/>[route.ts]"]
  node_payments["Payments and float<br/>[route.ts]"]
  node_stock["Stock management<br/>[route.ts]"]
  node_ledger["Ledger and reports<br/>[route.ts]"]
end

subgraph group_operations["Specialist operations"]
  node_scaleorders["Scale orders<br/>[route.ts]"]
  node_gate["Gate entries<br/>[route.ts]"]
  node_police["Police records<br/>[route.ts]"]
end

subgraph group_platform["Platform services"]
  node_offline["Offline workflows<br/>[sync.ts]"]
  node_auth["Authentication<br/>[authService.ts]"]
  node_tenant["Tenant context<br/>[tenantContext.ts]"]
  node_database[("Tenant database<br/>[prisma.ts]")]
  node_photos["Photo storage<br/>[index.ts]"]
  node_printing["Receipt printing<br/>[route.ts]"]
end

node_operator(("Staff operator"))

node_operator -->|"uses"| node_web
node_operator -->|"uses"| node_mobile
node_operator -->|"uses"| node_guardclient
node_operator -->|"uses"| node_scaleworkspace
node_web -->|"signs in"| node_auth
node_mobile -->|"signs in"| node_auth
node_guardclient -->|"records visits"| node_gate
node_scaleworkspace -->|"records orders"| node_scaleorders
node_mobile -->|"records orders"| node_scaleorders
node_customers -->|"runs within"| node_tenant
node_customers -->|"reads and writes"| node_database
node_customers -->|"scopes request"| node_tenant
node_purchases -->|"scopes request"| node_tenant
node_purchases -->|"via service"| node_database
node_cashup -->|"scopes request"| node_tenant
node_cashup -->|"via service"| node_database
node_police -->|"scopes request"| node_tenant
node_police -->|"via service"| node_database
node_offline -->|"caches locally"| node_database
node_offline -->|"uploads photos"| node_photos
node_printing -->|"reads records"| node_database

click node_web "https://github.com/maduna2000/recycleprox/blob/master/src/app/app/(modules)/layout.tsx"
click node_mobile "https://github.com/maduna2000/recycleprox/blob/master/mobile/app/(operator)/index.tsx"
click node_guardclient "https://github.com/maduna2000/recycleprox/blob/master/guard-station/app/(guard)/index.tsx"
click node_scaleworkspace "https://github.com/maduna2000/recycleprox/blob/master/src/app/scale/page.tsx"
click node_customers "https://github.com/maduna2000/recycleprox/blob/master/src/app/api/customers/route.ts"
click node_purchases "https://github.com/maduna2000/recycleprox/blob/master/src/app/api/purchases/route.ts"
click node_sales "https://github.com/maduna2000/recycleprox/blob/master/src/app/api/sales/route.ts"
click node_cashup "https://github.com/maduna2000/recycleprox/blob/master/src/app/api/cashup/route.ts"
click node_payments "https://github.com/maduna2000/recycleprox/blob/master/src/app/api/payments/route.ts"
click node_stock "https://github.com/maduna2000/recycleprox/blob/master/src/app/api/stock/on-hand/route.ts"
click node_ledger "https://github.com/maduna2000/recycleprox/blob/master/src/app/api/ledger/profit-loss/route.ts"
click node_scaleorders "https://github.com/maduna2000/recycleprox/blob/master/src/app/api/scale/orders/route.ts"
click node_gate "https://github.com/maduna2000/recycleprox/blob/master/src/app/api/gate/entries/route.ts"
click node_police "https://github.com/maduna2000/recycleprox/blob/master/src/app/api/police-visits/route.ts"
click node_offline "https://github.com/maduna2000/recycleprox/blob/master/src/lib/offline/sync.ts"
click node_auth "https://github.com/maduna2000/recycleprox/blob/master/src/lib/services/authService.ts"
click node_tenant "https://github.com/maduna2000/recycleprox/blob/master/src/lib/db/tenantContext.ts"
click node_database "https://github.com/maduna2000/recycleprox/blob/master/src/lib/db/prisma.ts"
click node_photos "https://github.com/maduna2000/recycleprox/blob/master/src/lib/r2/index.ts"
click node_printing "https://github.com/maduna2000/recycleprox/blob/master/src/app/api/print/slip/route.ts"

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_web,node_mobile,node_guardclient,node_scaleworkspace toneBlue
class node_customers,node_purchases,node_sales toneAmber
class node_cashup,node_payments,node_stock,node_ledger toneMint
class node_scaleorders,node_gate,node_police toneRose
class node_offline,node_auth,node_tenant,node_database,node_photos,node_printing,node_operator toneIndigo
```

## Components

### Clients

- [Web workspace](https://github.com/maduna2000/recycleprox/blob/master/src/app/app/(modules)/layout.tsx): `src/app/app/(modules)/layout.tsx`
- [Mobile clients](https://github.com/maduna2000/recycleprox/blob/master/mobile/app/(operator)/index.tsx): `mobile/app/(operator)/index.tsx`
- [Guard client](https://github.com/maduna2000/recycleprox/blob/master/guard-station/app/(guard)/index.tsx): `guard-station/app/(guard)/index.tsx`
- [Scale workspace](https://github.com/maduna2000/recycleprox/blob/master/src/app/scale/page.tsx): `src/app/scale/page.tsx`

### Commerce

- [Customer records](https://github.com/maduna2000/recycleprox/blob/master/src/app/api/customers/route.ts): `src/app/api/customers/route.ts`
- [Purchases](https://github.com/maduna2000/recycleprox/blob/master/src/app/api/purchases/route.ts): `src/app/api/purchases/route.ts`
- [Sales](https://github.com/maduna2000/recycleprox/blob/master/src/app/api/sales/route.ts): `src/app/api/sales/route.ts`

### Finance and stock

- [Cash-up](https://github.com/maduna2000/recycleprox/blob/master/src/app/api/cashup/route.ts): `src/app/api/cashup/route.ts`
- [Payments and float](https://github.com/maduna2000/recycleprox/blob/master/src/app/api/payments/route.ts): `src/app/api/payments/route.ts`
- [Stock management](https://github.com/maduna2000/recycleprox/blob/master/src/app/api/stock/on-hand/route.ts): `src/app/api/stock/on-hand/route.ts`
- [Ledger and reports](https://github.com/maduna2000/recycleprox/blob/master/src/app/api/ledger/profit-loss/route.ts): `src/app/api/ledger/profit-loss/route.ts`

### Specialist operations

- [Scale orders](https://github.com/maduna2000/recycleprox/blob/master/src/app/api/scale/orders/route.ts): `src/app/api/scale/orders/route.ts`
- [Gate entries](https://github.com/maduna2000/recycleprox/blob/master/src/app/api/gate/entries/route.ts): `src/app/api/gate/entries/route.ts`
- [Police records](https://github.com/maduna2000/recycleprox/blob/master/src/app/api/police-visits/route.ts): `src/app/api/police-visits/route.ts`

### Platform services

- [Offline workflows](https://github.com/maduna2000/recycleprox/blob/master/src/lib/offline/sync.ts): `src/lib/offline/sync.ts`
- [Authentication](https://github.com/maduna2000/recycleprox/blob/master/src/lib/services/authService.ts): `src/lib/services/authService.ts`
- [Tenant context](https://github.com/maduna2000/recycleprox/blob/master/src/lib/db/tenantContext.ts): `src/lib/db/tenantContext.ts`
- [Tenant database](https://github.com/maduna2000/recycleprox/blob/master/src/lib/db/prisma.ts): `src/lib/db/prisma.ts`
- [Photo storage](https://github.com/maduna2000/recycleprox/blob/master/src/lib/r2/index.ts): `src/lib/r2/index.ts`
- [Receipt printing](https://github.com/maduna2000/recycleprox/blob/master/src/app/api/print/slip/route.ts): `src/app/api/print/slip/route.ts`

### Other components

- **Staff operator**

## Connections

- Staff operator → Web workspace: uses
- Staff operator → Mobile clients: uses
- Staff operator → Guard client: uses
- Staff operator → Scale workspace: uses
- Web workspace → Authentication: signs in
- Mobile clients → Authentication: signs in
- Guard client → Gate entries: records visits
- Scale workspace → Scale orders: records orders
- Mobile clients → Scale orders: records orders
- Customer records → Tenant context: runs within
- Customer records → Tenant database: reads and writes
- Customer records → Tenant context: scopes request
- Purchases → Tenant context: scopes request
- Purchases → Tenant database: via service
- Cash-up → Tenant context: scopes request
- Cash-up → Tenant database: via service
- Police records → Tenant context: scopes request
- Police records → Tenant database: via service
- Offline workflows → Tenant database: caches locally
- Offline workflows → Photo storage: uploads photos
- Receipt printing → Tenant database: reads records
