# yrmfernandez/dayong-temporary-system architecture

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

- Interactive diagram: https://gitdiagram.com/yrmfernandez/dayong-temporary-system
- Repository: https://github.com/yrmfernandez/dayong-temporary-system

## Overview

Dayong System is a company-operations web application. The primary clerk workflow is clearing receipts, encoding sales or collections, attaching receipt photos, and submitting remittances for approval. Other documented product areas include member/program administration, finance, staff management, attendance, leave, payroll, reports, MAM, SOA, and dashboards. The graph combines README-described capabilities with the sampled routes and modules; unsampled subsystems are represented by exact paths from the tree, without asserting internal calls that were not shown.

Main entry points: [`app/api`](https://github.com/yrmfernandez/dayong-temporary-system/tree/main/app/api) (API routes), [`app/api/sales/route.ts`](https://github.com/yrmfernandez/dayong-temporary-system/blob/main/app/api/sales/route.ts) (Entry APIs), [`lib/google-sheets-data.ts`](https://github.com/yrmfernandez/dayong-temporary-system/blob/main/lib/google-sheets-data.ts) (Operational data access), [`lib/db.ts`](https://github.com/yrmfernandez/dayong-temporary-system/blob/main/lib/db.ts) (PostgreSQL database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ops["Daily operations"]
  node_clearing["Clearing<br/>[page.tsx]"]
  node_sales["New Sales<br/>[page.tsx]"]
  node_collections["Collections<br/>[page.tsx]"]
  node_entryapi["Entry APIs<br/>[route.ts]"]
  node_collectionapi["Collection API<br/>[route.ts]"]
  node_myentries["My Entries<br/>[page.tsx]"]
  node_photos["Receipt photos<br/>[photo-storage.ts]"]
  node_remit["Remittance approval<br/>[page.tsx]"]
  node_workflow["Remittance workflow"]
end

subgraph group_members["Members and programs"]
  node_members[("Member records<br/>[member-records.ts]")]
  node_programs["Programs<br/>[page.tsx]"]
  node_memberdir["Member directory<br/>[page.tsx]"]
  node_mam["MAM<br/>[page.tsx]"]
  node_soa["Statement of account<br/>[page.tsx]"]
end

subgraph group_finance["Finance and reporting"]
  node_finance["Finance operations"]
  node_reports["Reports and dashboards<br/>[page.tsx]"]
  node_payroll["Payroll<br/>[page.tsx]"]
end

subgraph group_people["People and access"]
  node_employees["Employees and attendance<br/>[employees.ts]"]
  node_attendance["Attendance and leave<br/>[page.tsx]"]
  node_access["Authentication and access<br/>[auth-server.ts]"]
end

subgraph group_platform["Application platform"]
  node_app["Next.js application<br/>[layout.tsx]"]
  node_api["API routes"]
  node_data["Operational data access"]
  node_db[("PostgreSQL database<br/>[db.ts]")]
  node_schema["Database schema<br/>[schema.ts]"]
  node_realtime["Live refresh"]
end

node_clerk(("Operations clerk"))
node_user(("Staff user"))
node_supabase["Supabase Realtime"]

node_clerk -->|"checks receipts"| node_clearing
node_clerk -->|"encodes sales"| node_sales
node_clerk -->|"encodes payments"| node_collections
node_clearing -->|"selects cleared MAS"| node_sales
node_clearing -->|"selects cleared MAS"| node_collections
node_sales -.->|"submits batch"| node_entryapi
node_entryapi -->|"creates records"| node_members
node_entryapi -->|"submits cash"| node_workflow
node_collections -.->|"submits batch"| node_collectionapi
node_collectionapi -->|"submits cash"| node_workflow
node_clerk -->|"adds photos"| node_myentries
node_myentries -.->|"stores photos"| node_photos
node_workflow -->|"routes approval"| node_remit
node_user -.->|"uses"| node_app
node_app -.->|"requests data"| node_api
node_api -->|"checks permissions"| node_access
node_api -.->|"reads and writes"| node_data
node_entryapi -->|"uses data access"| node_data
node_collectionapi -->|"uses data access"| node_data
node_data -->|"queries database"| node_db
node_db -.->|"uses schema"| node_schema
node_programs -.->|"manages programs"| node_api
node_memberdir -.->|"manages members"| node_api
node_mam -.->|"loads MAM data"| node_api
node_soa -.->|"loads statements"| node_api
node_finance -.->|"uses database"| node_db
node_reports -.->|"loads reports"| node_api
node_payroll -.->|"loads payroll data"| node_api
node_employees -->|"queries employees"| node_db
node_attendance -.->|"loads attendance"| node_api
node_app -.->|"refreshes views"| node_realtime
node_realtime -->|"subscribes changes"| node_supabase

click node_clearing "https://github.com/yrmfernandez/dayong-temporary-system/blob/main/app/clearing/page.tsx"
click node_sales "https://github.com/yrmfernandez/dayong-temporary-system/blob/main/app/new-sales/page.tsx"
click node_collections "https://github.com/yrmfernandez/dayong-temporary-system/blob/main/app/collections/page.tsx"
click node_entryapi "https://github.com/yrmfernandez/dayong-temporary-system/blob/main/app/api/sales/route.ts"
click node_collectionapi "https://github.com/yrmfernandez/dayong-temporary-system/blob/main/app/api/collections/route.ts"
click node_myentries "https://github.com/yrmfernandez/dayong-temporary-system/blob/main/app/my-entries/page.tsx"
click node_photos "https://github.com/yrmfernandez/dayong-temporary-system/blob/main/lib/photo-storage.ts"
click node_remit "https://github.com/yrmfernandez/dayong-temporary-system/blob/main/app/remittances/page.tsx"
click node_workflow "https://github.com/yrmfernandez/dayong-temporary-system/blob/main/lib/remittance-workflow.ts"
click node_members "https://github.com/yrmfernandez/dayong-temporary-system/blob/main/lib/member-records.ts"
click node_programs "https://github.com/yrmfernandez/dayong-temporary-system/blob/main/app/programs/page.tsx"
click node_memberdir "https://github.com/yrmfernandez/dayong-temporary-system/blob/main/app/members/page.tsx"
click node_mam "https://github.com/yrmfernandez/dayong-temporary-system/blob/main/app/mam/page.tsx"
click node_soa "https://github.com/yrmfernandez/dayong-temporary-system/blob/main/app/soa/page.tsx"
click node_finance "https://github.com/yrmfernandez/dayong-temporary-system/blob/main/lib/finance-operations.ts"
click node_reports "https://github.com/yrmfernandez/dayong-temporary-system/blob/main/app/reports/page.tsx"
click node_payroll "https://github.com/yrmfernandez/dayong-temporary-system/blob/main/app/payroll/page.tsx"
click node_employees "https://github.com/yrmfernandez/dayong-temporary-system/blob/main/lib/employees.ts"
click node_attendance "https://github.com/yrmfernandez/dayong-temporary-system/blob/main/app/attendance/page.tsx"
click node_access "https://github.com/yrmfernandez/dayong-temporary-system/blob/main/lib/auth-server.ts"
click node_app "https://github.com/yrmfernandez/dayong-temporary-system/blob/main/app/layout.tsx"
click node_api "https://github.com/yrmfernandez/dayong-temporary-system/tree/main/app/api"
click node_data "https://github.com/yrmfernandez/dayong-temporary-system/blob/main/lib/google-sheets-data.ts"
click node_db "https://github.com/yrmfernandez/dayong-temporary-system/blob/main/lib/db.ts"
click node_schema "https://github.com/yrmfernandez/dayong-temporary-system/blob/main/db/schema.ts"
click node_realtime "https://github.com/yrmfernandez/dayong-temporary-system/blob/main/lib/use-live-refresh.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_clearing,node_sales,node_collections,node_entryapi,node_collectionapi,node_myentries,node_photos,node_remit,node_workflow,node_user toneBlue
class node_members,node_programs,node_memberdir,node_mam,node_soa toneAmber
class node_finance,node_reports,node_payroll toneMint
class node_employees,node_attendance,node_access toneRose
class node_app,node_api,node_data,node_db,node_schema,node_realtime,node_clerk,node_supabase toneIndigo
```

## Components

### Daily operations

- [Clearing](https://github.com/yrmfernandez/dayong-temporary-system/blob/main/app/clearing/page.tsx): `app/clearing/page.tsx`
- [New Sales](https://github.com/yrmfernandez/dayong-temporary-system/blob/main/app/new-sales/page.tsx): `app/new-sales/page.tsx`
- [Collections](https://github.com/yrmfernandez/dayong-temporary-system/blob/main/app/collections/page.tsx): `app/collections/page.tsx`
- [Entry APIs](https://github.com/yrmfernandez/dayong-temporary-system/blob/main/app/api/sales/route.ts): `app/api/sales/route.ts`
- [Collection API](https://github.com/yrmfernandez/dayong-temporary-system/blob/main/app/api/collections/route.ts): `app/api/collections/route.ts`
- [My Entries](https://github.com/yrmfernandez/dayong-temporary-system/blob/main/app/my-entries/page.tsx): `app/my-entries/page.tsx`
- [Receipt photos](https://github.com/yrmfernandez/dayong-temporary-system/blob/main/lib/photo-storage.ts): `lib/photo-storage.ts`
- [Remittance approval](https://github.com/yrmfernandez/dayong-temporary-system/blob/main/app/remittances/page.tsx): `app/remittances/page.tsx`
- [Remittance workflow](https://github.com/yrmfernandez/dayong-temporary-system/blob/main/lib/remittance-workflow.ts): `lib/remittance-workflow.ts`

### Members and programs

- [Member records](https://github.com/yrmfernandez/dayong-temporary-system/blob/main/lib/member-records.ts): `lib/member-records.ts`
- [Programs](https://github.com/yrmfernandez/dayong-temporary-system/blob/main/app/programs/page.tsx): `app/programs/page.tsx`
- [Member directory](https://github.com/yrmfernandez/dayong-temporary-system/blob/main/app/members/page.tsx): `app/members/page.tsx`
- [MAM](https://github.com/yrmfernandez/dayong-temporary-system/blob/main/app/mam/page.tsx): `app/mam/page.tsx`
- [Statement of account](https://github.com/yrmfernandez/dayong-temporary-system/blob/main/app/soa/page.tsx): `app/soa/page.tsx`

### Finance and reporting

- [Finance operations](https://github.com/yrmfernandez/dayong-temporary-system/blob/main/lib/finance-operations.ts): `lib/finance-operations.ts`
- [Reports and dashboards](https://github.com/yrmfernandez/dayong-temporary-system/blob/main/app/reports/page.tsx): `app/reports/page.tsx`
- [Payroll](https://github.com/yrmfernandez/dayong-temporary-system/blob/main/app/payroll/page.tsx): `app/payroll/page.tsx`

### People and access

- [Employees and attendance](https://github.com/yrmfernandez/dayong-temporary-system/blob/main/lib/employees.ts): `lib/employees.ts`
- [Attendance and leave](https://github.com/yrmfernandez/dayong-temporary-system/blob/main/app/attendance/page.tsx): `app/attendance/page.tsx`
- [Authentication and access](https://github.com/yrmfernandez/dayong-temporary-system/blob/main/lib/auth-server.ts): `lib/auth-server.ts`

### Application platform

- [Next.js application](https://github.com/yrmfernandez/dayong-temporary-system/blob/main/app/layout.tsx): `app/layout.tsx`
- [API routes](https://github.com/yrmfernandez/dayong-temporary-system/tree/main/app/api): `app/api`
- [Operational data access](https://github.com/yrmfernandez/dayong-temporary-system/blob/main/lib/google-sheets-data.ts): `lib/google-sheets-data.ts`
- [PostgreSQL database](https://github.com/yrmfernandez/dayong-temporary-system/blob/main/lib/db.ts): `lib/db.ts`
- [Database schema](https://github.com/yrmfernandez/dayong-temporary-system/blob/main/db/schema.ts): `db/schema.ts`
- [Live refresh](https://github.com/yrmfernandez/dayong-temporary-system/blob/main/lib/use-live-refresh.ts): `lib/use-live-refresh.ts`

### Other components

- **Operations clerk**
- **Staff user**
- **Supabase Realtime**

## Connections

- Operations clerk → Clearing: checks receipts (evidence: `README.md`)
- Operations clerk → New Sales: encodes sales (evidence: `README.md`)
- Operations clerk → Collections: encodes payments (evidence: `README.md`)
- Clearing → New Sales: selects cleared MAS (evidence: `README.md`)
- Clearing → Collections: selects cleared MAS (evidence: `README.md`)
- New Sales → Entry APIs: submits batch
- Entry APIs → Member records: creates records (evidence: `app/api/sales/route.ts`)
- Entry APIs → Remittance workflow: submits cash (evidence: `app/api/sales/route.ts`)
- Collections → Collection API: submits batch
- Collection API → Remittance workflow: submits cash (evidence: `app/api/collections/route.ts`)
- Operations clerk → My Entries: adds photos (evidence: `README.md`)
- My Entries → Receipt photos: stores photos
- Remittance workflow → Remittance approval: routes approval (evidence: `README.md`)
- Staff user → Next.js application: uses
- Next.js application → API routes: requests data
- API routes → Authentication and access: checks permissions (evidence: `lib/auth-server.ts`)
- API routes → Operational data access: reads and writes (evidence: `app/api/sales/route.ts`)
- Entry APIs → Operational data access: uses data access (evidence: `app/api/sales/route.ts`)
- Collection API → Operational data access: uses data access (evidence: `app/api/collections/route.ts`)
- Operational data access → PostgreSQL database: queries database (evidence: `lib/google-sheets-data.ts`)
- PostgreSQL database → Database schema: uses schema
- Programs → API routes: manages programs
- Member directory → API routes: manages members
- MAM → API routes: loads MAM data
- Statement of account → API routes: loads statements
- Finance operations → PostgreSQL database: uses database
- Reports and dashboards → API routes: loads reports
- Payroll → API routes: loads payroll data
- Employees and attendance → PostgreSQL database: queries employees (evidence: `lib/employees.ts`)
- Attendance and leave → API routes: loads attendance
- Next.js application → Live refresh: refreshes views
- Live refresh → Supabase Realtime: subscribes changes (evidence: `lib/use-live-refresh.ts`)
