# nyohleonard-nlktech/business-buddy architecture

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

- Interactive diagram: https://gitdiagram.com/nyohleonard-nlktech/business-buddy
- Repository: https://github.com/nyohleonard-nlktech/business-buddy

## Overview

This is a local-first small-business inventory and point-of-sale application. Users enter through the routed app, select a business context, manage products and record sales or restocks; they can then review transaction logs and reports. Sales and restocks can be queued locally for later synchronization with Supabase, while product views can use cached data. The route tree documents additional capabilities such as onboarding, settings, inbox, account/record pages, and a control panel. Several route implementations were not sampled, so their internal connections are not asserted.

Main entry points: [`src/routeTree.gen.ts`](https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/routeTree.gen.ts) (Route map), [`src/integrations/supabase/client.ts`](https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/integrations/supabase/client.ts) (Supabase client), [`src/routes/app.sale.tsx`](https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/routes/app.sale.tsx) (Sale entry), [`src/routes/app.restock.tsx`](https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/routes/app.restock.tsx) (Restock entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_navigation["App routing"]
  node_router["Router<br/>[router.tsx]"]
  node_route_map["Route map<br/>[routeTree.gen.ts]"]
  node_app_shell["App shell<br/>[app.tsx]"]
  node_auth["Authentication<br/>[auth.tsx]"]
  node_control_panel["Control panel<br/>[control-panel.tsx]"]
end

subgraph group_operations["Business operations"]
  node_onboarding["Business onboarding<br/>[onboarding.tsx]"]
  node_products["Product inventory<br/>[app.index.tsx]"]
  node_sale["Sale entry<br/>[app.sale.tsx]"]
  node_receipt["Receipt<br/>[Receipt.tsx]"]
  node_sales_log["Sales history<br/>[app.sales-log.tsx]"]
  node_restock["Restock entry<br/>[app.restock.tsx]"]
  node_restock_log["Restock history"]
  node_reports["Reports<br/>[app.reports.tsx]"]
  node_record["Record page<br/>[app.record.tsx]"]
  node_settings["Settings<br/>[app.settings.tsx]"]
  node_inbox["Inbox<br/>[app.inbox.tsx]"]
  node_more["More page<br/>[app.more.tsx]"]
end

subgraph group_offline["Offline support"]
  node_offline_hook["Offline sync hook"]
  node_offline_store[("Local cache and queue<br/>[offline.ts]")]
  node_sync_status["Sync status<br/>[SyncStatus.tsx]"]
end

subgraph group_platform["Identity and data"]
  node_business_context["Business context<br/>[use-app.tsx]"]
  node_supabase_client["Supabase client<br/>[client.ts]"]
end

node_user(("Business user"))
node_supabase[("Supabase service")]

node_user -->|"opens app"| node_router
node_router -->|"loads routes"| node_route_map
node_route_map -->|"routes to"| node_app_shell
node_route_map -->|"routes to"| node_auth
node_route_map -->|"routes to"| node_control_panel
node_route_map -->|"routes to"| node_products
node_route_map -->|"routes to"| node_sale
node_route_map -->|"routes to"| node_sales_log
node_route_map -->|"routes to"| node_restock
node_route_map -->|"routes to"| node_restock_log
node_route_map -->|"routes to"| node_reports
node_route_map -->|"routes to"| node_record
node_route_map -->|"routes to"| node_settings
node_route_map -->|"routes to"| node_inbox
node_route_map -->|"routes to"| node_more
node_app_shell -->|"renders"| node_onboarding
node_app_shell -->|"renders"| node_sync_status
node_app_shell -->|"uses context"| node_business_context
node_business_context -->|"loads memberships"| node_supabase_client
node_products -->|"uses context"| node_business_context
node_sale -->|"uses context"| node_business_context
node_restock -->|"uses context"| node_business_context
node_products -->|"reads cache"| node_offline_store
node_sale -->|"queues sale"| node_offline_store
node_restock -->|"queues restock"| node_offline_store
node_sale -->|"shows receipt"| node_receipt
node_sales_log -->|"shows receipt"| node_receipt
node_reports -->|"links to"| node_restock
node_offline_hook -->|"reads queue"| node_offline_store
node_sync_status -.->|"displays status"| node_offline_hook
node_offline_store -.->|"syncs queued work"| node_supabase_client
node_products -->|"fetches products"| node_supabase_client
node_sale -->|"fetches products"| node_supabase_client
node_restock -->|"fetches products"| node_supabase_client
node_sales_log -->|"loads history"| node_supabase_client
node_reports -->|"loads transactions"| node_supabase_client
node_supabase_client -->|"connects"| node_supabase

click node_router "https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/router.tsx"
click node_route_map "https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/routeTree.gen.ts"
click node_app_shell "https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/routes/app.tsx"
click node_auth "https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/routes/auth.tsx"
click node_control_panel "https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/routes/control-panel.tsx"
click node_onboarding "https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/components/onboarding.tsx"
click node_business_context "https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/hooks/use-app.tsx"
click node_products "https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/routes/app.index.tsx"
click node_sale "https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/routes/app.sale.tsx"
click node_receipt "https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/components/Receipt.tsx"
click node_sales_log "https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/routes/app.sales-log.tsx"
click node_restock "https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/routes/app.restock.tsx"
click node_restock_log "https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/routes/app.restocks-log.tsx"
click node_reports "https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/routes/app.reports.tsx"
click node_record "https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/routes/app.record.tsx"
click node_settings "https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/routes/app.settings.tsx"
click node_inbox "https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/routes/app.inbox.tsx"
click node_more "https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/routes/app.more.tsx"
click node_offline_hook "https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/hooks/use-offline-sync.ts"
click node_offline_store "https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/lib/offline.ts"
click node_sync_status "https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/components/SyncStatus.tsx"
click node_supabase_client "https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/integrations/supabase/client.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_router,node_route_map,node_app_shell,node_auth,node_control_panel,node_user toneBlue
class node_onboarding,node_products,node_sale,node_receipt,node_sales_log,node_restock,node_restock_log,node_reports,node_record,node_settings,node_inbox,node_more,node_supabase toneAmber
class node_offline_hook,node_offline_store,node_sync_status toneMint
class node_business_context,node_supabase_client toneRose
```

## Components

### App routing

- [Router](https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/router.tsx): `src/router.tsx`
- [Route map](https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/routeTree.gen.ts): `src/routeTree.gen.ts`
- [App shell](https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/routes/app.tsx): `src/routes/app.tsx`
- [Authentication](https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/routes/auth.tsx): `src/routes/auth.tsx`
- [Control panel](https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/routes/control-panel.tsx): `src/routes/control-panel.tsx`

### Business operations

- [Business onboarding](https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/components/onboarding.tsx): `src/components/onboarding.tsx`
- [Product inventory](https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/routes/app.index.tsx): `src/routes/app.index.tsx`
- [Sale entry](https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/routes/app.sale.tsx): `src/routes/app.sale.tsx`
- [Receipt](https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/components/Receipt.tsx): `src/components/Receipt.tsx`
- [Sales history](https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/routes/app.sales-log.tsx): `src/routes/app.sales-log.tsx`
- [Restock entry](https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/routes/app.restock.tsx): `src/routes/app.restock.tsx`
- [Restock history](https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/routes/app.restocks-log.tsx): `src/routes/app.restocks-log.tsx`
- [Reports](https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/routes/app.reports.tsx): `src/routes/app.reports.tsx`
- [Record page](https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/routes/app.record.tsx): `src/routes/app.record.tsx`
- [Settings](https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/routes/app.settings.tsx): `src/routes/app.settings.tsx`
- [Inbox](https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/routes/app.inbox.tsx): `src/routes/app.inbox.tsx`
- [More page](https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/routes/app.more.tsx): `src/routes/app.more.tsx`

### Offline support

- [Offline sync hook](https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/hooks/use-offline-sync.ts): `src/hooks/use-offline-sync.ts`
- [Local cache and queue](https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/lib/offline.ts): `src/lib/offline.ts`
- [Sync status](https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/components/SyncStatus.tsx): `src/components/SyncStatus.tsx`

### Identity and data

- [Business context](https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/hooks/use-app.tsx): `src/hooks/use-app.tsx`
- [Supabase client](https://github.com/nyohleonard-nlktech/business-buddy/blob/main/src/integrations/supabase/client.ts): `src/integrations/supabase/client.ts`

### Other components

- **Business user**
- **Supabase service**

## Connections

- Business user → Router: opens app
- Router → Route map: loads routes (evidence: `src/router.tsx`)
- Route map → App shell: routes to (evidence: `src/routeTree.gen.ts`)
- Route map → Authentication: routes to (evidence: `src/routeTree.gen.ts`)
- Route map → Control panel: routes to (evidence: `src/routeTree.gen.ts`)
- Route map → Product inventory: routes to (evidence: `src/routeTree.gen.ts`)
- Route map → Sale entry: routes to (evidence: `src/routeTree.gen.ts`)
- Route map → Sales history: routes to (evidence: `src/routeTree.gen.ts`)
- Route map → Restock entry: routes to (evidence: `src/routeTree.gen.ts`)
- Route map → Restock history: routes to (evidence: `src/routeTree.gen.ts`)
- Route map → Reports: routes to (evidence: `src/routeTree.gen.ts`)
- Route map → Record page: routes to (evidence: `src/routeTree.gen.ts`)
- Route map → Settings: routes to (evidence: `src/routeTree.gen.ts`)
- Route map → Inbox: routes to (evidence: `src/routeTree.gen.ts`)
- Route map → More page: routes to (evidence: `src/routeTree.gen.ts`)
- App shell → Business onboarding: renders (evidence: `src/routes/app.tsx`)
- App shell → Sync status: renders (evidence: `src/routes/app.tsx`)
- App shell → Business context: uses context (evidence: `src/routes/app.tsx`)
- Business context → Supabase client: loads memberships (evidence: `src/hooks/use-app.tsx`)
- Product inventory → Business context: uses context (evidence: `src/routes/app.index.tsx`)
- Sale entry → Business context: uses context (evidence: `src/routes/app.sale.tsx`)
- Restock entry → Business context: uses context (evidence: `src/routes/app.restock.tsx`)
- Product inventory → Local cache and queue: reads cache (evidence: `src/routes/app.index.tsx`)
- Sale entry → Local cache and queue: queues sale (evidence: `src/routes/app.sale.tsx`)
- Restock entry → Local cache and queue: queues restock (evidence: `src/routes/app.restock.tsx`)
- Sale entry → Receipt: shows receipt (evidence: `src/routes/app.sale.tsx`)
- Sales history → Receipt: shows receipt (evidence: `src/routes/app.sales-log.tsx`)
- Reports → Restock entry: links to (evidence: `src/routes/app.reports.tsx`)
- Offline sync hook → Local cache and queue: reads queue (evidence: `src/hooks/use-offline-sync.ts`)
- Sync status → Offline sync hook: displays status
- Local cache and queue → Supabase client: syncs queued work (evidence: `src/lib/offline.ts`)
- Product inventory → Supabase client: fetches products (evidence: `src/routes/app.index.tsx`)
- Sale entry → Supabase client: fetches products (evidence: `src/routes/app.sale.tsx`)
- Restock entry → Supabase client: fetches products (evidence: `src/routes/app.restock.tsx`)
- Sales history → Supabase client: loads history (evidence: `src/routes/app.sales-log.tsx`)
- Reports → Supabase client: loads transactions (evidence: `src/routes/app.reports.tsx`)
- Supabase client → Supabase service: connects (evidence: `src/integrations/supabase/client.ts`)
