# landmark-github/dreamicecream architecture

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

- Interactive diagram: https://gitdiagram.com/landmark-github/dreamicecream
- Repository: https://github.com/landmark-github/dreamicecream

## Overview

This is a Thai-language store operations app for managing members, products, daily stock checkout/returns, bills, expenses, supplies, and business records. The main workflow is selecting a member and recording stock movement in the ledger, with shared state persisted through Firebase and bills available for print preview. Other pages cover administration, supply operations, reporting, and data export. Relationships reflect sampled code and SOURCE INDEX references; several page implementations were not excerpted, so their internal interactions are not inferred.

Main entry points: [`lib/store.ts`](https://github.com/landmark-github/dreamicecream/blob/master/lib/store.ts) (Application state), [`lib/firebase.ts`](https://github.com/landmark-github/dreamicecream/blob/master/lib/firebase.ts) (Firebase setup), [`app/ledger/page.tsx`](https://github.com/landmark-github/dreamicecream/blob/master/app/ledger/page.tsx) (Checkout ledger), [`app/settings/page.tsx`](https://github.com/landmark-github/dreamicecream/blob/master/app/settings/page.tsx) (Settings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_operations["Store Operations"]
  node_home["Home dashboard<br/>[page.tsx]"]
  node_ledger["Checkout ledger<br/>[page.tsx]"]
  node_product_table["Product table<br/>[product-table.tsx]"]
  node_bill_preview["Bill print preview"]
  node_transactions["Transactions<br/>[page.tsx]"]
  node_supply["Supply management<br/>[page.tsx]"]
  node_supply_orders["Supply orders<br/>[page.tsx]"]
  node_work_mode["Work mode<br/>[page.tsx]"]
end

subgraph group_records["Business Records"]
  node_bills["Bill records<br/>[page.tsx]"]
  node_expenses["Expense tracking<br/>[page.tsx]"]
  node_logs["Activity logs<br/>[page.tsx]"]
  node_data["Data export<br/>[page.tsx]"]
  node_batch_export["Batch export"]
end

subgraph group_admin["Administration"]
  node_members["Member management<br/>[page.tsx]"]
  node_products["Product management<br/>[page.tsx]"]
  node_settings["Settings<br/>[page.tsx]"]
  node_member_settings["Member settings"]
  node_product_settings["Product settings"]
  node_user_settings["User settings<br/>[user-settings.tsx]"]
  node_login["Login<br/>[page.tsx]"]
end

subgraph group_shared["Shared Services"]
  node_ledger_math["Ledger calculations<br/>[ledger-utils.ts]"]
  node_auth_guard["Authentication guard<br/>[auth-guard.tsx]"]
  node_store["Application state<br/>[store.ts]"]
  node_types["Domain models<br/>[types.ts]"]
  node_firebase["Firebase setup<br/>[firebase.ts]"]
end

node_operator(("Store staff"))
node_firestore[("Cloud Firestore")]

node_operator -->|"opens app"| node_home
node_operator -->|"signs in"| node_login
node_operator -->|"records stock"| node_ledger
node_home -->|"checks access"| node_auth_guard
node_auth_guard -->|"reads state"| node_store
node_home -->|"reads state"| node_store
node_ledger -->|"updates bills"| node_store
node_ledger -->|"renders"| node_product_table
node_ledger -->|"uses calculations"| node_ledger_math
node_ledger -->|"opens preview"| node_bill_preview
node_bill_preview -->|"formats bill"| node_ledger_math
node_transactions -->|"reads and updates"| node_store
node_bills -->|"uses Firebase"| node_firebase
node_expenses -->|"reads and updates"| node_store
node_supply -->|"reads and updates"| node_store
node_supply -->|"uses Firebase"| node_firebase
node_supply_orders -->|"uses Firebase"| node_firebase
node_work_mode -->|"uses shared state"| node_store
node_work_mode -->|"uses Firebase"| node_firebase
node_logs -->|"uses Firebase"| node_firebase
node_data -->|"reads state"| node_store
node_data -->|"uses Firebase"| node_firebase
node_data -->|"opens export"| node_batch_export
node_batch_export -->|"reads state"| node_store
node_members -.->|"manages members"| node_store
node_products -.->|"manages products"| node_store
node_settings -->|"checks access"| node_auth_guard
node_settings -->|"renders"| node_member_settings
node_settings -->|"renders"| node_product_settings
node_settings -->|"renders"| node_user_settings
node_member_settings -->|"updates members"| node_store
node_product_settings -->|"updates products"| node_store
node_store -->|"persists data"| node_firebase
node_firebase -->|"reads and writes"| node_firestore
node_store -->|"uses domain models"| node_types
node_ledger_math -->|"uses domain models"| node_types

click node_home "https://github.com/landmark-github/dreamicecream/blob/master/app/page.tsx"
click node_ledger "https://github.com/landmark-github/dreamicecream/blob/master/app/ledger/page.tsx"
click node_product_table "https://github.com/landmark-github/dreamicecream/blob/master/components/product-table.tsx"
click node_bill_preview "https://github.com/landmark-github/dreamicecream/blob/master/components/ledger/bill-print-preview-dialog.tsx"
click node_ledger_math "https://github.com/landmark-github/dreamicecream/blob/master/lib/ledger-utils.ts"
click node_transactions "https://github.com/landmark-github/dreamicecream/blob/master/app/transaction/page.tsx"
click node_bills "https://github.com/landmark-github/dreamicecream/blob/master/app/bills/page.tsx"
click node_expenses "https://github.com/landmark-github/dreamicecream/blob/master/app/expenses/page.tsx"
click node_supply "https://github.com/landmark-github/dreamicecream/blob/master/app/supply/page.tsx"
click node_supply_orders "https://github.com/landmark-github/dreamicecream/blob/master/app/supply-orders/page.tsx"
click node_members "https://github.com/landmark-github/dreamicecream/blob/master/app/members/page.tsx"
click node_products "https://github.com/landmark-github/dreamicecream/blob/master/app/products/page.tsx"
click node_settings "https://github.com/landmark-github/dreamicecream/blob/master/app/settings/page.tsx"
click node_member_settings "https://github.com/landmark-github/dreamicecream/blob/master/components/member-settings.tsx"
click node_product_settings "https://github.com/landmark-github/dreamicecream/blob/master/components/product-settings.tsx"
click node_user_settings "https://github.com/landmark-github/dreamicecream/blob/master/components/user-settings.tsx"
click node_login "https://github.com/landmark-github/dreamicecream/blob/master/app/login/page.tsx"
click node_work_mode "https://github.com/landmark-github/dreamicecream/blob/master/app/modework/page.tsx"
click node_logs "https://github.com/landmark-github/dreamicecream/blob/master/app/logs/page.tsx"
click node_data "https://github.com/landmark-github/dreamicecream/blob/master/app/data/page.tsx"
click node_batch_export "https://github.com/landmark-github/dreamicecream/blob/master/components/data/batch-export-dialog.tsx"
click node_auth_guard "https://github.com/landmark-github/dreamicecream/blob/master/components/auth-guard.tsx"
click node_store "https://github.com/landmark-github/dreamicecream/blob/master/lib/store.ts"
click node_types "https://github.com/landmark-github/dreamicecream/blob/master/lib/types.ts"
click node_firebase "https://github.com/landmark-github/dreamicecream/blob/master/lib/firebase.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_home,node_ledger,node_product_table,node_bill_preview,node_transactions,node_supply,node_supply_orders,node_work_mode toneBlue
class node_bills,node_expenses,node_logs,node_data,node_batch_export,node_firestore toneAmber
class node_members,node_products,node_settings,node_member_settings,node_product_settings,node_user_settings,node_login toneMint
class node_ledger_math,node_auth_guard,node_store,node_types,node_firebase toneRose
class node_operator toneIndigo
```

## Components

### Store Operations

- [Home dashboard](https://github.com/landmark-github/dreamicecream/blob/master/app/page.tsx): `app/page.tsx`
- [Checkout ledger](https://github.com/landmark-github/dreamicecream/blob/master/app/ledger/page.tsx): `app/ledger/page.tsx`
- [Product table](https://github.com/landmark-github/dreamicecream/blob/master/components/product-table.tsx): `components/product-table.tsx`
- [Bill print preview](https://github.com/landmark-github/dreamicecream/blob/master/components/ledger/bill-print-preview-dialog.tsx): `components/ledger/bill-print-preview-dialog.tsx`
- [Transactions](https://github.com/landmark-github/dreamicecream/blob/master/app/transaction/page.tsx): `app/transaction/page.tsx`
- [Supply management](https://github.com/landmark-github/dreamicecream/blob/master/app/supply/page.tsx): `app/supply/page.tsx`
- [Supply orders](https://github.com/landmark-github/dreamicecream/blob/master/app/supply-orders/page.tsx): `app/supply-orders/page.tsx`
- [Work mode](https://github.com/landmark-github/dreamicecream/blob/master/app/modework/page.tsx): `app/modework/page.tsx`

### Business Records

- [Bill records](https://github.com/landmark-github/dreamicecream/blob/master/app/bills/page.tsx): `app/bills/page.tsx`
- [Expense tracking](https://github.com/landmark-github/dreamicecream/blob/master/app/expenses/page.tsx): `app/expenses/page.tsx`
- [Activity logs](https://github.com/landmark-github/dreamicecream/blob/master/app/logs/page.tsx): `app/logs/page.tsx`
- [Data export](https://github.com/landmark-github/dreamicecream/blob/master/app/data/page.tsx): `app/data/page.tsx`
- [Batch export](https://github.com/landmark-github/dreamicecream/blob/master/components/data/batch-export-dialog.tsx): `components/data/batch-export-dialog.tsx`

### Administration

- [Member management](https://github.com/landmark-github/dreamicecream/blob/master/app/members/page.tsx): `app/members/page.tsx`
- [Product management](https://github.com/landmark-github/dreamicecream/blob/master/app/products/page.tsx): `app/products/page.tsx`
- [Settings](https://github.com/landmark-github/dreamicecream/blob/master/app/settings/page.tsx): `app/settings/page.tsx`
- [Member settings](https://github.com/landmark-github/dreamicecream/blob/master/components/member-settings.tsx): `components/member-settings.tsx`
- [Product settings](https://github.com/landmark-github/dreamicecream/blob/master/components/product-settings.tsx): `components/product-settings.tsx`
- [User settings](https://github.com/landmark-github/dreamicecream/blob/master/components/user-settings.tsx): `components/user-settings.tsx`
- [Login](https://github.com/landmark-github/dreamicecream/blob/master/app/login/page.tsx): `app/login/page.tsx`

### Shared Services

- [Ledger calculations](https://github.com/landmark-github/dreamicecream/blob/master/lib/ledger-utils.ts): `lib/ledger-utils.ts`
- [Authentication guard](https://github.com/landmark-github/dreamicecream/blob/master/components/auth-guard.tsx): `components/auth-guard.tsx`
- [Application state](https://github.com/landmark-github/dreamicecream/blob/master/lib/store.ts): `lib/store.ts`
- [Domain models](https://github.com/landmark-github/dreamicecream/blob/master/lib/types.ts): `lib/types.ts`
- [Firebase setup](https://github.com/landmark-github/dreamicecream/blob/master/lib/firebase.ts): `lib/firebase.ts`

### Other components

- **Store staff**
- **Cloud Firestore**

## Connections

- Store staff → Home dashboard: opens app
- Store staff → Login: signs in
- Store staff → Checkout ledger: records stock
- Home dashboard → Authentication guard: checks access (evidence: `app/page.tsx`)
- Authentication guard → Application state: reads state (evidence: `components/auth-guard.tsx`)
- Home dashboard → Application state: reads state (evidence: `app/page.tsx`)
- Checkout ledger → Application state: updates bills (evidence: `app/ledger/page.tsx`)
- Checkout ledger → Product table: renders (evidence: `app/ledger/page.tsx`)
- Checkout ledger → Ledger calculations: uses calculations (evidence: `app/ledger/page.tsx`)
- Checkout ledger → Bill print preview: opens preview (evidence: `app/ledger/page.tsx`)
- Bill print preview → Ledger calculations: formats bill (evidence: `components/ledger/bill-print-preview-dialog.tsx`)
- Transactions → Application state: reads and updates (evidence: `app/transaction/page.tsx`)
- Bill records → Firebase setup: uses Firebase (evidence: `app/bills/page.tsx`)
- Expense tracking → Application state: reads and updates (evidence: `app/expenses/page.tsx`)
- Supply management → Application state: reads and updates (evidence: `app/supply/page.tsx`)
- Supply management → Firebase setup: uses Firebase (evidence: `app/supply/page.tsx`)
- Supply orders → Firebase setup: uses Firebase (evidence: `app/supply-orders/page.tsx`)
- Work mode → Application state: uses shared state (evidence: `app/modework/page.tsx`)
- Work mode → Firebase setup: uses Firebase (evidence: `app/modework/page.tsx`)
- Activity logs → Firebase setup: uses Firebase (evidence: `app/logs/page.tsx`)
- Data export → Application state: reads state (evidence: `app/data/page.tsx`)
- Data export → Firebase setup: uses Firebase (evidence: `app/data/page.tsx`)
- Data export → Batch export: opens export (evidence: `app/data/page.tsx`)
- Batch export → Application state: reads state (evidence: `components/data/batch-export-dialog.tsx`)
- Member management → Application state: manages members
- Product management → Application state: manages products
- Settings → Authentication guard: checks access (evidence: `app/settings/page.tsx`)
- Settings → Member settings: renders (evidence: `app/settings/page.tsx`)
- Settings → Product settings: renders (evidence: `app/settings/page.tsx`)
- Settings → User settings: renders (evidence: `app/settings/page.tsx`)
- Member settings → Application state: updates members (evidence: `components/member-settings.tsx`)
- Product settings → Application state: updates products (evidence: `components/product-settings.tsx`)
- Application state → Firebase setup: persists data (evidence: `lib/store.ts`)
- Firebase setup → Cloud Firestore: reads and writes (evidence: `lib/firebase.ts`)
- Application state → Domain models: uses domain models (evidence: `lib/store.ts`)
- Ledger calculations → Domain models: uses domain models (evidence: `lib/ledger-utils.ts`)
