# helmirosli/dr2-community-app architecture

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

- Interactive diagram: https://gitdiagram.com/helmirosli/dr2-community-app
- Repository: https://github.com/helmirosli/dr2-community-app

## Overview

DR2 Community Resident Fee System manages a resident inventory, monthly and special-collection payments, public payment submissions for staff review, and reports. The primary workflow is resident payment entry or public submission, followed by review and approval where applicable, coverage accounting, and reporting/export. The graph also includes resident/tenant/vehicle management, uploads, authentication, and user settings. Some routes and action implementations were not sampled; those links are omitted or marked unverified rather than inferred from names.

Main entry points: [`lib/prisma.ts`](https://github.com/helmirosli/dr2-community-app/blob/main/lib/prisma.ts) (Application Database), [`lib/reports/monthly-data.ts`](https://github.com/helmirosli/dr2-community-app/blob/main/lib/reports/monthly-data.ts) (Monthly Report Data), [`lib/actions/review-submissions.ts`](https://github.com/helmirosli/dr2-community-app/blob/main/lib/actions/review-submissions.ts) (Submission Review), [`lib/reports/year-grid-data.ts`](https://github.com/helmirosli/dr2-community-app/blob/main/lib/reports/year-grid-data.ts) (Year Grid Data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and UI"]
  node_dashboard["Review Dashboard<br/>[page.tsx]"]
  node_login["Login<br/>[login-form.tsx]"]
end

subgraph group_residents["Resident Records"]
  node_resident_inventory["Resident Inventory"]
  node_tenant_vehicle["Tenants and Vehicles"]
end

subgraph group_payments["Payments and Review"]
  node_payment_form["Payment Entry<br/>[payment-form.tsx]"]
  node_payment_list["Payment Ledger<br/>[page.tsx]"]
  node_public_form["Public Submission"]
  node_review_actions["Submission Review"]
  node_special_collections["Special Collections"]
end

subgraph group_reports["Reports and Files"]
  node_monthly_report["Monthly Report Data<br/>[monthly-data.ts]"]
  node_report_logic["Report Calculations<br/>[monthly.ts]"]
  node_year_grid["Year Grid Data<br/>[year-grid-data.ts]"]
  node_exporters["PDF and Excel Export<br/>[exporters.ts]"]
  node_report_routes["Report Export Routes"]
  node_public_status["Public Status View<br/>[page.tsx]"]
  node_file_viewer["Receipt Viewer<br/>[file-viewer.tsx]"]
  node_upload_routes["Upload Route<br/>[route.ts]"]
  node_uploads["Upload Helpers<br/>[uploads.ts]"]
end

subgraph group_core["Shared Services"]
  node_auth["Session and Authorization<br/>[auth.ts]"]
  node_database[("Application Database<br/>[prisma.ts]")]
  node_coverage["Coverage Accounting<br/>[coverage.ts]"]
  node_months["Month Utilities<br/>[months.ts]"]
  node_money["Money Utilities<br/>[money.ts]"]
  node_i18n["Localization<br/>[context.tsx]"]
  node_user_management["User Management<br/>[user-management.ts]"]
end

node_staff(("Admin / AJK"))
node_resident(("Resident"))

node_resident -->|"submits details"| node_public_form
node_public_form -->|"creates pending submission"| node_review_actions
node_staff -->|"reviews queue"| node_dashboard
node_dashboard -->|"approves or rejects"| node_review_actions
node_review_actions -->|"writes payment"| node_database
node_review_actions -->|"builds coverage rows"| node_coverage
node_coverage -->|"uses month ranges"| node_months
node_coverage -->|"uses fee values"| node_money
node_staff -->|"records payment"| node_payment_form
node_payment_form -.->|"saves payment"| node_database
node_payment_form -.->|"accounts month coverage"| node_coverage
node_staff -->|"manages residents"| node_resident_inventory
node_resident_inventory -->|"reads resident records"| node_database
node_staff -.->|"manages household records"| node_tenant_vehicle
node_staff -->|"tracks extra payments"| node_special_collections
node_special_collections -->|"reads collection data"| node_database
node_payment_list -->|"reads payment records"| node_database
node_payment_list -->|"renders receipts"| node_file_viewer
node_dashboard -->|"renders submission files"| node_file_viewer
node_public_form -->|"uses locale context"| node_i18n
node_staff -->|"requests report"| node_monthly_report
node_monthly_report -->|"queries report inputs"| node_database
node_monthly_report -->|"builds report"| node_report_logic
node_report_routes -->|"loads monthly data"| node_monthly_report
node_report_routes -->|"loads annual data"| node_year_grid
node_report_routes -->|"builds PDF or Excel"| node_exporters
node_exporters -->|"uses report types"| node_report_logic
node_public_status -->|"reads report data"| node_monthly_report
node_public_status -->|"reads annual data"| node_year_grid
node_upload_routes -->|"dispatches file request"| node_uploads
node_login -->|"sets session"| node_auth
node_auth -->|"looks up user"| node_database
node_staff -.->|"manages accounts"| node_user_management
node_user_management -.->|"updates user records"| node_database
node_monthly_report -->|"uses fee values"| node_money
node_year_grid -->|"queries annual inputs"| node_database
node_year_grid -->|"normalizes coverage"| node_report_logic

click node_dashboard "https://github.com/helmirosli/dr2-community-app/blob/main/app/dashboard/page.tsx"
click node_login "https://github.com/helmirosli/dr2-community-app/blob/main/app/login/login-form.tsx"
click node_resident_inventory "https://github.com/helmirosli/dr2-community-app/tree/main/app/residents"
click node_tenant_vehicle "https://github.com/helmirosli/dr2-community-app/tree/main/app/residents"
click node_payment_form "https://github.com/helmirosli/dr2-community-app/blob/main/app/payments/payment-form.tsx"
click node_payment_list "https://github.com/helmirosli/dr2-community-app/blob/main/app/payments/page.tsx"
click node_public_form "https://github.com/helmirosli/dr2-community-app/blob/main/app/(public)/submit/submit-payment-form.tsx"
click node_review_actions "https://github.com/helmirosli/dr2-community-app/blob/main/lib/actions/review-submissions.ts"
click node_special_collections "https://github.com/helmirosli/dr2-community-app/tree/main/app/special-collections"
click node_monthly_report "https://github.com/helmirosli/dr2-community-app/blob/main/lib/reports/monthly-data.ts"
click node_report_logic "https://github.com/helmirosli/dr2-community-app/blob/main/lib/reports/monthly.ts"
click node_year_grid "https://github.com/helmirosli/dr2-community-app/blob/main/lib/reports/year-grid-data.ts"
click node_exporters "https://github.com/helmirosli/dr2-community-app/blob/main/lib/reports/exporters.ts"
click node_report_routes "https://github.com/helmirosli/dr2-community-app/tree/main/app/reports"
click node_public_status "https://github.com/helmirosli/dr2-community-app/blob/main/app/(public)/status/page.tsx"
click node_file_viewer "https://github.com/helmirosli/dr2-community-app/blob/main/app/components/file-viewer.tsx"
click node_upload_routes "https://github.com/helmirosli/dr2-community-app/blob/main/app/api/uploads/%5B...path%5D/route.ts"
click node_uploads "https://github.com/helmirosli/dr2-community-app/blob/main/lib/uploads.ts"
click node_auth "https://github.com/helmirosli/dr2-community-app/blob/main/lib/auth.ts"
click node_database "https://github.com/helmirosli/dr2-community-app/blob/main/lib/prisma.ts"
click node_coverage "https://github.com/helmirosli/dr2-community-app/blob/main/lib/payments/coverage.ts"
click node_months "https://github.com/helmirosli/dr2-community-app/blob/main/lib/months.ts"
click node_money "https://github.com/helmirosli/dr2-community-app/blob/main/lib/money.ts"
click node_i18n "https://github.com/helmirosli/dr2-community-app/blob/main/lib/i18n/context.tsx"
click node_user_management "https://github.com/helmirosli/dr2-community-app/blob/main/lib/actions/user-management.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_dashboard,node_login toneBlue
class node_resident_inventory,node_tenant_vehicle toneAmber
class node_payment_form,node_payment_list,node_public_form,node_review_actions,node_special_collections toneMint
class node_monthly_report,node_report_logic,node_year_grid,node_exporters,node_report_routes,node_public_status,node_file_viewer,node_upload_routes,node_uploads toneRose
class node_auth,node_database,node_coverage,node_months,node_money,node_i18n,node_user_management,node_staff,node_resident toneIndigo
```

## Components

### Access and UI

- [Review Dashboard](https://github.com/helmirosli/dr2-community-app/blob/main/app/dashboard/page.tsx): `app/dashboard/page.tsx`
- [Login](https://github.com/helmirosli/dr2-community-app/blob/main/app/login/login-form.tsx): `app/login/login-form.tsx`

### Resident Records

- [Resident Inventory](https://github.com/helmirosli/dr2-community-app/tree/main/app/residents): `app/residents`
- [Tenants and Vehicles](https://github.com/helmirosli/dr2-community-app/tree/main/app/residents): `app/residents`

### Payments and Review

- [Payment Entry](https://github.com/helmirosli/dr2-community-app/blob/main/app/payments/payment-form.tsx): `app/payments/payment-form.tsx`
- [Payment Ledger](https://github.com/helmirosli/dr2-community-app/blob/main/app/payments/page.tsx): `app/payments/page.tsx`
- [Public Submission](https://github.com/helmirosli/dr2-community-app/blob/main/app/(public)/submit/submit-payment-form.tsx): `app/(public)/submit/submit-payment-form.tsx`
- [Submission Review](https://github.com/helmirosli/dr2-community-app/blob/main/lib/actions/review-submissions.ts): `lib/actions/review-submissions.ts`
- [Special Collections](https://github.com/helmirosli/dr2-community-app/tree/main/app/special-collections): `app/special-collections`

### Reports and Files

- [Monthly Report Data](https://github.com/helmirosli/dr2-community-app/blob/main/lib/reports/monthly-data.ts): `lib/reports/monthly-data.ts`
- [Report Calculations](https://github.com/helmirosli/dr2-community-app/blob/main/lib/reports/monthly.ts): `lib/reports/monthly.ts`
- [Year Grid Data](https://github.com/helmirosli/dr2-community-app/blob/main/lib/reports/year-grid-data.ts): `lib/reports/year-grid-data.ts`
- [PDF and Excel Export](https://github.com/helmirosli/dr2-community-app/blob/main/lib/reports/exporters.ts): `lib/reports/exporters.ts`
- [Report Export Routes](https://github.com/helmirosli/dr2-community-app/tree/main/app/reports): `app/reports`
- [Public Status View](https://github.com/helmirosli/dr2-community-app/blob/main/app/(public)/status/page.tsx): `app/(public)/status/page.tsx`
- [Receipt Viewer](https://github.com/helmirosli/dr2-community-app/blob/main/app/components/file-viewer.tsx): `app/components/file-viewer.tsx`
- [Upload Route](https://github.com/helmirosli/dr2-community-app/blob/main/app/api/uploads/%5B...path%5D/route.ts): `app/api/uploads/[...path]/route.ts`
- [Upload Helpers](https://github.com/helmirosli/dr2-community-app/blob/main/lib/uploads.ts): `lib/uploads.ts`

### Shared Services

- [Session and Authorization](https://github.com/helmirosli/dr2-community-app/blob/main/lib/auth.ts): `lib/auth.ts`
- [Application Database](https://github.com/helmirosli/dr2-community-app/blob/main/lib/prisma.ts): `lib/prisma.ts`
- [Coverage Accounting](https://github.com/helmirosli/dr2-community-app/blob/main/lib/payments/coverage.ts): `lib/payments/coverage.ts`
- [Month Utilities](https://github.com/helmirosli/dr2-community-app/blob/main/lib/months.ts): `lib/months.ts`
- [Money Utilities](https://github.com/helmirosli/dr2-community-app/blob/main/lib/money.ts): `lib/money.ts`
- [Localization](https://github.com/helmirosli/dr2-community-app/blob/main/lib/i18n/context.tsx): `lib/i18n/context.tsx`
- [User Management](https://github.com/helmirosli/dr2-community-app/blob/main/lib/actions/user-management.ts): `lib/actions/user-management.ts`

### Other components

- **Admin / AJK**
- **Resident**

## Connections

- Resident → Public Submission: submits details (evidence: `README.md`)
- Public Submission → Submission Review: creates pending submission (evidence: `app/(public)/submit/submit-payment-form.tsx`)
- Admin / AJK → Review Dashboard: reviews queue (evidence: `app/dashboard/page.tsx`)
- Review Dashboard → Submission Review: approves or rejects (evidence: `app/dashboard/page.tsx`)
- Submission Review → Application Database: writes payment (evidence: `lib/actions/review-submissions.ts`)
- Submission Review → Coverage Accounting: builds coverage rows (evidence: `lib/actions/review-submissions.ts`)
- Coverage Accounting → Month Utilities: uses month ranges (evidence: `lib/payments/coverage.ts`)
- Coverage Accounting → Money Utilities: uses fee values (evidence: `lib/payments/coverage.ts`)
- Admin / AJK → Payment Entry: records payment (evidence: `README.md`)
- Payment Entry → Application Database: saves payment
- Payment Entry → Coverage Accounting: accounts month coverage
- Admin / AJK → Resident Inventory: manages residents (evidence: `README.md`)
- Resident Inventory → Application Database: reads resident records (evidence: `app/residents/page.tsx`)
- Admin / AJK → Tenants and Vehicles: manages household records
- Admin / AJK → Special Collections: tracks extra payments (evidence: `README.md`)
- Special Collections → Application Database: reads collection data (evidence: `app/special-collections/page.tsx`)
- Payment Ledger → Application Database: reads payment records (evidence: `app/payments/page.tsx`)
- Payment Ledger → Receipt Viewer: renders receipts (evidence: `app/payments/page.tsx`)
- Review Dashboard → Receipt Viewer: renders submission files (evidence: `app/dashboard/page.tsx`)
- Public Submission → Localization: uses locale context (evidence: `app/(public)/submit/submit-payment-form.tsx`)
- Admin / AJK → Monthly Report Data: requests report (evidence: `README.md`)
- Monthly Report Data → Application Database: queries report inputs (evidence: `lib/reports/monthly-data.ts`)
- Monthly Report Data → Report Calculations: builds report (evidence: `lib/reports/monthly-data.ts`)
- Report Export Routes → Monthly Report Data: loads monthly data (evidence: `app/reports/monthly.xlsx/route.ts`)
- Report Export Routes → Year Grid Data: loads annual data (evidence: `app/reports/yearly.pdf/route.ts`)
- Report Export Routes → PDF and Excel Export: builds PDF or Excel (evidence: `app/reports/monthly.xlsx/route.ts`)
- PDF and Excel Export → Report Calculations: uses report types (evidence: `lib/reports/exporters.ts`)
- Public Status View → Monthly Report Data: reads report data (evidence: `app/(public)/status/page.tsx`)
- Public Status View → Year Grid Data: reads annual data (evidence: `app/(public)/status/page.tsx`)
- Upload Route → Upload Helpers: dispatches file request (evidence: `app/api/uploads/[...path]/route.ts`)
- Login → Session and Authorization: sets session (evidence: `app/login/login-form.tsx`)
- Session and Authorization → Application Database: looks up user (evidence: `lib/auth.ts`)
- Admin / AJK → User Management: manages accounts
- User Management → Application Database: updates user records
- Monthly Report Data → Money Utilities: uses fee values (evidence: `lib/reports/monthly-data.ts`)
- Year Grid Data → Application Database: queries annual inputs (evidence: `lib/reports/year-grid-data.ts`)
- Year Grid Data → Report Calculations: normalizes coverage (evidence: `lib/reports/year-grid-data.ts`)
