# lm-vicente-j/comal-core architecture

> Architecture diagram of the GitHub repository lm-vicente-j/comal-core, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lm-vicente-j/comal-core
- Repository: https://github.com/lm-vicente-j/comal-core

## Overview

Comal Core is a browser-based point-of-sale and daily-operations app for single-location food businesses. Its principal workflow is staff managing accounts and sales, settling them by cash or transfer or assigning them as customer debt, with activity handled alongside cash-shift operations. Administration covers inventory, recipes, access, expenses, savings, and reporting. The README documents the product capabilities and technology; sampled source confirms selected POS, jornada, expense, menu, and authentication calls. Other links reflect README documentation rather than inspection of unsampled implementations.

Main entry points: [`app/(dashboard)/layout.tsx`](https://github.com/lm-vicente-j/comal-core/blob/main/app/(dashboard)/layout.tsx) (Dashboard shell), [`app/(dashboard)/pos/MobilePosManager.tsx`](https://github.com/lm-vicente-j/comal-core/blob/main/app/(dashboard)/pos/MobilePosManager.tsx) (Point of sale), [`components/Sales-input-client.tsx`](https://github.com/lm-vicente-j/comal-core/blob/main/components/Sales-input-client.tsx) (Account settlement), [`app/(dashboard)/admin/jornada/jornada-manager.tsx`](https://github.com/lm-vicente-j/comal-core/blob/main/app/(dashboard)/admin/jornada/jornada-manager.tsx) (Cash shifts)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_front["Browser experience"]
  node_dashboard["Dashboard shell<br/>[layout.tsx]"]
  node_pos["Point of sale"]
  node_login["Sign-in and setup"]
end

subgraph group_operations["Sales and shifts"]
  node_sales["Account settlement"]
  node_debts["Customer debts"]
  node_jornada["Cash shifts"]
  node_cashform["Cash count form"]
end

subgraph group_admin["Administration"]
  node_inventory["Inventory"]
  node_menu["Menu and recipes<br/>[menu-manager.tsx]"]
  node_access["Access and devices<br/>[access-manager.tsx]"]
  node_expenses["Expenses and salaries"]
  node_savings["Savings"]
  node_settings["Business settings"]
  node_crm["Customers<br/>[crm-manager.tsx]"]
  node_reports["Reports and statistics"]
end

subgraph group_services["Application services"]
  node_auth["Authentication<br/>[auth.ts]"]
  node_salesactions["Sales actions<br/>[sales.ts]"]
  node_customeractions["Customer actions<br/>[customers.ts]"]
  node_debtactions["Debt actions<br/>[debts.ts]"]
  node_shiftactions["Jornada actions<br/>[jornada.ts]"]
  node_analyticsactions["Analytics actions<br/>[analytics.ts]"]
  node_money["Scaled money values<br/>[scaled-values.ts]"]
  node_analytics["Analytics logic<br/>[analytics.ts]"]
end

subgraph group_data["Persistence"]
  node_prisma["Prisma access<br/>[prisma.ts]"]
  node_postgres[("PostgreSQL")]
end

node_staff(("Staff"))

node_staff -->|"signs in"| node_login
node_staff -->|"uses"| node_dashboard
node_dashboard -->|"opens"| node_pos
node_pos -->|"settles account"| node_sales
node_pos -->|"closes account"| node_salesactions
node_sales -->|"settles account"| node_salesactions
node_sales -->|"searches customers"| node_customeractions
node_sales -->|"records debt"| node_debtactions
node_pos -->|"cancels sale"| node_salesactions
node_pos -->|"selects customer"| node_customeractions
node_debts -.->|"manages debts"| node_debtactions
node_dashboard -->|"opens shifts"| node_jornada
node_jornada -->|"records counts"| node_shiftactions
node_jornada -.->|"uses form"| node_cashform
node_jornada -->|"records deposit"| node_savings
node_dashboard -->|"manages stock"| node_inventory
node_inventory -->|"defines recipes"| node_menu
node_menu -->|"uses supplies"| node_inventory
node_dashboard -->|"manages access"| node_access
node_dashboard -->|"records expenses"| node_expenses
node_expenses -->|"checks open shift"| node_shiftactions
node_dashboard -->|"manages customers"| node_crm
node_dashboard -->|"configures business"| node_settings
node_dashboard -->|"reviews results"| node_reports
node_reports -->|"requests reports"| node_analyticsactions
node_analyticsactions -->|"uses analytics"| node_analytics
node_login -->|"authenticates"| node_auth
node_auth -->|"checks identity"| node_prisma
node_salesactions -.->|"persists sales"| node_prisma
node_shiftactions -->|"persists shifts"| node_prisma
node_prisma -->|"stores records"| node_postgres
node_pos -->|"formats amounts"| node_money
node_menu -->|"parses prices"| node_money
node_dashboard -->|"filters statistics"| node_reports

click node_dashboard "https://github.com/lm-vicente-j/comal-core/blob/main/app/(dashboard)/layout.tsx"
click node_pos "https://github.com/lm-vicente-j/comal-core/blob/main/app/(dashboard)/pos/MobilePosManager.tsx"
click node_sales "https://github.com/lm-vicente-j/comal-core/blob/main/components/Sales-input-client.tsx"
click node_debts "https://github.com/lm-vicente-j/comal-core/blob/main/app/(dashboard)/debtors/debtors-manager.tsx"
click node_jornada "https://github.com/lm-vicente-j/comal-core/blob/main/app/(dashboard)/admin/jornada/jornada-manager.tsx"
click node_cashform "https://github.com/lm-vicente-j/comal-core/blob/main/components/cash-count-form.tsx"
click node_inventory "https://github.com/lm-vicente-j/comal-core/blob/main/app/(dashboard)/admin/inventory/inventory-manager.tsx"
click node_menu "https://github.com/lm-vicente-j/comal-core/blob/main/app/(dashboard)/admin/menu/menu-manager.tsx"
click node_access "https://github.com/lm-vicente-j/comal-core/blob/main/app/(dashboard)/admin/access/access-manager.tsx"
click node_expenses "https://github.com/lm-vicente-j/comal-core/blob/main/app/(dashboard)/expenses/expenses-manager.tsx"
click node_savings "https://github.com/lm-vicente-j/comal-core/blob/main/app/(dashboard)/admin/savings/savings-manager.tsx"
click node_settings "https://github.com/lm-vicente-j/comal-core/blob/main/app/(dashboard)/admin/settings/settings-manager.tsx"
click node_crm "https://github.com/lm-vicente-j/comal-core/blob/main/app/(dashboard)/admin/crm/crm-manager.tsx"
click node_reports "https://github.com/lm-vicente-j/comal-core/blob/main/app/(dashboard)/admin/reports/reports-manager.tsx"
click node_login "https://github.com/lm-vicente-j/comal-core/blob/main/app/(auth)/login/login-experience.tsx"
click node_auth "https://github.com/lm-vicente-j/comal-core/blob/main/lib/auth.ts"
click node_salesactions "https://github.com/lm-vicente-j/comal-core/blob/main/lib/actions/sales.ts"
click node_customeractions "https://github.com/lm-vicente-j/comal-core/blob/main/lib/actions/customers.ts"
click node_debtactions "https://github.com/lm-vicente-j/comal-core/blob/main/lib/actions/debts.ts"
click node_shiftactions "https://github.com/lm-vicente-j/comal-core/blob/main/lib/actions/jornada.ts"
click node_analyticsactions "https://github.com/lm-vicente-j/comal-core/blob/main/lib/actions/analytics.ts"
click node_money "https://github.com/lm-vicente-j/comal-core/blob/main/lib/scaled-values.ts"
click node_analytics "https://github.com/lm-vicente-j/comal-core/blob/main/lib/analytics.ts"
click node_prisma "https://github.com/lm-vicente-j/comal-core/blob/main/lib/prisma.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_dashboard,node_pos,node_login toneBlue
class node_sales,node_debts,node_jornada,node_cashform toneAmber
class node_inventory,node_menu,node_access,node_expenses,node_savings,node_settings,node_crm,node_reports toneMint
class node_auth,node_salesactions,node_customeractions,node_debtactions,node_shiftactions,node_analyticsactions,node_money,node_analytics toneRose
class node_prisma,node_postgres,node_staff toneIndigo
```

## Components

### Browser experience

- [Dashboard shell](https://github.com/lm-vicente-j/comal-core/blob/main/app/(dashboard)/layout.tsx): `app/(dashboard)/layout.tsx`
- [Point of sale](https://github.com/lm-vicente-j/comal-core/blob/main/app/(dashboard)/pos/MobilePosManager.tsx): `app/(dashboard)/pos/MobilePosManager.tsx`
- [Sign-in and setup](https://github.com/lm-vicente-j/comal-core/blob/main/app/(auth)/login/login-experience.tsx): `app/(auth)/login/login-experience.tsx`

### Sales and shifts

- [Account settlement](https://github.com/lm-vicente-j/comal-core/blob/main/components/Sales-input-client.tsx): `components/Sales-input-client.tsx`
- [Customer debts](https://github.com/lm-vicente-j/comal-core/blob/main/app/(dashboard)/debtors/debtors-manager.tsx): `app/(dashboard)/debtors/debtors-manager.tsx`
- [Cash shifts](https://github.com/lm-vicente-j/comal-core/blob/main/app/(dashboard)/admin/jornada/jornada-manager.tsx): `app/(dashboard)/admin/jornada/jornada-manager.tsx`
- [Cash count form](https://github.com/lm-vicente-j/comal-core/blob/main/components/cash-count-form.tsx): `components/cash-count-form.tsx`

### Administration

- [Inventory](https://github.com/lm-vicente-j/comal-core/blob/main/app/(dashboard)/admin/inventory/inventory-manager.tsx): `app/(dashboard)/admin/inventory/inventory-manager.tsx`
- [Menu and recipes](https://github.com/lm-vicente-j/comal-core/blob/main/app/(dashboard)/admin/menu/menu-manager.tsx): `app/(dashboard)/admin/menu/menu-manager.tsx`
- [Access and devices](https://github.com/lm-vicente-j/comal-core/blob/main/app/(dashboard)/admin/access/access-manager.tsx): `app/(dashboard)/admin/access/access-manager.tsx`
- [Expenses and salaries](https://github.com/lm-vicente-j/comal-core/blob/main/app/(dashboard)/expenses/expenses-manager.tsx): `app/(dashboard)/expenses/expenses-manager.tsx`
- [Savings](https://github.com/lm-vicente-j/comal-core/blob/main/app/(dashboard)/admin/savings/savings-manager.tsx): `app/(dashboard)/admin/savings/savings-manager.tsx`
- [Business settings](https://github.com/lm-vicente-j/comal-core/blob/main/app/(dashboard)/admin/settings/settings-manager.tsx): `app/(dashboard)/admin/settings/settings-manager.tsx`
- [Customers](https://github.com/lm-vicente-j/comal-core/blob/main/app/(dashboard)/admin/crm/crm-manager.tsx): `app/(dashboard)/admin/crm/crm-manager.tsx`
- [Reports and statistics](https://github.com/lm-vicente-j/comal-core/blob/main/app/(dashboard)/admin/reports/reports-manager.tsx): `app/(dashboard)/admin/reports/reports-manager.tsx`

### Application services

- [Authentication](https://github.com/lm-vicente-j/comal-core/blob/main/lib/auth.ts): `lib/auth.ts`
- [Sales actions](https://github.com/lm-vicente-j/comal-core/blob/main/lib/actions/sales.ts): `lib/actions/sales.ts`
- [Customer actions](https://github.com/lm-vicente-j/comal-core/blob/main/lib/actions/customers.ts): `lib/actions/customers.ts`
- [Debt actions](https://github.com/lm-vicente-j/comal-core/blob/main/lib/actions/debts.ts): `lib/actions/debts.ts`
- [Jornada actions](https://github.com/lm-vicente-j/comal-core/blob/main/lib/actions/jornada.ts): `lib/actions/jornada.ts`
- [Analytics actions](https://github.com/lm-vicente-j/comal-core/blob/main/lib/actions/analytics.ts): `lib/actions/analytics.ts`
- [Scaled money values](https://github.com/lm-vicente-j/comal-core/blob/main/lib/scaled-values.ts): `lib/scaled-values.ts`
- [Analytics logic](https://github.com/lm-vicente-j/comal-core/blob/main/lib/analytics.ts): `lib/analytics.ts`

### Persistence

- [Prisma access](https://github.com/lm-vicente-j/comal-core/blob/main/lib/prisma.ts): `lib/prisma.ts`
- **PostgreSQL**

### Other components

- **Staff**

## Connections

- Staff → Sign-in and setup: signs in (evidence: `README.md`)
- Staff → Dashboard shell: uses (evidence: `README.md`)
- Dashboard shell → Point of sale: opens (evidence: `README.md`)
- Point of sale → Account settlement: settles account (evidence: `app/(dashboard)/pos/MobilePosManager.tsx`)
- Point of sale → Sales actions: closes account (evidence: `app/(dashboard)/pos/MobilePosManager.tsx`)
- Account settlement → Sales actions: settles account (evidence: `components/Sales-input-client.tsx`)
- Account settlement → Customer actions: searches customers (evidence: `components/Sales-input-client.tsx`)
- Account settlement → Debt actions: records debt (evidence: `components/Sales-input-client.tsx`)
- Point of sale → Sales actions: cancels sale (evidence: `app/(dashboard)/pos/MobilePosManager.tsx`)
- Point of sale → Customer actions: selects customer (evidence: `app/(dashboard)/pos/MobilePosManager.tsx`)
- Customer debts → Debt actions: manages debts
- Dashboard shell → Cash shifts: opens shifts (evidence: `README.md`)
- Cash shifts → Jornada actions: records counts (evidence: `app/(dashboard)/admin/jornada/jornada-manager.tsx`)
- Cash shifts → Cash count form: uses form (evidence: `app/(dashboard)/admin/jornada/jornada-manager.tsx`)
- Cash shifts → Savings: records deposit (evidence: `app/(dashboard)/admin/jornada/jornada-manager.tsx`)
- Dashboard shell → Inventory: manages stock (evidence: `README.md`)
- Inventory → Menu and recipes: defines recipes (evidence: `README.md`)
- Menu and recipes → Inventory: uses supplies (evidence: `app/(dashboard)/admin/menu/menu-manager.tsx`)
- Dashboard shell → Access and devices: manages access (evidence: `README.md`)
- Dashboard shell → Expenses and salaries: records expenses (evidence: `README.md`)
- Expenses and salaries → Jornada actions: checks open shift (evidence: `app/(dashboard)/expenses/expenses-manager.tsx`)
- Dashboard shell → Customers: manages customers (evidence: `README.md`)
- Dashboard shell → Business settings: configures business (evidence: `README.md`)
- Dashboard shell → Reports and statistics: reviews results (evidence: `README.md`)
- Reports and statistics → Analytics actions: requests reports (evidence: `app/(dashboard)/admin/reports/reports-manager.tsx`)
- Analytics actions → Analytics logic: uses analytics (evidence: `app/(dashboard)/admin/reports/reports-manager.tsx`)
- Sign-in and setup → Authentication: authenticates (evidence: `app/(auth)/login/page.tsx`)
- Authentication → Prisma access: checks identity
- Sales actions → Prisma access: persists sales
- Jornada actions → Prisma access: persists shifts (evidence: `lib/actions/jornada.ts`)
- Prisma access → PostgreSQL: stores records (evidence: `README.md`)
- Point of sale → Scaled money values: formats amounts (evidence: `app/(dashboard)/pos/MobilePosManager.tsx`)
- Menu and recipes → Scaled money values: parses prices (evidence: `app/(dashboard)/admin/menu/menu-manager.tsx`)
- Dashboard shell → Reports and statistics: filters statistics (evidence: `README.md`)
