# raniel-roque/freshenuppos architecture

> Architecture diagram of the GitHub repository raniel-roque/freshenuppos, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/raniel-roque/freshenuppos
- Repository: https://github.com/raniel-roque/freshenuppos

## Overview

FreshenUp POS is an offline point-of-sale app for managing a menu, building and processing dine-in or take-out orders, reviewing sales, and administering account and database settings. The user enters through the React app, which coordinates login and feature screens; order and catalog actions reach the database service, while reports and settings use callbacks routed through the app. Persistence is platform-dependent: the service supports Capacitor SQLite on Android and Electron IPC on desktop. Trial status is checked separately at startup. Some feature wiring and platform-specific paths are documented but not shown in the sampled excerpts.

Main entry points: [`src/App.tsx`](https://github.com/raniel-roque/freshenuppos/blob/main/src/App.tsx) (App coordinator), [`src/services/trial.ts`](https://github.com/raniel-roque/freshenuppos/blob/main/src/services/trial.ts) (Trial status), [`src/services/database.ts`](https://github.com/raniel-roque/freshenuppos/blob/main/src/services/database.ts) (Database operations), [`src/main.tsx`](https://github.com/raniel-roque/freshenuppos/blob/main/src/main.tsx) (React entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App shell"]
  node_entry["React entry<br/>[main.tsx]"]
  node_app["App coordinator<br/>[App.tsx]"]
end

subgraph group_pos["POS workflows"]
  node_login["Login<br/>[Login.tsx]"]
  node_items["Menu management<br/>[ItemManagement.tsx]"]
  node_orders["Order checkout"]
  node_pending["Pending orders<br/>[PendingOrders.tsx]"]
  node_reports["Sales reports<br/>[SalesReport.tsx]"]
  node_settings["Settings and backup<br/>[Settings.tsx]"]
end

subgraph group_data["Data services"]
  node_trial["Trial status<br/>[trial.ts]"]
  node_dbservice["Database operations<br/>[database.ts]"]
end

subgraph group_platform["Platform storage"]
  node_sqlite[("Capacitor SQLite")]
  node_electron["Electron IPC host<br/>[main.js]"]
  node_desktopdb[("Desktop SQLite file")]
  node_preferences[("Trial preferences")]
  node_browserstorage[("Browser local storage")]
end

node_operator(("POS operator"))

node_operator -->|"opens app"| node_entry
node_entry -->|"renders"| node_app
node_app -->|"shows login"| node_login
node_app -->|"shows menu"| node_items
node_app -->|"shows orders"| node_orders
node_app -->|"shows pending"| node_pending
node_app -->|"shows reports"| node_reports
node_app -->|"shows settings"| node_settings
node_app -->|"calls"| node_dbservice
node_app -->|"checks trial"| node_trial
node_login -->|"submits credentials"| node_app
node_items -->|"sends item actions"| node_app
node_orders -->|"sends order actions"| node_app
node_pending -->|"requests order actions"| node_app
node_reports -->|"requests report data"| node_app
node_settings -->|"requests settings actions"| node_app
node_dbservice -.->|"queries on Android"| node_sqlite
node_dbservice -.->|"invokes IPC on desktop"| node_electron
node_electron -->|"reads and writes"| node_desktopdb
node_trial -->|"stores trial state"| node_preferences
node_trial -.->|"uses fallback"| node_browserstorage

click node_entry "https://github.com/raniel-roque/freshenuppos/blob/main/src/main.tsx"
click node_app "https://github.com/raniel-roque/freshenuppos/blob/main/src/App.tsx"
click node_login "https://github.com/raniel-roque/freshenuppos/blob/main/src/components/Login.tsx"
click node_items "https://github.com/raniel-roque/freshenuppos/blob/main/src/components/ItemManagement.tsx"
click node_orders "https://github.com/raniel-roque/freshenuppos/blob/main/src/components/OrderManagement.tsx"
click node_pending "https://github.com/raniel-roque/freshenuppos/blob/main/src/components/PendingOrders.tsx"
click node_reports "https://github.com/raniel-roque/freshenuppos/blob/main/src/components/SalesReport.tsx"
click node_settings "https://github.com/raniel-roque/freshenuppos/blob/main/src/components/Settings.tsx"
click node_trial "https://github.com/raniel-roque/freshenuppos/blob/main/src/services/trial.ts"
click node_dbservice "https://github.com/raniel-roque/freshenuppos/blob/main/src/services/database.ts"
click node_electron "https://github.com/raniel-roque/freshenuppos/blob/main/electron/main.js"

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_entry,node_app toneBlue
class node_login,node_items,node_orders,node_pending,node_reports,node_settings toneAmber
class node_trial,node_dbservice toneMint
class node_sqlite,node_electron,node_desktopdb,node_preferences,node_browserstorage toneRose
class node_operator toneIndigo
```

## Components

### App shell

- [React entry](https://github.com/raniel-roque/freshenuppos/blob/main/src/main.tsx): `src/main.tsx`
- [App coordinator](https://github.com/raniel-roque/freshenuppos/blob/main/src/App.tsx): `src/App.tsx`

### POS workflows

- [Login](https://github.com/raniel-roque/freshenuppos/blob/main/src/components/Login.tsx): `src/components/Login.tsx`
- [Menu management](https://github.com/raniel-roque/freshenuppos/blob/main/src/components/ItemManagement.tsx): `src/components/ItemManagement.tsx`
- [Order checkout](https://github.com/raniel-roque/freshenuppos/blob/main/src/components/OrderManagement.tsx): `src/components/OrderManagement.tsx`
- [Pending orders](https://github.com/raniel-roque/freshenuppos/blob/main/src/components/PendingOrders.tsx): `src/components/PendingOrders.tsx`
- [Sales reports](https://github.com/raniel-roque/freshenuppos/blob/main/src/components/SalesReport.tsx): `src/components/SalesReport.tsx`
- [Settings and backup](https://github.com/raniel-roque/freshenuppos/blob/main/src/components/Settings.tsx): `src/components/Settings.tsx`

### Data services

- [Trial status](https://github.com/raniel-roque/freshenuppos/blob/main/src/services/trial.ts): `src/services/trial.ts`
- [Database operations](https://github.com/raniel-roque/freshenuppos/blob/main/src/services/database.ts): `src/services/database.ts`

### Platform storage

- **Capacitor SQLite**
- [Electron IPC host](https://github.com/raniel-roque/freshenuppos/blob/main/electron/main.js): `electron/main.js`
- **Desktop SQLite file**
- **Trial preferences**
- **Browser local storage**

### Other components

- **POS operator**

## Connections

- POS operator → React entry: opens app
- React entry → App coordinator: renders
- App coordinator → Login: shows login
- App coordinator → Menu management: shows menu
- App coordinator → Order checkout: shows orders
- App coordinator → Pending orders: shows pending
- App coordinator → Sales reports: shows reports
- App coordinator → Settings and backup: shows settings
- App coordinator → Database operations: calls
- App coordinator → Trial status: checks trial
- Login → App coordinator: submits credentials
- Menu management → App coordinator: sends item actions
- Order checkout → App coordinator: sends order actions
- Pending orders → App coordinator: requests order actions
- Sales reports → App coordinator: requests report data
- Settings and backup → App coordinator: requests settings actions
- Database operations → Capacitor SQLite: queries on Android
- Database operations → Electron IPC host: invokes IPC on desktop
- Electron IPC host → Desktop SQLite file: reads and writes
- Trial status → Trial preferences: stores trial state
- Trial status → Browser local storage: uses fallback
