# tonyyyzxc/cremoso-core architecture

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

- Interactive diagram: https://gitdiagram.com/tonyyyzxc/cremoso-core
- Repository: https://github.com/tonyyyzxc/cremoso-core

## Overview

Cremoso-Core is a multi-branch sales and operations web app. Staff and managers sign in, create and process orders, and work with branch-scoped stock, schedules, reconciliation, and activity; admins also manage branches, catalog, accounts, and reports. The React client calls an Express REST API backed by MongoDB, with optional Google, Firebase, and email integrations. The graph preserves the README’s major product areas. Some subsystem links are documented at the API level because their route and page implementations were not sampled.

Main entry points: [`client/App.jsx`](https://github.com/tonyyyzxc/cremoso-core/blob/main/client/App.jsx) (Role-based app routes), [`server/server.js`](https://github.com/tonyyyzxc/cremoso-core/blob/main/server/server.js) (Express REST API), [`server/controllers/ordersController.js`](https://github.com/tonyyyzxc/cremoso-core/blob/main/server/controllers/ordersController.js) (Order processing), [`server/controllers/authController.js`](https://github.com/tonyyyzxc/cremoso-core/blob/main/server/controllers/authController.js) (Authentication and sessions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web application"]
  node_app["Role-based app routes<br/>[App.jsx]"]
  node_orders_ui["Order entry and queue<br/>[NewOrder.jsx]"]
  node_sales_ui["Orders and transactions<br/>[Orders.jsx]"]
  node_dashboard["Branch dashboard<br/>[Dashboard.jsx]"]
  node_stock_ui["Menu and inventory<br/>[Menu.jsx]"]
  node_schedule_ui["Schedules and staff<br/>[Schedule.jsx]"]
  node_recon_ui["Cash reconciliation<br/>[Reconciliation.jsx]"]
  node_admin_ui["Branch and account admin<br/>[Management.jsx]"]
  node_reports_ui["Reports and exports<br/>[Reports.jsx]"]
  node_settings_ui["Settings and integrations<br/>[Settings.jsx]"]
  node_drive_ui["Drive browser<br/>[Drive.jsx]"]
  node_activity_ui["Activity history<br/>[ActivityLogs.jsx]"]
  node_login_ui["Sign-in<br/>[Login.jsx]"]
  node_api_client["API client<br/>[api.js]"]
end

subgraph group_operations["Branch operations"]
  node_orders["Order processing"]
  node_order_data[("Order and stock records<br/>[order.js]")]
  node_branches[("Branch records<br/>[branch.js]")]
  node_calendar["Calendar sync"]
end

subgraph group_admin["Administration and insights"]
  node_reports["Report generation"]
end

subgraph group_platform["API and identity"]
  node_api["Express REST API<br/>[server.js]"]
  node_auth["Authentication and sessions<br/>[authController.js]"]
  node_auth_guard["Session and role checks<br/>[authMiddleware.js]"]
  node_users[("User accounts<br/>[user.js]")]
  node_sessions[("Session records<br/>[session.js]")]
  node_activity["Activity logging<br/>[activityLog.js]"]
  node_mongo[("MongoDB")]
end

subgraph group_integrations["External services"]
  node_drive["Drive operations<br/>[driveController.js]"]
  node_google["Google services"]
  node_sheets["Spreadsheet export"]
  node_push["Push notifications"]
  node_firebase["Firebase messaging"]
  node_email["Transactional email<br/>[mailer.js]"]
end

node_staff(("Staff and managers"))

node_staff -->|"uses"| node_app
node_app -->|"routes to"| node_login_ui
node_app -->|"routes to"| node_orders_ui
node_app -->|"routes to"| node_sales_ui
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_stock_ui
node_app -->|"routes to"| node_schedule_ui
node_app -->|"routes to"| node_recon_ui
node_app -->|"routes to"| node_admin_ui
node_app -->|"routes to"| node_reports_ui
node_app -->|"routes to"| node_settings_ui
node_app -->|"routes to"| node_drive_ui
node_app -->|"routes to"| node_activity_ui
node_login_ui -.->|"authenticates via"| node_api
node_api -->|"routes requests"| node_auth
node_api -->|"routes requests"| node_orders
node_api -->|"routes requests"| node_reports
node_api -->|"routes requests"| node_calendar
node_api -->|"routes requests"| node_drive
node_auth -->|"creates sessions"| node_sessions
node_auth_guard -->|"checks session"| node_sessions
node_auth_guard -->|"loads account"| node_users
node_orders -->|"writes orders"| node_order_data
node_orders -->|"records actions"| node_activity
node_auth -->|"records sign-in"| node_activity
node_calendar -->|"syncs shifts"| node_google
node_drive -->|"manages files"| node_google
node_reports -.->|"exports reports"| node_sheets
node_sheets -.->|"uses"| node_google
node_orders -.->|"notifies"| node_push
node_push -->|"sends messages"| node_firebase
node_auth -->|"sends reset codes"| node_email
node_api -->|"connects to"| node_mongo
node_orders -.->|"persists data"| node_mongo
node_reports -.->|"reads data"| node_mongo
node_branches -.->|"stores branch data"| node_mongo
node_users -.->|"stores accounts"| node_mongo

click node_app "https://github.com/tonyyyzxc/cremoso-core/blob/main/client/App.jsx"
click node_orders_ui "https://github.com/tonyyyzxc/cremoso-core/blob/main/client/src/pages/NewOrder.jsx"
click node_sales_ui "https://github.com/tonyyyzxc/cremoso-core/blob/main/client/src/pages/Orders.jsx"
click node_dashboard "https://github.com/tonyyyzxc/cremoso-core/blob/main/client/src/pages/Dashboard.jsx"
click node_stock_ui "https://github.com/tonyyyzxc/cremoso-core/blob/main/client/src/pages/Menu.jsx"
click node_schedule_ui "https://github.com/tonyyyzxc/cremoso-core/blob/main/client/src/pages/Schedule.jsx"
click node_recon_ui "https://github.com/tonyyyzxc/cremoso-core/blob/main/client/src/pages/Reconciliation.jsx"
click node_admin_ui "https://github.com/tonyyyzxc/cremoso-core/blob/main/client/src/pages/Management.jsx"
click node_reports_ui "https://github.com/tonyyyzxc/cremoso-core/blob/main/client/src/pages/Reports.jsx"
click node_settings_ui "https://github.com/tonyyyzxc/cremoso-core/blob/main/client/src/pages/Settings.jsx"
click node_drive_ui "https://github.com/tonyyyzxc/cremoso-core/blob/main/client/src/pages/Drive.jsx"
click node_activity_ui "https://github.com/tonyyyzxc/cremoso-core/blob/main/client/src/pages/ActivityLogs.jsx"
click node_login_ui "https://github.com/tonyyyzxc/cremoso-core/blob/main/client/src/pages/Login.jsx"
click node_api_client "https://github.com/tonyyyzxc/cremoso-core/blob/main/client/src/utils/api.js"
click node_api "https://github.com/tonyyyzxc/cremoso-core/blob/main/server/server.js"
click node_auth "https://github.com/tonyyyzxc/cremoso-core/blob/main/server/controllers/authController.js"
click node_auth_guard "https://github.com/tonyyyzxc/cremoso-core/blob/main/server/middleware/authMiddleware.js"
click node_orders "https://github.com/tonyyyzxc/cremoso-core/blob/main/server/controllers/ordersController.js"
click node_order_data "https://github.com/tonyyyzxc/cremoso-core/blob/main/server/models/order.js"
click node_branches "https://github.com/tonyyyzxc/cremoso-core/blob/main/server/models/branch.js"
click node_users "https://github.com/tonyyyzxc/cremoso-core/blob/main/server/models/user.js"
click node_sessions "https://github.com/tonyyyzxc/cremoso-core/blob/main/server/models/session.js"
click node_activity "https://github.com/tonyyyzxc/cremoso-core/blob/main/server/utils/activityLog.js"
click node_reports "https://github.com/tonyyyzxc/cremoso-core/blob/main/server/controllers/reportsController.js"
click node_calendar "https://github.com/tonyyyzxc/cremoso-core/blob/main/server/controllers/calendarController.js"
click node_drive "https://github.com/tonyyyzxc/cremoso-core/blob/main/server/controllers/driveController.js"
click node_sheets "https://github.com/tonyyyzxc/cremoso-core/blob/main/server/utils/googleSheetsAuth.js"
click node_push "https://github.com/tonyyyzxc/cremoso-core/blob/main/server/utils/pushNotifications.js"
click node_email "https://github.com/tonyyyzxc/cremoso-core/blob/main/server/utils/mailer.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_app,node_orders_ui,node_sales_ui,node_dashboard,node_stock_ui,node_schedule_ui,node_recon_ui,node_admin_ui,node_reports_ui,node_settings_ui,node_drive_ui,node_activity_ui,node_login_ui,node_api_client toneBlue
class node_orders,node_order_data,node_branches,node_calendar toneAmber
class node_reports toneMint
class node_api,node_auth,node_auth_guard,node_users,node_sessions,node_activity,node_mongo toneRose
class node_drive,node_google,node_sheets,node_push,node_firebase,node_email,node_staff toneIndigo
```

## Components

### Web application

- [Role-based app routes](https://github.com/tonyyyzxc/cremoso-core/blob/main/client/App.jsx): `client/App.jsx`
- [Order entry and queue](https://github.com/tonyyyzxc/cremoso-core/blob/main/client/src/pages/NewOrder.jsx): `client/src/pages/NewOrder.jsx`
- [Orders and transactions](https://github.com/tonyyyzxc/cremoso-core/blob/main/client/src/pages/Orders.jsx): `client/src/pages/Orders.jsx`
- [Branch dashboard](https://github.com/tonyyyzxc/cremoso-core/blob/main/client/src/pages/Dashboard.jsx): `client/src/pages/Dashboard.jsx`
- [Menu and inventory](https://github.com/tonyyyzxc/cremoso-core/blob/main/client/src/pages/Menu.jsx): `client/src/pages/Menu.jsx`
- [Schedules and staff](https://github.com/tonyyyzxc/cremoso-core/blob/main/client/src/pages/Schedule.jsx): `client/src/pages/Schedule.jsx`
- [Cash reconciliation](https://github.com/tonyyyzxc/cremoso-core/blob/main/client/src/pages/Reconciliation.jsx): `client/src/pages/Reconciliation.jsx`
- [Branch and account admin](https://github.com/tonyyyzxc/cremoso-core/blob/main/client/src/pages/Management.jsx): `client/src/pages/Management.jsx`
- [Reports and exports](https://github.com/tonyyyzxc/cremoso-core/blob/main/client/src/pages/Reports.jsx): `client/src/pages/Reports.jsx`
- [Settings and integrations](https://github.com/tonyyyzxc/cremoso-core/blob/main/client/src/pages/Settings.jsx): `client/src/pages/Settings.jsx`
- [Drive browser](https://github.com/tonyyyzxc/cremoso-core/blob/main/client/src/pages/Drive.jsx): `client/src/pages/Drive.jsx`
- [Activity history](https://github.com/tonyyyzxc/cremoso-core/blob/main/client/src/pages/ActivityLogs.jsx): `client/src/pages/ActivityLogs.jsx`
- [Sign-in](https://github.com/tonyyyzxc/cremoso-core/blob/main/client/src/pages/Login.jsx): `client/src/pages/Login.jsx`
- [API client](https://github.com/tonyyyzxc/cremoso-core/blob/main/client/src/utils/api.js): `client/src/utils/api.js`

### Branch operations

- [Order processing](https://github.com/tonyyyzxc/cremoso-core/blob/main/server/controllers/ordersController.js): `server/controllers/ordersController.js`
- [Order and stock records](https://github.com/tonyyyzxc/cremoso-core/blob/main/server/models/order.js): `server/models/order.js`
- [Branch records](https://github.com/tonyyyzxc/cremoso-core/blob/main/server/models/branch.js): `server/models/branch.js`
- [Calendar sync](https://github.com/tonyyyzxc/cremoso-core/blob/main/server/controllers/calendarController.js): `server/controllers/calendarController.js`

### Administration and insights

- [Report generation](https://github.com/tonyyyzxc/cremoso-core/blob/main/server/controllers/reportsController.js): `server/controllers/reportsController.js`

### API and identity

- [Express REST API](https://github.com/tonyyyzxc/cremoso-core/blob/main/server/server.js): `server/server.js`
- [Authentication and sessions](https://github.com/tonyyyzxc/cremoso-core/blob/main/server/controllers/authController.js): `server/controllers/authController.js`
- [Session and role checks](https://github.com/tonyyyzxc/cremoso-core/blob/main/server/middleware/authMiddleware.js): `server/middleware/authMiddleware.js`
- [User accounts](https://github.com/tonyyyzxc/cremoso-core/blob/main/server/models/user.js): `server/models/user.js`
- [Session records](https://github.com/tonyyyzxc/cremoso-core/blob/main/server/models/session.js): `server/models/session.js`
- [Activity logging](https://github.com/tonyyyzxc/cremoso-core/blob/main/server/utils/activityLog.js): `server/utils/activityLog.js`
- **MongoDB**

### External services

- [Drive operations](https://github.com/tonyyyzxc/cremoso-core/blob/main/server/controllers/driveController.js): `server/controllers/driveController.js`
- **Google services**
- [Spreadsheet export](https://github.com/tonyyyzxc/cremoso-core/blob/main/server/utils/googleSheetsAuth.js): `server/utils/googleSheetsAuth.js`
- [Push notifications](https://github.com/tonyyyzxc/cremoso-core/blob/main/server/utils/pushNotifications.js): `server/utils/pushNotifications.js`
- **Firebase messaging**
- [Transactional email](https://github.com/tonyyyzxc/cremoso-core/blob/main/server/utils/mailer.js): `server/utils/mailer.js`

### Other components

- **Staff and managers**

## Connections

- Staff and managers → Role-based app routes: uses (evidence: `README.md`)
- Role-based app routes → Sign-in: routes to (evidence: `client/App.jsx`)
- Role-based app routes → Order entry and queue: routes to (evidence: `client/App.jsx`)
- Role-based app routes → Orders and transactions: routes to (evidence: `client/App.jsx`)
- Role-based app routes → Branch dashboard: routes to (evidence: `client/App.jsx`)
- Role-based app routes → Menu and inventory: routes to (evidence: `client/App.jsx`)
- Role-based app routes → Schedules and staff: routes to (evidence: `client/App.jsx`)
- Role-based app routes → Cash reconciliation: routes to (evidence: `client/App.jsx`)
- Role-based app routes → Branch and account admin: routes to (evidence: `client/App.jsx`)
- Role-based app routes → Reports and exports: routes to (evidence: `client/App.jsx`)
- Role-based app routes → Settings and integrations: routes to (evidence: `client/App.jsx`)
- Role-based app routes → Drive browser: routes to (evidence: `client/App.jsx`)
- Role-based app routes → Activity history: routes to (evidence: `client/App.jsx`)
- Sign-in → Express REST API: authenticates via (evidence: `README.md`)
- Express REST API → Authentication and sessions: routes requests (evidence: `server/server.js`)
- Express REST API → Order processing: routes requests (evidence: `server/server.js`)
- Express REST API → Report generation: routes requests (evidence: `server/server.js`)
- Express REST API → Calendar sync: routes requests (evidence: `server/server.js`)
- Express REST API → Drive operations: routes requests (evidence: `server/server.js`)
- Authentication and sessions → Session records: creates sessions (evidence: `server/controllers/authController.js`)
- Session and role checks → Session records: checks session (evidence: `server/middleware/authMiddleware.js`)
- Session and role checks → User accounts: loads account (evidence: `server/middleware/authMiddleware.js`)
- Order processing → Order and stock records: writes orders (evidence: `server/controllers/ordersController.js`)
- Order processing → Activity logging: records actions (evidence: `server/controllers/ordersController.js`)
- Authentication and sessions → Activity logging: records sign-in (evidence: `server/controllers/authController.js`)
- Calendar sync → Google services: syncs shifts (evidence: `README.md`)
- Drive operations → Google services: manages files (evidence: `README.md`)
- Report generation → Spreadsheet export: exports reports (evidence: `README.md`)
- Spreadsheet export → Google services: uses (evidence: `README.md`)
- Order processing → Push notifications: notifies (evidence: `server/controllers/ordersController.js`)
- Push notifications → Firebase messaging: sends messages (evidence: `server/utils/pushNotifications.js`)
- Authentication and sessions → Transactional email: sends reset codes (evidence: `server/controllers/authController.js`)
- Express REST API → MongoDB: connects to (evidence: `server/server.js`)
- Order processing → MongoDB: persists data
- Report generation → MongoDB: reads data
- Branch records → MongoDB: stores branch data
- User accounts → MongoDB: stores accounts
