# fotatoe24/dormvision architecture

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

- Interactive diagram: https://gitdiagram.com/fotatoe24/dormvision
- Repository: https://github.com/fotatoe24/dormvision

## Overview

DormVision is a multi-role dormitory management and accounting application. Owners manage rooms, tenant approvals, billing, payments, expenses and financial monitoring; tenants view bills/history and report payments with proof. Custom application sessions and explicit authorization mediate access to Supabase. The graph covers major README capabilities, plus platform administration and scheduled reminders. Some routes and domain implementations were not sampled, so documented capabilities are included but uncertain implementation links are omitted.

Main entry points: [`app/api/payments/report/route.ts`](https://github.com/fotatoe24/dormvision/blob/main/app/api/payments/report/route.ts) (Payment reporting), [`lib/auth.ts`](https://github.com/fotatoe24/dormvision/blob/main/lib/auth.ts) (Session authorization), [`app/tenant/page.tsx`](https://github.com/fotatoe24/dormvision/blob/main/app/tenant/page.tsx) (Tenant dashboard), [`app/tenant/billing/page.tsx`](https://github.com/fotatoe24/dormvision/blob/main/app/tenant/billing/page.tsx) (Tenant billing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and accounts"]
  node_login["Login and signup<br/>[page.tsx]"]
  node_account_actions["Account actions<br/>[actions.ts]"]
  node_session_auth["Session authorization<br/>[auth.ts]"]
  node_session_store["Revocable sessions<br/>[session-store.ts]"]
end

subgraph group_dorm["Dorm operations"]
  node_tenant_home["Tenant dashboard<br/>[page.tsx]"]
  node_tenant_status["Registration status<br/>[tenant-status.ts]"]
  node_rooms["Room management<br/>[page.tsx]"]
  node_requests["Tenant approvals<br/>[page.tsx]"]
end

subgraph group_finance["Billing and finance"]
  node_tenant_history["Tenant billing history<br/>[page.tsx]"]
  node_tenant_billing["Tenant billing<br/>[page.tsx]"]
  node_payment_report["Payment reporting<br/>[route.ts]"]
  node_admin_billing["Bill management<br/>[page.tsx]"]
  node_payments["Payment review<br/>[page.tsx]"]
  node_expenses["Income and expenses<br/>[page.tsx]"]
  node_monitoring["Financial monitoring<br/>[page.tsx]"]
  node_dashboard["Owner overview<br/>[page.tsx]"]
  node_invoice["Invoice viewing and PDF<br/>[page.tsx]"]
  node_receipt["Receipt viewing and PDF<br/>[page.tsx]"]
end

subgraph group_oversight["Platform oversight"]
  node_platform_pages["Platform administration<br/>[page.tsx]"]
  node_platform_actions["Platform account actions"]
end

subgraph group_runtime["Application services"]
  node_daily_job["Daily billing reminders<br/>[route.ts]"]
  node_late_fees["Late-fee processing<br/>[late-fees.ts]"]
  node_billing_rules["Billing calculations<br/>[billing.ts]"]
  node_data_client["Database client<br/>[admin.ts]"]
  node_database[("Supabase PostgreSQL")]
  node_mailer["Email delivery<br/>[reminder-emails.ts]"]
end

node_owner(("Dorm owner"))
node_tenant(("Tenant"))
node_platform_admin(("Platform administrator"))

node_owner -->|"signs in"| node_login
node_tenant -->|"signs in"| node_login
node_login -->|"submits credentials"| node_account_actions
node_account_actions -->|"issues session"| node_session_auth
node_session_auth -->|"records and checks"| node_session_store
node_session_auth -->|"creates client"| node_data_client
node_tenant -->|"views account"| node_tenant_home
node_tenant_home -->|"checks approval"| node_tenant_status
node_owner -->|"manages rooms"| node_rooms
node_owner -->|"approves registrations"| node_requests
node_tenant -->|"views bills"| node_tenant_billing
node_tenant -->|"views history"| node_tenant_history
node_tenant_billing -->|"submits payment report"| node_payment_report
node_payment_report -->|"checks tenancy"| node_tenant_status
node_payment_report -->|"writes payment"| node_data_client
node_owner -->|"manages bills"| node_admin_billing
node_owner -->|"reviews payments"| node_payments
node_owner -->|"records expenses"| node_expenses
node_owner -->|"monitors finances"| node_monitoring
node_owner -->|"views overview"| node_dashboard
node_dashboard -->|"applies fees"| node_late_fees
node_dashboard -->|"formats bill status"| node_billing_rules
node_tenant_home -->|"applies fees"| node_late_fees
node_tenant_billing -->|"uses billing rules"| node_billing_rules
node_tenant -->|"views invoice"| node_invoice
node_tenant -.->|"views receipt"| node_receipt
node_daily_job -->|"applies fees"| node_late_fees
node_daily_job -->|"sends reminders"| node_mailer
node_platform_admin -->|"administers platform"| node_platform_pages
node_platform_pages -->|"uses account actions"| node_platform_actions
node_data_client -->|"connects to"| node_database
node_session_store -->|"reads and writes sessions"| node_database
node_payment_report -->|"stores report and proof"| node_database

click node_login "https://github.com/fotatoe24/dormvision/blob/main/app/login/page.tsx"
click node_account_actions "https://github.com/fotatoe24/dormvision/blob/main/lib/actions.ts"
click node_session_auth "https://github.com/fotatoe24/dormvision/blob/main/lib/auth.ts"
click node_session_store "https://github.com/fotatoe24/dormvision/blob/main/lib/session-store.ts"
click node_tenant_home "https://github.com/fotatoe24/dormvision/blob/main/app/tenant/page.tsx"
click node_tenant_status "https://github.com/fotatoe24/dormvision/blob/main/lib/tenant-status.ts"
click node_rooms "https://github.com/fotatoe24/dormvision/blob/main/app/admin/rooms/page.tsx"
click node_requests "https://github.com/fotatoe24/dormvision/blob/main/app/admin/tenant-requests/page.tsx"
click node_tenant_history "https://github.com/fotatoe24/dormvision/blob/main/app/tenant/history/page.tsx"
click node_tenant_billing "https://github.com/fotatoe24/dormvision/blob/main/app/tenant/billing/page.tsx"
click node_payment_report "https://github.com/fotatoe24/dormvision/blob/main/app/api/payments/report/route.ts"
click node_admin_billing "https://github.com/fotatoe24/dormvision/blob/main/app/admin/billing/page.tsx"
click node_payments "https://github.com/fotatoe24/dormvision/blob/main/app/admin/payments/page.tsx"
click node_expenses "https://github.com/fotatoe24/dormvision/blob/main/app/admin/expenses/page.tsx"
click node_monitoring "https://github.com/fotatoe24/dormvision/blob/main/app/admin/monitoring/page.tsx"
click node_dashboard "https://github.com/fotatoe24/dormvision/blob/main/app/admin/page.tsx"
click node_invoice "https://github.com/fotatoe24/dormvision/blob/main/app/invoices/%5Bid%5D/page.tsx"
click node_receipt "https://github.com/fotatoe24/dormvision/blob/main/app/receipts/%5Bid%5D/page.tsx"
click node_daily_job "https://github.com/fotatoe24/dormvision/blob/main/app/api/cron/daily/route.ts"
click node_late_fees "https://github.com/fotatoe24/dormvision/blob/main/lib/late-fees.ts"
click node_billing_rules "https://github.com/fotatoe24/dormvision/blob/main/lib/billing.ts"
click node_data_client "https://github.com/fotatoe24/dormvision/blob/main/lib/supabase/admin.ts"
click node_platform_pages "https://github.com/fotatoe24/dormvision/blob/main/app/platform/page.tsx"
click node_platform_actions "https://github.com/fotatoe24/dormvision/blob/main/lib/platform-actions.ts"
click node_mailer "https://github.com/fotatoe24/dormvision/blob/main/lib/reminder-emails.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_login,node_account_actions,node_session_auth,node_session_store toneBlue
class node_tenant_home,node_tenant_status,node_rooms,node_requests toneAmber
class node_tenant_history,node_tenant_billing,node_payment_report,node_admin_billing,node_payments,node_expenses,node_monitoring,node_dashboard,node_invoice,node_receipt toneMint
class node_platform_pages,node_platform_actions toneRose
class node_daily_job,node_late_fees,node_billing_rules,node_data_client,node_database,node_mailer,node_owner,node_tenant,node_platform_admin toneIndigo
```

## Components

### Access and accounts

- [Login and signup](https://github.com/fotatoe24/dormvision/blob/main/app/login/page.tsx): `app/login/page.tsx`
- [Account actions](https://github.com/fotatoe24/dormvision/blob/main/lib/actions.ts): `lib/actions.ts`
- [Session authorization](https://github.com/fotatoe24/dormvision/blob/main/lib/auth.ts): `lib/auth.ts`
- [Revocable sessions](https://github.com/fotatoe24/dormvision/blob/main/lib/session-store.ts): `lib/session-store.ts`

### Dorm operations

- [Tenant dashboard](https://github.com/fotatoe24/dormvision/blob/main/app/tenant/page.tsx): `app/tenant/page.tsx`
- [Registration status](https://github.com/fotatoe24/dormvision/blob/main/lib/tenant-status.ts): `lib/tenant-status.ts`
- [Room management](https://github.com/fotatoe24/dormvision/blob/main/app/admin/rooms/page.tsx): `app/admin/rooms/page.tsx`
- [Tenant approvals](https://github.com/fotatoe24/dormvision/blob/main/app/admin/tenant-requests/page.tsx): `app/admin/tenant-requests/page.tsx`

### Billing and finance

- [Tenant billing history](https://github.com/fotatoe24/dormvision/blob/main/app/tenant/history/page.tsx): `app/tenant/history/page.tsx`
- [Tenant billing](https://github.com/fotatoe24/dormvision/blob/main/app/tenant/billing/page.tsx): `app/tenant/billing/page.tsx`
- [Payment reporting](https://github.com/fotatoe24/dormvision/blob/main/app/api/payments/report/route.ts): `app/api/payments/report/route.ts`
- [Bill management](https://github.com/fotatoe24/dormvision/blob/main/app/admin/billing/page.tsx): `app/admin/billing/page.tsx`
- [Payment review](https://github.com/fotatoe24/dormvision/blob/main/app/admin/payments/page.tsx): `app/admin/payments/page.tsx`
- [Income and expenses](https://github.com/fotatoe24/dormvision/blob/main/app/admin/expenses/page.tsx): `app/admin/expenses/page.tsx`
- [Financial monitoring](https://github.com/fotatoe24/dormvision/blob/main/app/admin/monitoring/page.tsx): `app/admin/monitoring/page.tsx`
- [Owner overview](https://github.com/fotatoe24/dormvision/blob/main/app/admin/page.tsx): `app/admin/page.tsx`
- [Invoice viewing and PDF](https://github.com/fotatoe24/dormvision/blob/main/app/invoices/%5Bid%5D/page.tsx): `app/invoices/[id]/page.tsx`
- [Receipt viewing and PDF](https://github.com/fotatoe24/dormvision/blob/main/app/receipts/%5Bid%5D/page.tsx): `app/receipts/[id]/page.tsx`

### Platform oversight

- [Platform administration](https://github.com/fotatoe24/dormvision/blob/main/app/platform/page.tsx): `app/platform/page.tsx`
- [Platform account actions](https://github.com/fotatoe24/dormvision/blob/main/lib/platform-actions.ts): `lib/platform-actions.ts`

### Application services

- [Daily billing reminders](https://github.com/fotatoe24/dormvision/blob/main/app/api/cron/daily/route.ts): `app/api/cron/daily/route.ts`
- [Late-fee processing](https://github.com/fotatoe24/dormvision/blob/main/lib/late-fees.ts): `lib/late-fees.ts`
- [Billing calculations](https://github.com/fotatoe24/dormvision/blob/main/lib/billing.ts): `lib/billing.ts`
- [Database client](https://github.com/fotatoe24/dormvision/blob/main/lib/supabase/admin.ts): `lib/supabase/admin.ts`
- **Supabase PostgreSQL**
- [Email delivery](https://github.com/fotatoe24/dormvision/blob/main/lib/reminder-emails.ts): `lib/reminder-emails.ts`

### Other components

- **Dorm owner**
- **Tenant**
- **Platform administrator**

## Connections

- Dorm owner → Login and signup: signs in
- Tenant → Login and signup: signs in
- Login and signup → Account actions: submits credentials
- Account actions → Session authorization: issues session (evidence: `lib/actions.ts`)
- Session authorization → Revocable sessions: records and checks (evidence: `lib/auth.ts`)
- Session authorization → Database client: creates client (evidence: `lib/auth.ts`)
- Tenant → Tenant dashboard: views account
- Tenant dashboard → Registration status: checks approval (evidence: `app/tenant/page.tsx`)
- Dorm owner → Room management: manages rooms
- Dorm owner → Tenant approvals: approves registrations
- Tenant → Tenant billing: views bills
- Tenant → Tenant billing history: views history
- Tenant billing → Payment reporting: submits payment report
- Payment reporting → Registration status: checks tenancy (evidence: `app/api/payments/report/route.ts`)
- Payment reporting → Database client: writes payment (evidence: `app/api/payments/report/route.ts`)
- Dorm owner → Bill management: manages bills
- Dorm owner → Payment review: reviews payments
- Dorm owner → Income and expenses: records expenses
- Dorm owner → Financial monitoring: monitors finances
- Dorm owner → Owner overview: views overview
- Owner overview → Late-fee processing: applies fees (evidence: `app/admin/page.tsx`)
- Owner overview → Billing calculations: formats bill status (evidence: `app/admin/page.tsx`)
- Tenant dashboard → Late-fee processing: applies fees (evidence: `app/tenant/page.tsx`)
- Tenant billing → Billing calculations: uses billing rules (evidence: `app/tenant/billing/page.tsx`)
- Tenant → Invoice viewing and PDF: views invoice
- Tenant → Receipt viewing and PDF: views receipt
- Daily billing reminders → Late-fee processing: applies fees (evidence: `app/api/cron/daily/route.ts`)
- Daily billing reminders → Email delivery: sends reminders (evidence: `app/api/cron/daily/route.ts`)
- Platform administrator → Platform administration: administers platform
- Platform administration → Platform account actions: uses account actions
- Database client → Supabase PostgreSQL: connects to
- Revocable sessions → Supabase PostgreSQL: reads and writes sessions (evidence: `lib/session-store.ts`)
- Payment reporting → Supabase PostgreSQL: stores report and proof (evidence: `app/api/payments/report/route.ts`)
