# virtiparekh/cash-book architecture

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

- Interactive diagram: https://gitdiagram.com/virtiparekh/cash-book
- Repository: https://github.com/virtiparekh/cash-book

## Overview

Family Cash Book is a React and Supabase app for managing independent family cash books. A user signs in, selects or creates a book, then records and reviews transactions; related workflows cover members and invitations, recurring entries, reports, and book settings. The graph groups the major user-facing stages and the service/data-access layer. Some page and feature internals were not sampled, so those branches reflect README capabilities and are not expanded into unverified call chains.

Main entry points: [`src/lib/supabase.ts`](https://github.com/virtiparekh/cash-book/blob/main/src/lib/supabase.ts) (Supabase client), [`src/routes/AppRoutes.tsx`](https://github.com/virtiparekh/cash-book/blob/main/src/routes/AppRoutes.tsx) (App routing), [`src/pages/DashboardPage.tsx`](https://github.com/virtiparekh/cash-book/blob/main/src/pages/DashboardPage.tsx) (Book dashboard), [`src/pages/SettingsPage.tsx`](https://github.com/virtiparekh/cash-book/blob/main/src/pages/SettingsPage.tsx) (Book settings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App entry"]
  node_routes["App routing<br/>[AppRoutes.tsx]"]
  node_auth["Authentication state<br/>[AuthContext.tsx]"]
end

subgraph group_books["Cash book setup"]
  node_bookcontext["Selected book state"]
  node_bookgroups["Book selection"]
  node_setup["Create a book"]
end

subgraph group_activity["Financial activity"]
  node_dashboard["Book dashboard<br/>[DashboardPage.tsx]"]
  node_transactions["Transaction history"]
  node_transactionform["Transaction entry"]
  node_recurring["Recurring entries"]
  node_reports["Reports and summaries<br/>[ReportsPage.tsx]"]
end

subgraph group_admin["Book administration"]
  node_members["Member management<br/>[MembersPage.tsx]"]
  node_invitations["Invitation acceptance"]
  node_settings["Book settings<br/>[SettingsPage.tsx]"]
end

subgraph group_data["Services and storage"]
  node_supabase["Supabase client<br/>[supabase.ts]"]
  node_groupservice["Book data service<br/>[groupService.ts]"]
  node_cashbookservice["Book management service<br/>[cashBookService.ts]"]
  node_transactionsservice["Transaction service"]
  node_recurringservice["Recurring service"]
  node_memberservice["Member service<br/>[memberService.ts]"]
  node_invitationservice["Invitation service"]
  node_masterdata["Categories and payment modes"]
end

node_user(("Family user"))

node_user -->|"opens app"| node_routes
node_routes -->|"reads session"| node_auth
node_auth -->|"auth calls"| node_supabase
node_routes -->|"loads books"| node_bookgroups
node_bookgroups -->|"loads memberships"| node_groupservice
node_groupservice -->|"queries data"| node_supabase
node_routes -->|"selects book"| node_bookcontext
node_bookcontext -->|"loads member"| node_memberservice
node_memberservice -->|"queries members"| node_supabase
node_routes -->|"routes setup"| node_setup
node_setup -->|"creates book"| node_cashbookservice
node_cashbookservice -.->|"persists book"| node_supabase
node_routes -->|"routes selected book"| node_dashboard
node_dashboard -->|"renders history"| node_transactions
node_dashboard -->|"opens entry"| node_transactionform
node_dashboard -->|"loads transactions"| node_transactionsservice
node_transactionsservice -->|"reads and writes"| node_supabase
node_user -->|"manages repeats"| node_recurring
node_recurring -->|"manages schedules"| node_recurringservice
node_recurringservice -->|"stores schedules"| node_supabase
node_user -->|"views summaries"| node_reports
node_user -->|"manages family"| node_members
node_members -->|"updates members"| node_memberservice
node_members -->|"sends invitations"| node_invitationservice
node_invitationservice -->|"stores invitations"| node_supabase
node_user -->|"accepts invite"| node_invitations
node_user -->|"configures book"| node_settings
node_settings -->|"manages books"| node_groupservice
node_settings -->|"duplicates book"| node_cashbookservice
node_settings -->|"manages categories"| node_masterdata
node_masterdata -->|"stores options"| node_supabase

click node_routes "https://github.com/virtiparekh/cash-book/blob/main/src/routes/AppRoutes.tsx"
click node_auth "https://github.com/virtiparekh/cash-book/blob/main/src/contexts/AuthContext.tsx"
click node_supabase "https://github.com/virtiparekh/cash-book/blob/main/src/lib/supabase.ts"
click node_bookcontext "https://github.com/virtiparekh/cash-book/blob/main/src/contexts/CashBookContext.tsx"
click node_bookgroups "https://github.com/virtiparekh/cash-book/blob/main/src/hooks/useCashBookGroups.ts"
click node_setup "https://github.com/virtiparekh/cash-book/blob/main/src/pages/CashBookSetupPage.tsx"
click node_dashboard "https://github.com/virtiparekh/cash-book/blob/main/src/pages/DashboardPage.tsx"
click node_transactions "https://github.com/virtiparekh/cash-book/blob/main/src/components/dashboard/TransactionTable/TransactionTable.tsx"
click node_transactionform "https://github.com/virtiparekh/cash-book/blob/main/src/components/dashboard/TransactionDrawer/TransactionForm.tsx"
click node_recurring "https://github.com/virtiparekh/cash-book/blob/main/src/components/recurring/RecurringTransactionForm.tsx"
click node_reports "https://github.com/virtiparekh/cash-book/blob/main/src/pages/ReportsPage.tsx"
click node_members "https://github.com/virtiparekh/cash-book/blob/main/src/pages/MembersPage.tsx"
click node_invitations "https://github.com/virtiparekh/cash-book/blob/main/src/pages/AcceptInvitationPage.tsx"
click node_settings "https://github.com/virtiparekh/cash-book/blob/main/src/pages/SettingsPage.tsx"
click node_groupservice "https://github.com/virtiparekh/cash-book/blob/main/src/services/groupService.ts"
click node_cashbookservice "https://github.com/virtiparekh/cash-book/blob/main/src/services/cashBookService.ts"
click node_transactionsservice "https://github.com/virtiparekh/cash-book/blob/main/src/services/transactionService.ts"
click node_recurringservice "https://github.com/virtiparekh/cash-book/blob/main/src/services/recurringTransactionService.ts"
click node_memberservice "https://github.com/virtiparekh/cash-book/blob/main/src/services/memberService.ts"
click node_invitationservice "https://github.com/virtiparekh/cash-book/blob/main/src/services/invitationService.ts"
click node_masterdata "https://github.com/virtiparekh/cash-book/blob/main/src/services/masterDataService.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_routes,node_auth,node_user toneBlue
class node_bookcontext,node_bookgroups,node_setup toneAmber
class node_dashboard,node_transactions,node_transactionform,node_recurring,node_reports toneMint
class node_members,node_invitations,node_settings toneRose
class node_supabase,node_groupservice,node_cashbookservice,node_transactionsservice,node_recurringservice,node_memberservice,node_invitationservice,node_masterdata toneIndigo
```

## Components

### App entry

- [App routing](https://github.com/virtiparekh/cash-book/blob/main/src/routes/AppRoutes.tsx): `src/routes/AppRoutes.tsx`
- [Authentication state](https://github.com/virtiparekh/cash-book/blob/main/src/contexts/AuthContext.tsx): `src/contexts/AuthContext.tsx`

### Cash book setup

- [Selected book state](https://github.com/virtiparekh/cash-book/blob/main/src/contexts/CashBookContext.tsx): `src/contexts/CashBookContext.tsx`
- [Book selection](https://github.com/virtiparekh/cash-book/blob/main/src/hooks/useCashBookGroups.ts): `src/hooks/useCashBookGroups.ts`
- [Create a book](https://github.com/virtiparekh/cash-book/blob/main/src/pages/CashBookSetupPage.tsx): `src/pages/CashBookSetupPage.tsx`

### Financial activity

- [Book dashboard](https://github.com/virtiparekh/cash-book/blob/main/src/pages/DashboardPage.tsx): `src/pages/DashboardPage.tsx`
- [Transaction history](https://github.com/virtiparekh/cash-book/blob/main/src/components/dashboard/TransactionTable/TransactionTable.tsx): `src/components/dashboard/TransactionTable/TransactionTable.tsx`
- [Transaction entry](https://github.com/virtiparekh/cash-book/blob/main/src/components/dashboard/TransactionDrawer/TransactionForm.tsx): `src/components/dashboard/TransactionDrawer/TransactionForm.tsx`
- [Recurring entries](https://github.com/virtiparekh/cash-book/blob/main/src/components/recurring/RecurringTransactionForm.tsx): `src/components/recurring/RecurringTransactionForm.tsx`
- [Reports and summaries](https://github.com/virtiparekh/cash-book/blob/main/src/pages/ReportsPage.tsx): `src/pages/ReportsPage.tsx`

### Book administration

- [Member management](https://github.com/virtiparekh/cash-book/blob/main/src/pages/MembersPage.tsx): `src/pages/MembersPage.tsx`
- [Invitation acceptance](https://github.com/virtiparekh/cash-book/blob/main/src/pages/AcceptInvitationPage.tsx): `src/pages/AcceptInvitationPage.tsx`
- [Book settings](https://github.com/virtiparekh/cash-book/blob/main/src/pages/SettingsPage.tsx): `src/pages/SettingsPage.tsx`

### Services and storage

- [Supabase client](https://github.com/virtiparekh/cash-book/blob/main/src/lib/supabase.ts): `src/lib/supabase.ts`
- [Book data service](https://github.com/virtiparekh/cash-book/blob/main/src/services/groupService.ts): `src/services/groupService.ts`
- [Book management service](https://github.com/virtiparekh/cash-book/blob/main/src/services/cashBookService.ts): `src/services/cashBookService.ts`
- [Transaction service](https://github.com/virtiparekh/cash-book/blob/main/src/services/transactionService.ts): `src/services/transactionService.ts`
- [Recurring service](https://github.com/virtiparekh/cash-book/blob/main/src/services/recurringTransactionService.ts): `src/services/recurringTransactionService.ts`
- [Member service](https://github.com/virtiparekh/cash-book/blob/main/src/services/memberService.ts): `src/services/memberService.ts`
- [Invitation service](https://github.com/virtiparekh/cash-book/blob/main/src/services/invitationService.ts): `src/services/invitationService.ts`
- [Categories and payment modes](https://github.com/virtiparekh/cash-book/blob/main/src/services/masterDataService.ts): `src/services/masterDataService.ts`

### Other components

- **Family user**

## Connections

- Family user → App routing: opens app (evidence: `src/routes/AppRoutes.tsx`)
- App routing → Authentication state: reads session (evidence: `src/routes/AppRoutes.tsx`)
- Authentication state → Supabase client: auth calls (evidence: `src/contexts/AuthContext.tsx`)
- App routing → Book selection: loads books (evidence: `src/routes/AppRoutes.tsx`)
- Book selection → Book data service: loads memberships (evidence: `src/hooks/useCashBookGroups.ts`)
- Book data service → Supabase client: queries data (evidence: `src/services/groupService.ts`)
- App routing → Selected book state: selects book (evidence: `src/routes/AppRoutes.tsx`)
- Selected book state → Member service: loads member (evidence: `src/contexts/CashBookContext.tsx`)
- Member service → Supabase client: queries members (evidence: `src/services/memberService.ts`)
- App routing → Create a book: routes setup (evidence: `src/routes/AppRoutes.tsx`)
- Create a book → Book management service: creates book (evidence: `src/pages/CashBookSetupPage.tsx`)
- Book management service → Supabase client: persists book
- App routing → Book dashboard: routes selected book (evidence: `src/routes/AppRoutes.tsx`)
- Book dashboard → Transaction history: renders history (evidence: `src/pages/DashboardPage.tsx`)
- Book dashboard → Transaction entry: opens entry (evidence: `src/pages/DashboardPage.tsx`)
- Book dashboard → Transaction service: loads transactions (evidence: `src/pages/DashboardPage.tsx`)
- Transaction service → Supabase client: reads and writes (evidence: `src/services/transactionService.ts`)
- Family user → Recurring entries: manages repeats
- Recurring entries → Recurring service: manages schedules (evidence: `src/components/recurring/RecurringTransactionForm.tsx`)
- Recurring service → Supabase client: stores schedules (evidence: `src/services/recurringTransactionService.ts`)
- Family user → Reports and summaries: views summaries
- Family user → Member management: manages family
- Member management → Member service: updates members (evidence: `src/pages/MembersPage.tsx`)
- Member management → Invitation service: sends invitations (evidence: `src/pages/MembersPage.tsx`)
- Invitation service → Supabase client: stores invitations (evidence: `src/services/invitationService.ts`)
- Family user → Invitation acceptance: accepts invite
- Family user → Book settings: configures book
- Book settings → Book data service: manages books (evidence: `src/pages/SettingsPage.tsx`)
- Book settings → Book management service: duplicates book (evidence: `src/pages/SettingsPage.tsx`)
- Book settings → Categories and payment modes: manages categories (evidence: `src/pages/SettingsPage.tsx`)
- Categories and payment modes → Supabase client: stores options (evidence: `src/services/masterDataService.ts`)
