# kraamecnal/boarding-house architecture

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

- Interactive diagram: https://gitdiagram.com/kraamecnal/boarding-house
- Repository: https://github.com/kraamecnal/boarding-house

## Overview

InKeeper is a property-management app for boarding-house owners. The main workflow is owner sign-in, house and room management, tenant and tenancy registration, then monthly billing and payment tracking. Supporting capabilities include meter readings and tenant-document storage, owner notifications and optional push, and server-side bill-reminder email. The graph combines sampled code references with README-documented behavior; unsampled screens and database-side wiring are represented only where the README supports the relationship.

Main entry points: [`src/utils/supabase.ts`](https://github.com/kraamecnal/boarding-house/blob/main/src/utils/supabase.ts) (Supabase client), [`src/contexts/RoomsContext.tsx`](https://github.com/kraamecnal/boarding-house/blob/main/src/contexts/RoomsContext.tsx) (Rooms and tenancies), [`src/app/bill/[roomId].tsx`](https://github.com/kraamecnal/boarding-house/blob/main/src/app/bill/%5BroomId%5D.tsx) (Monthly bill), [`src/contexts/BillsContext.tsx`](https://github.com/kraamecnal/boarding-house/blob/main/src/contexts/BillsContext.tsx) (Bill records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_auth["Identity and access"]
  node_signin["Email OTP sign-in<br/>[sign-in.tsx]"]
  node_authctx["Auth session<br/>[AuthContext.tsx]"]
  node_supabase["Supabase client<br/>[supabase.ts]"]
end

subgraph group_portfolio["Property management"]
  node_dashboard["Manage dashboard<br/>[manage.tsx]"]
  node_houses["House records"]
  node_houseview["House overview<br/>[index.tsx]"]
end

subgraph group_tenancy["Tenancy operations"]
  node_rooms["Rooms and tenancies<br/>[RoomsContext.tsx]"]
  node_roomview["Room management<br/>[index.tsx]"]
  node_tenantform["Tenant registration<br/>[tenant.tsx]"]
  node_documents["Tenant documents<br/>[tenantDocuments.ts]"]
  node_imagefield["Document capture<br/>[ImageField.tsx]"]
  node_meterui["Meter entry and history<br/>[meter-reading.tsx]"]
  node_meterdata["Meter readings<br/>[meterReadings.ts]"]
end

subgraph group_billing["Billing and payments"]
  node_billingconfig["Charge settings"]
  node_billctx["Bill records<br/>[BillsContext.tsx]"]
  node_billcalc["Bill calculations<br/>[billing.ts]"]
  node_meterbill["Meter billing<br/>[meterBilling.ts]"]
  node_billui["Monthly bill<br/>[&#91;roomId&#93;.tsx]"]
  node_statement["Bill statement<br/>[BillStatement.tsx]"]
end

subgraph group_notify["Notifications"]
  node_notifications["In-app notifications"]
  node_notifyutil["Notification services<br/>[notifications.ts]"]
  node_pushfn["Push delivery function<br/>[index.ts]"]
  node_reminderfn["Bill reminder function<br/>[index.ts]"]
  node_expo(("Expo Push Service"))
  node_email(("Email delivery"))
end

node_owner(("House owner"))

node_owner -->|"starts session"| node_signin
node_signin -->|"requests OTP"| node_authctx
node_authctx -->|"verifies OTP"| node_supabase
node_dashboard -.->|"shows houses"| node_houses
node_houses -->|"reads and writes"| node_supabase
node_dashboard -.->|"opens house"| node_houseview
node_houseview -->|"loads house data"| node_houses
node_houseview -->|"loads rooms"| node_rooms
node_roomview -->|"manages room"| node_rooms
node_tenantform -.->|"registers tenancy"| node_rooms
node_rooms -->|"stores tenancy data"| node_supabase
node_roomview -->|"captures documents"| node_imagefield
node_imagefield -->|"uses document rules"| node_documents
node_rooms -->|"uploads and signs URLs"| node_documents
node_meterui -.->|"records readings"| node_meterdata
node_meterdata -->|"reads and writes"| node_supabase
node_billingconfig -.->|"stores charges"| node_supabase
node_billui -->|"loads bill data"| node_billctx
node_billctx -->|"uses occupied rooms"| node_rooms
node_billctx -->|"calculates totals"| node_billcalc
node_billctx -->|"reads and updates bills"| node_supabase
node_billui -->|"loads meter charges"| node_meterbill
node_billui -->|"loads readings"| node_meterdata
node_billui -->|"renders statement"| node_statement
node_notifications -->|"loads notifications"| node_notifyutil
node_notifyutil -->|"accesses notification data"| node_supabase
node_pushfn -->|"sends push"| node_expo
node_reminderfn -.->|"sends reminders"| node_email

click node_signin "https://github.com/kraamecnal/boarding-house/blob/main/src/app/sign-in.tsx"
click node_authctx "https://github.com/kraamecnal/boarding-house/blob/main/src/contexts/AuthContext.tsx"
click node_supabase "https://github.com/kraamecnal/boarding-house/blob/main/src/utils/supabase.ts"
click node_dashboard "https://github.com/kraamecnal/boarding-house/blob/main/src/app/(tabs)/manage.tsx"
click node_houses "https://github.com/kraamecnal/boarding-house/blob/main/src/contexts/BoardingHousesContext.tsx"
click node_houseview "https://github.com/kraamecnal/boarding-house/blob/main/src/app/bh/%5Bid%5D/index.tsx"
click node_rooms "https://github.com/kraamecnal/boarding-house/blob/main/src/contexts/RoomsContext.tsx"
click node_roomview "https://github.com/kraamecnal/boarding-house/blob/main/src/app/bh/%5Bid%5D/room/%5BroomId%5D/index.tsx"
click node_tenantform "https://github.com/kraamecnal/boarding-house/blob/main/src/app/bh/%5Bid%5D/room/%5BroomId%5D/tenant.tsx"
click node_documents "https://github.com/kraamecnal/boarding-house/blob/main/src/data/tenantDocuments.ts"
click node_imagefield "https://github.com/kraamecnal/boarding-house/blob/main/src/components/ImageField.tsx"
click node_meterui "https://github.com/kraamecnal/boarding-house/blob/main/src/app/bh/%5Bid%5D/room/%5BroomId%5D/meter-reading.tsx"
click node_meterdata "https://github.com/kraamecnal/boarding-house/blob/main/src/utils/meterReadings.ts"
click node_billingconfig "https://github.com/kraamecnal/boarding-house/blob/main/src/app/billing-charges.tsx"
click node_billctx "https://github.com/kraamecnal/boarding-house/blob/main/src/contexts/BillsContext.tsx"
click node_billcalc "https://github.com/kraamecnal/boarding-house/blob/main/src/utils/billing.ts"
click node_meterbill "https://github.com/kraamecnal/boarding-house/blob/main/src/utils/meterBilling.ts"
click node_billui "https://github.com/kraamecnal/boarding-house/blob/main/src/app/bill/%5BroomId%5D.tsx"
click node_statement "https://github.com/kraamecnal/boarding-house/blob/main/src/components/BillStatement.tsx"
click node_notifications "https://github.com/kraamecnal/boarding-house/blob/main/src/contexts/NotificationsContext.tsx"
click node_notifyutil "https://github.com/kraamecnal/boarding-house/blob/main/src/utils/notifications.ts"
click node_pushfn "https://github.com/kraamecnal/boarding-house/blob/main/supabase/functions/send-notification-push/index.ts"
click node_reminderfn "https://github.com/kraamecnal/boarding-house/blob/main/supabase/functions/send-bill-reminders/index.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_signin,node_authctx,node_supabase toneBlue
class node_dashboard,node_houses,node_houseview toneAmber
class node_rooms,node_roomview,node_tenantform,node_documents,node_imagefield,node_meterui,node_meterdata toneMint
class node_billingconfig,node_billctx,node_billcalc,node_meterbill,node_billui,node_statement toneRose
class node_notifications,node_notifyutil,node_pushfn,node_reminderfn,node_expo,node_email,node_owner toneIndigo
```

## Components

### Identity and access

- [Email OTP sign-in](https://github.com/kraamecnal/boarding-house/blob/main/src/app/sign-in.tsx): `src/app/sign-in.tsx`
- [Auth session](https://github.com/kraamecnal/boarding-house/blob/main/src/contexts/AuthContext.tsx): `src/contexts/AuthContext.tsx`
- [Supabase client](https://github.com/kraamecnal/boarding-house/blob/main/src/utils/supabase.ts): `src/utils/supabase.ts`

### Property management

- [Manage dashboard](https://github.com/kraamecnal/boarding-house/blob/main/src/app/(tabs)/manage.tsx): `src/app/(tabs)/manage.tsx`
- [House records](https://github.com/kraamecnal/boarding-house/blob/main/src/contexts/BoardingHousesContext.tsx): `src/contexts/BoardingHousesContext.tsx`
- [House overview](https://github.com/kraamecnal/boarding-house/blob/main/src/app/bh/%5Bid%5D/index.tsx): `src/app/bh/[id]/index.tsx`

### Tenancy operations

- [Rooms and tenancies](https://github.com/kraamecnal/boarding-house/blob/main/src/contexts/RoomsContext.tsx): `src/contexts/RoomsContext.tsx`
- [Room management](https://github.com/kraamecnal/boarding-house/blob/main/src/app/bh/%5Bid%5D/room/%5BroomId%5D/index.tsx): `src/app/bh/[id]/room/[roomId]/index.tsx`
- [Tenant registration](https://github.com/kraamecnal/boarding-house/blob/main/src/app/bh/%5Bid%5D/room/%5BroomId%5D/tenant.tsx): `src/app/bh/[id]/room/[roomId]/tenant.tsx`
- [Tenant documents](https://github.com/kraamecnal/boarding-house/blob/main/src/data/tenantDocuments.ts): `src/data/tenantDocuments.ts`
- [Document capture](https://github.com/kraamecnal/boarding-house/blob/main/src/components/ImageField.tsx): `src/components/ImageField.tsx`
- [Meter entry and history](https://github.com/kraamecnal/boarding-house/blob/main/src/app/bh/%5Bid%5D/room/%5BroomId%5D/meter-reading.tsx): `src/app/bh/[id]/room/[roomId]/meter-reading.tsx`
- [Meter readings](https://github.com/kraamecnal/boarding-house/blob/main/src/utils/meterReadings.ts): `src/utils/meterReadings.ts`

### Billing and payments

- [Charge settings](https://github.com/kraamecnal/boarding-house/blob/main/src/app/billing-charges.tsx): `src/app/billing-charges.tsx`
- [Bill records](https://github.com/kraamecnal/boarding-house/blob/main/src/contexts/BillsContext.tsx): `src/contexts/BillsContext.tsx`
- [Bill calculations](https://github.com/kraamecnal/boarding-house/blob/main/src/utils/billing.ts): `src/utils/billing.ts`
- [Meter billing](https://github.com/kraamecnal/boarding-house/blob/main/src/utils/meterBilling.ts): `src/utils/meterBilling.ts`
- [Monthly bill](https://github.com/kraamecnal/boarding-house/blob/main/src/app/bill/%5BroomId%5D.tsx): `src/app/bill/[roomId].tsx`
- [Bill statement](https://github.com/kraamecnal/boarding-house/blob/main/src/components/BillStatement.tsx): `src/components/BillStatement.tsx`

### Notifications

- [In-app notifications](https://github.com/kraamecnal/boarding-house/blob/main/src/contexts/NotificationsContext.tsx): `src/contexts/NotificationsContext.tsx`
- [Notification services](https://github.com/kraamecnal/boarding-house/blob/main/src/utils/notifications.ts): `src/utils/notifications.ts`
- [Push delivery function](https://github.com/kraamecnal/boarding-house/blob/main/supabase/functions/send-notification-push/index.ts): `supabase/functions/send-notification-push/index.ts`
- [Bill reminder function](https://github.com/kraamecnal/boarding-house/blob/main/supabase/functions/send-bill-reminders/index.ts): `supabase/functions/send-bill-reminders/index.ts`
- **Expo Push Service**
- **Email delivery**

### Other components

- **House owner**

## Connections

- House owner → Email OTP sign-in: starts session (evidence: `src/app/sign-in.tsx`)
- Email OTP sign-in → Auth session: requests OTP (evidence: `src/app/sign-in.tsx`)
- Auth session → Supabase client: verifies OTP (evidence: `src/contexts/AuthContext.tsx`)
- Manage dashboard → House records: shows houses
- House records → Supabase client: reads and writes (evidence: `src/contexts/BoardingHousesContext.tsx`)
- Manage dashboard → House overview: opens house
- House overview → House records: loads house data (evidence: `src/app/bh/[id]/index.tsx`)
- House overview → Rooms and tenancies: loads rooms (evidence: `src/app/bh/[id]/index.tsx`)
- Room management → Rooms and tenancies: manages room (evidence: `src/app/bh/[id]/room/[roomId]/index.tsx`)
- Tenant registration → Rooms and tenancies: registers tenancy
- Rooms and tenancies → Supabase client: stores tenancy data (evidence: `src/contexts/RoomsContext.tsx`)
- Room management → Document capture: captures documents (evidence: `src/app/bh/[id]/room/[roomId]/index.tsx`)
- Document capture → Tenant documents: uses document rules (evidence: `src/components/ImageField.tsx`)
- Rooms and tenancies → Tenant documents: uploads and signs URLs (evidence: `src/contexts/RoomsContext.tsx`)
- Meter entry and history → Meter readings: records readings
- Meter readings → Supabase client: reads and writes (evidence: `src/utils/meterReadings.ts`)
- Charge settings → Supabase client: stores charges (evidence: `src/app/billing-charges.tsx`)
- Monthly bill → Bill records: loads bill data (evidence: `src/app/bill/[roomId].tsx`)
- Bill records → Rooms and tenancies: uses occupied rooms (evidence: `src/contexts/BillsContext.tsx`)
- Bill records → Bill calculations: calculates totals (evidence: `src/contexts/BillsContext.tsx`)
- Bill records → Supabase client: reads and updates bills (evidence: `src/contexts/BillsContext.tsx`)
- Monthly bill → Meter billing: loads meter charges (evidence: `src/app/bill/[roomId].tsx`)
- Monthly bill → Meter readings: loads readings (evidence: `src/app/bill/[roomId].tsx`)
- Monthly bill → Bill statement: renders statement (evidence: `src/app/bill/[roomId].tsx`)
- In-app notifications → Notification services: loads notifications (evidence: `src/contexts/NotificationsContext.tsx`)
- Notification services → Supabase client: accesses notification data (evidence: `src/utils/notifications.ts`)
- Push delivery function → Expo Push Service: sends push (evidence: `README.md`)
- Bill reminder function → Email delivery: sends reminders (evidence: `README.md`)
