# farfar2/gudangappfixed architecture

> Architecture diagram of the GitHub repository farfar2/gudangappfixed, 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/farfar2/gudangappfixed
- Repository: https://github.com/farfar2/gudangappfixed

## Overview

GudangApp is a warehouse-management web app. Users sign in, then navigate role-filtered screens to maintain SKU and category records, receive or dispatch stock, and review inventory, purchasing, audit, and analytics information. The main operational path runs from scan or purchase-order actions through shared inventory state to Supabase-backed records; AuthContext supplies identity and the database enforces role permissions with RLS. The README documents the role model and RLS, while several view-to-context relationships are supported by the SOURCE INDEX; unsampled implementation details are not inferred.

Main entry points: [`src/App.tsx`](https://github.com/farfar2/gudangappfixed/blob/main/src/App.tsx) (App router), [`src/context/InventoryContext.tsx`](https://github.com/farfar2/gudangappfixed/blob/main/src/context/InventoryContext.tsx) (Inventory state and actions), [`src/context/AuthContext.tsx`](https://github.com/farfar2/gudangappfixed/blob/main/src/context/AuthContext.tsx) (Authentication), [`src/views/BarcodeLabelsView.tsx`](https://github.com/farfar2/gudangappfixed/blob/main/src/views/BarcodeLabelsView.tsx) (Barcode labels)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application and access"]
  node_app["App router<br/>[App.tsx]"]
  node_auth["Authentication<br/>[AuthContext.tsx]"]
  node_navigation["Role-aware navigation<br/>[Sidebar.tsx]"]
  node_login["Login screen<br/>[LoginView.tsx]"]
end

subgraph group_operations["Warehouse operations"]
  node_scanin["Scan in<br/>[ScanInView.tsx]"]
  node_scanout["Scan out<br/>[ScanOutView.tsx]"]
  node_inventoryview["Inventory status<br/>[InventoryView.tsx]"]
  node_labels["Barcode labels"]
  node_barcode["Barcode renderer"]
end

subgraph group_management["Catalog and procurement"]
  node_sku["SKU management"]
  node_categories["Category management"]
  node_users["User management"]
  node_purchase["Purchase orders"]
end

subgraph group_insights["Reporting and analysis"]
  node_restock["Restock calculator"]
  node_dashboard["Dashboard<br/>[DashboardView.tsx]"]
  node_analytics["Analytics<br/>[AnalyticsView.tsx]"]
  node_audit["Audit log<br/>[AuditLogView.tsx]"]
end

subgraph group_data["Shared data services"]
  node_inventory["Inventory state and actions"]
  node_seed["Sample data<br/>[seedData.ts]"]
  node_types["Warehouse data types<br/>[database.ts]"]
  node_supabaseclient["Supabase client<br/>[supabase.ts]"]
  node_schema["Database policies and schema"]
end

node_staff(("Warehouse user"))
node_supabase[("Supabase platform")]

node_staff -->|"uses"| node_app
node_app -->|"provides auth"| node_auth
node_app -->|"provides state"| node_inventory
node_app -->|"shows when signed out"| node_login
node_app -->|"routes navigation"| node_navigation
node_app -->|"routes scan-in"| node_scanin
node_app -->|"routes scan-out"| node_scanout
node_app -->|"routes inventory"| node_inventoryview
node_app -->|"routes catalog"| node_sku
node_app -->|"routes categories"| node_categories
node_app -->|"routes users"| node_users
node_app -->|"routes orders"| node_purchase
node_app -->|"routes restock"| node_restock
node_app -->|"routes dashboard"| node_dashboard
node_app -->|"routes analytics"| node_analytics
node_app -->|"routes audit"| node_audit
node_app -->|"routes labels"| node_labels
node_auth -->|"authenticates via"| node_supabaseclient
node_auth -->|"uses fallback profiles"| node_seed
node_navigation -->|"reads user role"| node_auth
node_login -->|"signs in through"| node_auth
node_scanin -->|"records receipt"| node_inventory
node_scanout -->|"records dispatch"| node_inventory
node_inventoryview -->|"reads inventory"| node_inventory
node_sku -->|"uses catalog state"| node_inventory
node_purchase -->|"uses order actions"| node_inventory
node_restock -->|"reads stock data"| node_inventory
node_dashboard -->|"reads summaries"| node_inventory
node_analytics -->|"reads inventory data"| node_inventory
node_audit -->|"reads movement data"| node_inventory
node_labels -->|"reads SKU data"| node_inventory
node_labels -->|"renders labels"| node_barcode
node_inventory -->|"loads and writes"| node_supabaseclient
node_inventory -->|"uses fallback data"| node_seed
node_inventory -->|"checks current user"| node_auth
node_auth -->|"uses profile types"| node_types
node_inventory -->|"uses domain types"| node_types
node_supabaseclient -->|"connects to"| node_supabase
node_schema -->|"defines RLS schema"| node_supabase

click node_app "https://github.com/farfar2/gudangappfixed/blob/main/src/App.tsx"
click node_auth "https://github.com/farfar2/gudangappfixed/blob/main/src/context/AuthContext.tsx"
click node_navigation "https://github.com/farfar2/gudangappfixed/blob/main/src/components/layout/Sidebar.tsx"
click node_login "https://github.com/farfar2/gudangappfixed/blob/main/src/views/LoginView.tsx"
click node_scanin "https://github.com/farfar2/gudangappfixed/blob/main/src/views/ScanInView.tsx"
click node_scanout "https://github.com/farfar2/gudangappfixed/blob/main/src/views/ScanOutView.tsx"
click node_inventoryview "https://github.com/farfar2/gudangappfixed/blob/main/src/views/InventoryView.tsx"
click node_inventory "https://github.com/farfar2/gudangappfixed/blob/main/src/context/InventoryContext.tsx"
click node_sku "https://github.com/farfar2/gudangappfixed/blob/main/src/views/SkuManagementView.tsx"
click node_categories "https://github.com/farfar2/gudangappfixed/blob/main/src/views/CategoryManagementView.tsx"
click node_users "https://github.com/farfar2/gudangappfixed/blob/main/src/views/UserManagementView.tsx"
click node_purchase "https://github.com/farfar2/gudangappfixed/blob/main/src/views/PurchaseOrdersView.tsx"
click node_restock "https://github.com/farfar2/gudangappfixed/blob/main/src/views/RestockCalculatorView.tsx"
click node_dashboard "https://github.com/farfar2/gudangappfixed/blob/main/src/views/DashboardView.tsx"
click node_analytics "https://github.com/farfar2/gudangappfixed/blob/main/src/views/AnalyticsView.tsx"
click node_audit "https://github.com/farfar2/gudangappfixed/blob/main/src/views/AuditLogView.tsx"
click node_labels "https://github.com/farfar2/gudangappfixed/blob/main/src/views/BarcodeLabelsView.tsx"
click node_barcode "https://github.com/farfar2/gudangappfixed/blob/main/src/components/common/BarcodeRenderer.tsx"
click node_seed "https://github.com/farfar2/gudangappfixed/blob/main/src/lib/seedData.ts"
click node_types "https://github.com/farfar2/gudangappfixed/blob/main/src/types/database.ts"
click node_supabaseclient "https://github.com/farfar2/gudangappfixed/blob/main/src/lib/supabase.ts"
click node_schema "https://github.com/farfar2/gudangappfixed/blob/main/supabase/schema_additions.sql"

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_app,node_auth,node_navigation,node_login,node_staff toneBlue
class node_scanin,node_scanout,node_inventoryview,node_labels,node_barcode,node_supabase toneAmber
class node_sku,node_categories,node_users,node_purchase toneMint
class node_restock,node_dashboard,node_analytics,node_audit toneRose
class node_inventory,node_seed,node_types,node_supabaseclient,node_schema toneIndigo
```

## Components

### Application and access

- [App router](https://github.com/farfar2/gudangappfixed/blob/main/src/App.tsx): `src/App.tsx`
- [Authentication](https://github.com/farfar2/gudangappfixed/blob/main/src/context/AuthContext.tsx): `src/context/AuthContext.tsx`
- [Role-aware navigation](https://github.com/farfar2/gudangappfixed/blob/main/src/components/layout/Sidebar.tsx): `src/components/layout/Sidebar.tsx`
- [Login screen](https://github.com/farfar2/gudangappfixed/blob/main/src/views/LoginView.tsx): `src/views/LoginView.tsx`

### Warehouse operations

- [Scan in](https://github.com/farfar2/gudangappfixed/blob/main/src/views/ScanInView.tsx): `src/views/ScanInView.tsx`
- [Scan out](https://github.com/farfar2/gudangappfixed/blob/main/src/views/ScanOutView.tsx): `src/views/ScanOutView.tsx`
- [Inventory status](https://github.com/farfar2/gudangappfixed/blob/main/src/views/InventoryView.tsx): `src/views/InventoryView.tsx`
- [Barcode labels](https://github.com/farfar2/gudangappfixed/blob/main/src/views/BarcodeLabelsView.tsx): `src/views/BarcodeLabelsView.tsx`
- [Barcode renderer](https://github.com/farfar2/gudangappfixed/blob/main/src/components/common/BarcodeRenderer.tsx): `src/components/common/BarcodeRenderer.tsx`

### Catalog and procurement

- [SKU management](https://github.com/farfar2/gudangappfixed/blob/main/src/views/SkuManagementView.tsx): `src/views/SkuManagementView.tsx`
- [Category management](https://github.com/farfar2/gudangappfixed/blob/main/src/views/CategoryManagementView.tsx): `src/views/CategoryManagementView.tsx`
- [User management](https://github.com/farfar2/gudangappfixed/blob/main/src/views/UserManagementView.tsx): `src/views/UserManagementView.tsx`
- [Purchase orders](https://github.com/farfar2/gudangappfixed/blob/main/src/views/PurchaseOrdersView.tsx): `src/views/PurchaseOrdersView.tsx`

### Reporting and analysis

- [Restock calculator](https://github.com/farfar2/gudangappfixed/blob/main/src/views/RestockCalculatorView.tsx): `src/views/RestockCalculatorView.tsx`
- [Dashboard](https://github.com/farfar2/gudangappfixed/blob/main/src/views/DashboardView.tsx): `src/views/DashboardView.tsx`
- [Analytics](https://github.com/farfar2/gudangappfixed/blob/main/src/views/AnalyticsView.tsx): `src/views/AnalyticsView.tsx`
- [Audit log](https://github.com/farfar2/gudangappfixed/blob/main/src/views/AuditLogView.tsx): `src/views/AuditLogView.tsx`

### Shared data services

- [Inventory state and actions](https://github.com/farfar2/gudangappfixed/blob/main/src/context/InventoryContext.tsx): `src/context/InventoryContext.tsx`
- [Sample data](https://github.com/farfar2/gudangappfixed/blob/main/src/lib/seedData.ts): `src/lib/seedData.ts`
- [Warehouse data types](https://github.com/farfar2/gudangappfixed/blob/main/src/types/database.ts): `src/types/database.ts`
- [Supabase client](https://github.com/farfar2/gudangappfixed/blob/main/src/lib/supabase.ts): `src/lib/supabase.ts`
- [Database policies and schema](https://github.com/farfar2/gudangappfixed/blob/main/supabase/schema_additions.sql): `supabase/schema_additions.sql`

### Other components

- **Warehouse user**
- **Supabase platform**

## Connections

- Warehouse user → App router: uses
- App router → Authentication: provides auth (evidence: `src/App.tsx`)
- App router → Inventory state and actions: provides state (evidence: `src/App.tsx`)
- App router → Login screen: shows when signed out (evidence: `src/App.tsx`)
- App router → Role-aware navigation: routes navigation (evidence: `src/App.tsx`)
- App router → Scan in: routes scan-in (evidence: `src/App.tsx`)
- App router → Scan out: routes scan-out (evidence: `src/App.tsx`)
- App router → Inventory status: routes inventory (evidence: `src/App.tsx`)
- App router → SKU management: routes catalog (evidence: `src/App.tsx`)
- App router → Category management: routes categories (evidence: `src/App.tsx`)
- App router → User management: routes users (evidence: `src/App.tsx`)
- App router → Purchase orders: routes orders (evidence: `src/App.tsx`)
- App router → Restock calculator: routes restock (evidence: `src/App.tsx`)
- App router → Dashboard: routes dashboard (evidence: `src/App.tsx`)
- App router → Analytics: routes analytics (evidence: `src/App.tsx`)
- App router → Audit log: routes audit (evidence: `src/App.tsx`)
- App router → Barcode labels: routes labels (evidence: `src/App.tsx`)
- Authentication → Supabase client: authenticates via (evidence: `src/context/AuthContext.tsx`)
- Authentication → Sample data: uses fallback profiles (evidence: `src/context/AuthContext.tsx`)
- Role-aware navigation → Authentication: reads user role (evidence: `src/components/layout/Sidebar.tsx`)
- Login screen → Authentication: signs in through (evidence: `src/views/LoginView.tsx`)
- Scan in → Inventory state and actions: records receipt (evidence: `src/views/ScanInView.tsx`)
- Scan out → Inventory state and actions: records dispatch (evidence: `src/views/ScanOutView.tsx`)
- Inventory status → Inventory state and actions: reads inventory (evidence: `src/views/InventoryView.tsx`)
- SKU management → Inventory state and actions: uses catalog state (evidence: `src/views/SkuManagementView.tsx`)
- Purchase orders → Inventory state and actions: uses order actions (evidence: `src/views/PurchaseOrdersView.tsx`)
- Restock calculator → Inventory state and actions: reads stock data (evidence: `src/views/RestockCalculatorView.tsx`)
- Dashboard → Inventory state and actions: reads summaries (evidence: `src/views/DashboardView.tsx`)
- Analytics → Inventory state and actions: reads inventory data (evidence: `src/views/AnalyticsView.tsx`)
- Audit log → Inventory state and actions: reads movement data (evidence: `src/views/AuditLogView.tsx`)
- Barcode labels → Inventory state and actions: reads SKU data (evidence: `src/views/BarcodeLabelsView.tsx`)
- Barcode labels → Barcode renderer: renders labels (evidence: `src/views/BarcodeLabelsView.tsx`)
- Inventory state and actions → Supabase client: loads and writes (evidence: `src/context/InventoryContext.tsx`)
- Inventory state and actions → Sample data: uses fallback data (evidence: `src/context/InventoryContext.tsx`)
- Inventory state and actions → Authentication: checks current user (evidence: `src/context/InventoryContext.tsx`)
- Authentication → Warehouse data types: uses profile types (evidence: `src/context/AuthContext.tsx`)
- Inventory state and actions → Warehouse data types: uses domain types (evidence: `src/context/InventoryContext.tsx`)
- Supabase client → Supabase platform: connects to (evidence: `src/lib/supabase.ts`)
- Database policies and schema → Supabase platform: defines RLS schema (evidence: `README.md`)
